Remove Google Maps bus stops/locations

Asked

Viewed 14,089 times

5

I have this following 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 generates this map below in a div any. I circled in red some places where I don’t want it to appear on the map. In fact, I wouldn’t want you to show any place on the map, just the pope with streets and highways:

inserir a descrição da imagem aqui

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

1 answer

4


To hide the points of interest (POI’s) of your map, just 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 find it interesting to share too, a site that helps in the customization of the map: Mapstyle

Follow a Jsfiddle with an example using the code presented in the question: Jsfiddle

  • Bus stops/stops not removed =/

  • @acklay updated the fiddle in response, now hidden bus stops too, note that subway stations remain visible.

  • @acklay I don’t really know if it’s a "good" way, but here reply, everything is hidden, later only the highways are displayed.

  • Put what’s in Jsfiddle in your answer.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.