问题
When you visit maps.google.com there is an information at the right bottom corner saying when the image has been captured: screenshot google maps
However on my site when I use Google Maps API, that information is simply not shown. I cannot find any setting for this either. Does anyone know how to display that information?
EDIT: I don't use google.maps.StreetViewPanorama, but google.maps.Map where the user can switch to StreetView mode.
Thanks!
回答1:
When you create the Street View, specify the imageDateControl
attribute in the options. It's disabled by default; you have to enable it.
Something like:
var panorama = new google.maps.StreetViewPanorama(
document.getElementById('pano'), {
position: yourLocation,
imageDateControl: true
});
See:
- https://developers.google.com/maps/documentation/javascript/3.exp/reference#StreetViewPanoramaOptions
回答2:
I was able to set the options by getting the StreetView object from the map:
this.map = new google.maps.Map(this.divContainer, defaultMapOptions);
this.map.getStreetView().setOptions(defaultStreetViewOptions);
来源:https://stackoverflow.com/questions/41380376/google-maps-api-v3-display-image-capture-date-in-streetview