static maps list of features

若如初见. 提交于 2019-12-11 12:04:05

问题


I'm trying to customize Google static maps so that maps display entirely in greyscale. It's mostly working, however there are some map "features" that I can't seem to select and style. In particular, there are (what appear to be) highway ramp labels with a green background and white text that I'd like to make black and white, or hide altogether. Here's an example:

http://maps.googleapis.com/maps/api/staticmap?key=AIzaSyADV4Wfi9-4ET5GG52Cw_l0_Bkt8W5vwvM&center=43.597586,-79.746689&zoom=14&markers=icon:http://www.xmeasures.com/images/planMapPin.png|43.597586,-79.746689&format=png32&sensor=false&size=480x480&scale=4&markers=color:black|&maptype=roadmap&style=feature|element:geometry|hue:0xwhite|saturation:-100%|lightness:100|visibility:off&style=feature:road|element:geometry|hue:0xblack|saturation:-100%|lightness:-20|visibility:on&style=feature:road.path|element:labels|hue:0xblack|saturation:-100%|lightness:-20|visibility:off&style=feature:labels|element:geometry|hue:0xblack|saturation:-100%|lightness:-20|visibility:off&style=feature:water|element:geometry|hue:0xblack|saturation:-100%|lightness:-40|visibility:on&style=element:labels.text.stroke|visibility:off&style=element:labels.text.fill|visibility:off&style=feature:road|hue:0xblack|saturation:-100%|lightness:-100|element:labels.text.fill|visibility:on&style=feature:transit|visibility:off&style=feature:poi|visibility:off&style=feature:landscape|visibility:off&key=AIzaSyADV4Wfi9-4ET5GG52Cw_l0_Bkt8W5vwvM|

I've searched for a comprehensive list of static maps features, but I only seem to find general instructions. Does a full list of features exist anywhere?


回答1:


you can use the Google Maps API v3 Style Wizard, http://gmaps-samples-v3.googlecode.com/svn/trunk/styledmaps/wizard/index.html?utm_medium=twitter

And set the labels.icon of road's saturation to -100.

[
  {
    "featureType": "road",
    "elementType": "labels.icon",
    "stylers": [
      { "saturation": -100 }
    ]
  }
]

so... this should do it

http://maps.googleapis.com/maps/api/staticmap?key=AIzaSyADV4Wfi9-4ET5GG52Cw_l0_Bkt8W5vwvM&center=43.597586,-79.746689&zoom=14&markers=icon:http://www.xmeasures.com/images/planMapPin.png|43.597586,-79.746689&format=png32&sensor=false&size=480x480&scale=4&markers=color:black|&maptype=roadmap&style=feature|element:geometry|hue:0xwhite|saturation:-100%|lightness:100|visibility:off&style=feature:road|element:geometry|hue:0xblack|saturation:-100%|lightness:-20|visibility:on&style=feature:road.path|element:labels|hue:0xblack|saturation:-100%|lightness:-20|visibility:off&style=feature:labels|element:geometry|hue:0xblack|saturation:-100%|lightness:-20|visibility:off&style=feature:water|element:geometry|hue:0xblack|saturation:-100%|lightness:-40|visibility:on&style=element:labels.text.stroke|visibility:off&style=element:labels.text.fill|visibility:off&style=feature:road|hue:0xblack|saturation:-100%|lightness:-100|element:labels.text.fill|visibility:on&style=feature:transit|visibility:off&style=feature:poi|visibility:off&style=feature:landscape|visibility:off&key=AIzaSyADV4Wfi9-4ET5GG52Cw_l0_Bkt8W5vwvM|&style=feature:road|element:labels.icon|saturation:-100



来源:https://stackoverflow.com/questions/31434551/static-maps-list-of-features

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!