Google Maps API v3 - Display Image capture date in StreetView

独自空忆成欢 提交于 2019-12-08 12:22:46

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!