Google Maps Api V3 - 造型国家或城市 [英] Google Maps Api V3 - Styling countries or cities

查看:101
本文介绍了Google Maps Api V3 - 造型国家或城市的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图制作一张地图,只为选定的地区,让我们说出国家,摆脱地图上的一些标签和东西。我找到了一个样式向导:
http:// gmaps-samples- v3.googlecode.com/svn/trunk/styledmaps/wizard/index.html
但是我的问题是,如果你能以某种方式隐藏较小的城市,或者比我选择的其他国家/地区?

I am trying to make a map, just for selected area, lets say country, and get rid of some of the labels and stuff that are on the map. I found a styles wizard: http://gmaps-samples-v3.googlecode.com/svn/trunk/styledmaps/wizard/index.html But my question is, if u can somehow hide smaller cities, or other countries than my selected one?

我知道我可以一次隐藏所有的城市,或者我可以隐藏边界,但我很好奇,如果我可以离开主要城市可见,例如灰色的其他国家比美国或除了美国,我将不得不手动创建最大的多边形? o.o

I know i can hide all cities at once, or that i can hide borders, but i am curious if i can leave main cities visible, and for example gray out other countries than USA or i would have to manually create biggest polygon ever everywhere except USA? o.o

推荐答案

遗憾的是,Google Maps API没有提供选择性隐藏某个区域中的标签的方法。您只能删除多个类别的整个地图的标签 - 例如使用 MapTypeStyle 包含:

Unfortunately, Google Maps API doesn't offer a way to selectively hide labels in an area. You can only remove labels for the whole map in several categories - e.g. using MapTypeStyle containing:

{
    featureType: "administrative.country",
    elementType: "labels",
    stylers: [
        { visibility: "off" }
    ]
}

隐藏标签带有国家名称。

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.

这篇关于Google Maps Api V3 - 造型国家或城市的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆