如何从谷歌地图中删除所有

111*_*110 8 javascript google-maps google-maps-api-3

我需要谷歌地图只有街道名称.我不想删除像标记的巴士站,医院等的
东西.我可以使用什么命令来删除这些东西?

Mik*_*rey 13

您可以按照此处所述设置基本地图的样式:

http://code.google.com/apis/maps/documentation/javascript/styling.html

例如,要隐藏除道路之外的所有内容:

var styleArray = [
  {
    featureType: "all",
    stylers: [
      { visibility: "off" }
    ]
  },
  {
    featureType: "road",
    stylers: [
      { visibility: "on" }
    ]
  }
];

map.setOptions({styles: styleArray});
Run Code Online (Sandbox Code Playgroud)

可以设置样式的完整功能列表如下:http://code.google.com/apis/maps/documentation/javascript/reference.html#MapTypeStyleFeatureType

例如,您可能想要重新开启parks.


小智 6

您可以使用Google Maps API v3中的Styled Maps删除您不想要的地图上的项目.

在Styled Maps Wizard上尝试一下

http://gmaps-samples-v3.googlecode.com/svn/trunk/styledmaps/wizard/index.html