最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Google Maps Api V3 - Styling countries or cities - Stack Overflow

programmeradmin1浏览0评论

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: .html But my question is, if u can somehow hide smaller cities, or other countries than my selected one?

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

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?

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

Share Improve this question asked Oct 10, 2011 at 14:11 KedorKedor 1,4985 gold badges31 silver badges55 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 15

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.

发布评论

评论列表(0)

  1. 暂无评论