简体   繁体   中英

Google Map API V3: How to disable vegetation?

While everyone is trying to add better vegetation image to google map, I need a clean geography without any vegetation and terrain information on it, which was done by API V2

Currently I have javascript:

var styles = [
  {
    featureType: "all",
    stylers: [
      { saturation: -80 }
    ]
  },{
    featureType: "road.arterial",
    elementType: "geometry",
    stylers: [
      { hue: "#00ffee" },
      { saturation: 50 }
    ]
  },{
    featureType: "poi.business",
    elementType: "labels",
    stylers: [
      { visibility: "off" }
    ]
  }
];
var mapOptions = {
    center: new google.maps.LatLng(37.774546, -122.4335235),
    zoom: 3,
    styles: styles
};

This can return me a gray color image, but it still has vegetation and terrain on it. I failed to find a style type or anything else related to my problem. Can anyone help me out?

Code

JSON (put it in your styles array):

{
    "featureType": "landscape.natural.terrain",
    "stylers": [
        { "visibility": "off" }
    ]
},{
    "featureType": "landscape.natural.landcover",
    "stylers": [
        { "visibility": "off" }
    ]
},{
    "featureType": "poi.park",
    "stylers": [
        { "visibility": "off" }
    ]
},{
    "featureType": "water",
    "stylers": [
        { "visibility": "off" }
    ]
}

What it does

Completely removes:

  • Natural terrain
  • Natural landcover
  • Parks (eg reserved forest lands)
  • Water

Preview

Before (default style): Google Maps默认样式

After (custom style): Google Maps自定义样式

Since 2012, the default google map tiles have included terrain and vegetation:

Google Maps now clearly shows terrain, color gradations to depict vegetation, and labels for natural land formations

source: http://google-latlong.blogspot.com/2012/10/get-better-view-of-natural-geography.html

As far as I know there there is no more basic map view than this. You can try OpenStreetMap tiles instead. OSM tiles provided by CloudMade , for example, have fairly basic styling.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM