Remove locations and bus stops / stops from Google Maps

5

I have this code:

<script>
  function init() {
    var myLatlng = new google.maps.LatLng(34.04, -118.24);
    var myOptions = {
      zoom: 13,
      center: myLatlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };

    var map = new google.maps.Map(document.getElementById('map'), myOptions);

  }

  google.maps.event.addDomListener(window, 'load', init);
</script>

In which it generates this map below in a div any. I circled some places where I do not want to appear on the map. In fact, I do not want you to show any place on the map, just the Pope with streets and highways:

Is it possible to remove all locations and bus stops / stops on Google Maps? If so, what would be the most feasible way to do this?

    
asked by anonymous 07.07.2017 / 19:04

1 answer

3

To hide your POI's points from your map, simply add the following style in the map options:

styles:[{
      "featureType": "poi",
      "stylers": [{
        "visibility": "off"
      }]
}]

To hide bus stops:

styles:[{
      "featureType": "transit.station.bus",
      "stylers": [{
        "visibility": "off"
      }]
}]

I also find it interesting to share a site that helps map customization: Mapstyle

Follow a JsFiddle with an example using the code shown in the question: JsFiddle

    
07.07.2017 / 19:25