谷歌地图v3 - 突出显示州或州的地区 [英] google maps v3 - highlight states or regions of states

查看:254
本文介绍了谷歌地图v3 - 突出显示州或州的地区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有可能使用谷歌地图v3突出显示一个国家或地区的状态?



我看到多边形的例子,但没有一个很好。无论是边界会重叠还是不能正确绘制(当放大到最大值时都可以看到)。



从我看到的各种示例中,我想我会需要所有的组成该州/地区的协调,然后只有我可以适当地强调它。有没有更好的解决方案?



另外,我怎样才能找到整个州/地区的坐标?



感谢您的帮助。



此致

解决方案

Google地图API不提供访问地区/州/国家/城市数据的方法。要突出显示一个区域,您必须根据其他来源的数据创建自定义叠加层(面,覆盖地图类型...)。

正如你写的不准确的多边形经常被使用。这些多边形通常是手工制作的近似值,因为这是最简单的方法。找到并处理区域边界数据以获取所需的多边形相当困难。

在使用精确区域多边形时可能存在其他缺点。这样的多边形通常必须包含数千个点(有些例外情况如美加边境或一些非洲国家之间的边界)。有很多点的多边形可能很难在JavaScript maps API中处理。因此,自定义覆盖地图类型可能更合适案件。不幸的是,创建叠加地图类型比创建简单的 google.maps.Polygon 要求更多的工作。 许多地图数据(地区坐标和许多其他数据)可以在 OpenStreetMap 上找到。您可以通过其 API 导出数据。


Is it possible to highlight a state of a country or region of a state using google maps v3?

I saw examples with polygon but none of them were very good. Either the boundaries would overlap or is not properly drawn (can be seen when zoomed to maximum level).

From what i saw in various examples, I think I will need all the co-ordinates that makes up that state/region then only i can highlight it properly. Is there any better solution?

Also, how can I find co-ordinates of an entire state/region ?

Thanks a lot for help.

Regards

解决方案

Google maps API doesn't offer a way to access region/state/country/city data. To highlight a region you have to create your custom overlay (polygon, overlay map type, ...) based on data from other sources.

As you wrote inexact polygons are often used. These polygons are usually hand made approximations, because that's the easiest way to do it. It's rather difficult to find and process region boundary data to get the polygons you need.

There might be other drawbacks in using exact region polygons. Such polygon usually have to contain thousands of points (there are the exceptional cases like US-Canada border or borders between some African countries). Polygons with lots of points might be difficult to process in JavaScript maps API. Therefore custom overlay map type might be more suitable in this case. Unfortunately, it demands much more work to create overlay map type than to create simple google.maps.Polygon.

Lots of map data (region coordinates and many other data) can be found on OpenStreetMap. You can export the data via their API.

这篇关于谷歌地图v3 - 突出显示州或州的地区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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