Google Maps v3 hide elements (roads, roadsigns, etc)

you are trying to use the new Styled Map features of thev3 Maps API. Here’s a very basic example of how you could use the above style in a simple map

<!DOCTYPE html><html><head><metahttp-equiv="content-type"content="text/html; charset=UTF-8"/><title>Google Maps Dark Water Style Demo</title><scriptsrc="http://maps.google.com/maps/api/js?sensor=false"type="text/javascript"></script></head><body><divid="map"style="width:550px;height:300px;"></div><scripttype="text/javascript">var myStyle =[{
         featureType:"administrative",
         elementType:"labels",
         stylers:[{ visibility:"off"}]},{
         featureType:"poi",
         elementType:"labels",
         stylers:[{ visibility:"off"}]},{
         featureType:"water",
         elementType:"labels",
         stylers:[{ visibility:"off"}]},{
         featureType:"road",
         elementType:"labels",
         stylers:[{ visibility:"off"}]}];var map =new google.maps.Map(document.getElementById('map'),{
       mapTypeControlOptions:{
         mapTypeIds:['mystyle', google.maps.MapTypeId.ROADMAP, google.maps.MapTypeId.TERRAIN]},
       center:new google.maps.LatLng(30,0),
       zoom:3,
       mapTypeId:'mystyle'});

     map.mapTypes.set('mystyle',new google.maps.StyledMapType(myStyle,{ name:'My Style'}));</script></body></html>

hides labels with country names.

To hide an area you have to create your own overlay – some polygon or overlay map type.

When you want to show only an area of the map, it might be also a good idea to limit viewable area of the map.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.