StyledMapType based on TERRAIN

245 views
Skip to first unread message

pi5701

unread,
Aug 24, 2011, 6:44:49 AM8/24/11
to google-map...@googlegroups.com
Is it possible to create a styled maptype based on terrain map?
Examples only show styling of default streetmap or all maptypes together.


can anyone gimme a quick demo of how to style terrain map and use it as own maptype?

Chris Broadfoot

unread,
Aug 25, 2011, 2:41:20 AM8/25/11
to google-map...@googlegroups.com
Hi,

This is possible using the "styles" option on the MapOptions object.

For example, to disable labels on the Terrain map:

new google.maps.Map(mapDiv, {
  center: new google.maps.LatLng(...),
  zoom: ...,
  mapTypeId: google.maps.MapTypeId.TERRAIN,
  styles: [
    {
      elementType: "labels",
      stylers: [
        { visibility: "off" }
      ]
    }
  ]
});

--


--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-maps-js-api-v3/-/AXilvcdjpT8J.
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.

pi5701

unread,
Aug 25, 2011, 7:16:59 AM8/25/11
to google-map...@googlegroups.com
thx for reply,
but this way i only get a map with styled terrain map only.
what i wanna do is using styled terrain map without labels to show my data beside 'unstyled' street, hybrid and terrainmap



Pil

unread,
Aug 25, 2011, 10:37:34 AM8/25/11
to Google Maps JavaScript API v3
This is a possibility to turn the labels on and off for every map
type. Additionally you can also switch the country borders and the
roads off.

I just tried this out and it worked (nearly) perfectly.

There is only a minor complaint to notice:

It seems that the labels cannot immediately and completely turned off.
When zooming in or out with labels turned off the labels are displayed
for a short (but noticeable) moment before they vanish.

Thor Mitchell (Google Employee)

unread,
Aug 25, 2011, 6:44:50 PM8/25/11
to google-map...@googlegroups.com
That sounds like a bug. Please be sure to log it on the Issue Tracker.

Many thanks,

Thor.

Pil

unread,
Aug 26, 2011, 1:44:55 AM8/26/11
to Google Maps JavaScript API v3
Done:
http://code.google.com/p/gmaps-api-issues/issues/detail?id=3581




On Aug 26, 12:44 am, "Thor Mitchell (Google Employee)"
Reply all
Reply to author
Forward
0 new messages