Monday 15 August 2011

Hide/remove transit stations from Google Map

I have been searching for the solution for a while on my recent real time transit project. The solution doesn't appear to be documented clearly. Here is my simplified working solution and hope it helps.


  

var latLng = new google.maps.LatLng(49.22587, -123.14044000000001); 
var mapOptions = {
zoom: 16,
minZoom: 10,
center: latLng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};

var node = document.getElementById("map_canvas");
var map = new google.maps.Map(node, mapOptions);
var ntss = [{
  featureType: 'transit.station',
  elementType: 'all',
  stylers: [{ visibility: 'off' }]
}];

var mapType = new google.maps.StyledMapType(ntss, { name: 'ntsss' }); 

map.mapTypes.set('nstps', mapType);

map.setMapTypeId('nstps'); 

  

No comments:

Post a Comment