hide transit stations

615 views
Skip to first unread message

pinkcow

unread,
Oct 8, 2010, 9:55:28 AM10/8/10
to Google Maps JavaScript API v3
i would like to hide all transit stations and thought it should work
something like this:

var myOptions = {
zoom: 15,
center: swiss,
mapTypeId: google.maps.MapTypeId.ROADMAP,
//StyledMapType StyledMapTypeOptions MapTypeStyle
MapTypeStyleFeatureType
mapType: { style: { featureType: ['transit.station',
'visibility: hidden']} }
};
map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);

i've probably got the syntax wrong, can some please help?

Rossko

unread,
Oct 8, 2010, 8:07:37 PM10/8/10
to Google Maps JavaScript API v3
> i would like to hide all transit stations and thought it should work
> something like this:

Have a play with this
http://gmaps-samples-v3.googlecode.com/svn/trunk/styledmaps/wizard/index.html

Chris Broadfoot

unread,
Oct 9, 2010, 10:37:18 AM10/9/10
to google-map...@googlegroups.com
Have a look at the sample code here:

Your code would look something like:

----------

var noTransitStationsStyle = [
  {
    featureType: 'transit.station',
    elementType: 'all',
    stylers: [
      { visibility: 'off' }
    ]
  }
];

var mapOptions = {
  zoom: 15,
  center: swiss
};

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

var mapType = new google.maps.StyledMapType(noTransitStationsStyle, { name: 'No Stations' });

map.mapTypes.set('nostations', mapType);
map.setMapTypeId('nostations');


--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.
To post to this group, send email to google-map...@googlegroups.com.
To unsubscribe from this group, send email to google-maps-js-a...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.


Thomas Wingate

unread,
Aug 18, 2011, 4:44:35 PM8/18/11
to google-map...@googlegroups.com
Is it possible to define the styles directly in the mapOptions variable? The documentation mentions styling the default map "either at time of construction or by calling setOptions" but is a bit vague on how to do this at time of construction.

Sorry if the answer is completely obvious, I'm a bit of a noob on the API and JS.
Reply all
Reply to author
Forward
0 new messages