Javascript 如何在 Google 地图上突出显示区域
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6431855/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to highlight a region on Google Maps
提问by Sam
How can I highlight/cover a region or multiple regions with different colors (for example 3 US states), using google maps polygon arrays? I found a tuto on google code about how to draw a polygon but it's not giving detailed information.
如何使用谷歌地图多边形数组突出显示/覆盖一个区域或多个具有不同颜色的区域(例如美国 3 个州)?我在谷歌代码上找到了关于如何绘制多边形的教程,但没有提供详细信息。
Thank you for your help.
感谢您的帮助。
回答by Caimen
This documentation on Google is about as straight forward as you can get.
Google 上的这份文档非常简单明了。
http://code.google.com/apis/maps/documentation/javascript/overlays.html
http://code.google.com/apis/maps/documentation/javascript/overlays.html
View the source of this page. Copy and paste the code into your own page and start from there.
查看此页面的来源。将代码复制并粘贴到您自己的页面中,然后从那里开始。
http://code.google.com/apis/maps/documentation/javascript/examples/polygon-simple.html
http://code.google.com/apis/maps/documentation/javascript/examples/polygon-simple.html
In the example above you simply need to make more than one instance of bermudaTriangle and name it something else and add it to the map.
在上面的示例中,您只需创建多个 bermudaTriangle 实例并将其命名为其他名称并将其添加到地图中。