How to hide the Streetview street name labels on t

2020-07-24 06:22发布

问题:

I need to get the street names (shortDescription) on street floor removed from streetview panorama: Label I want removed

I know this is possible as seen on https://geoguessr.com/world/play

They seem to use the same kind of json syntax as for customizing a google maps layout f=[{featureType:"poi",elementType:"labels",stylers:[{visibility:"off"}]}], l={disableDefaultUI:!0,disableDoubleClickZoom:!0,clickToGo:!0,linksControl:!0,styles:f} But I'm not even sure these labels are actualy part of the POI ...

I really need some help Thanks !

回答1:

Try to use the showRoadLabels option on StreetViewPanoramaOptions. Works fine for me.

  var panorama = map.getStreetView();
  panorama.setOptions({
     showRoadLabels: false
  });

Docs: https://developers.google.com/maps/documentation/javascript/3.exp/reference#StreetViewPanoramaOptions



回答2:

I just had this same problem, and I figured out the problem was the version of the Google Maps API. Geoguessr uses an older version of the streetview panorama API. Notice the difference:

Version 3.24 (no street names): https://jsfiddle.net/922urh2j/

<script async defer src="https://maps.googleapis.com/maps/api/js?v=3.24&key=AIzaSyCkUOdZ5y7hMm0yrcCQoCvLwzdM6M8s5qk&callback=initialize"></script>

Latest version (includes street names): https://jsfiddle.net/922urh2j/1/

<script async defer src="https://maps.googleapis.com/maps/api/js?&key=AIzaSyCkUOdZ5y7hMm0yrcCQoCvLwzdM6M8s5qk&callback=initialize"></script>

So far as I can tell, there's no option to disable street names if you're using the latest version of the API.