Google 地图检测到某个国家/地区特定区域内的点击
我昨天发布了一个问题,询问是否有人知道如何让谷歌地图通过反向地理编码返回英格兰、苏格兰和威尔士的国家/地区名称,因为目前它将它们全部视为“英国”。 没有人回复,所以我认为这不可能/容易? Googlemaps 反向地理编码获取国家/地区名称、英国国家/地区
所以我是寻找不同的方法..
我尝试为每个国家创建一个多边形,但是坐标的数量很大,所以它确实减慢了谷歌地图的速度。
我开始考虑从形状文件创建地图图块以及如何使用它们,但我仍然看不到我能够检测到点击。
必须有某种方法可以做到这一点?任何人有任何建议请!我越来越绝望了!
贝克斯
I posted a question yesterday asking if anyone knew how to make google maps return the country name with reverse geocoding for England, Scotland and Wales as currently it sees them all as "UK".
No one replied so I don't think it's possible/easy?
Googlemaps Reverse GeoCoding Get Country Name, UK Countries
So I am looking for different approaches..
I have tried creating a polygon for each of the countries, but the number of coords is huge so it really slows down google maps.
I am starting to look at creating map tiles from shape files and some how using them but I still can't see me being able to detect a click..
There has got to be some way of doing this? Anyone got any advice PLEASE! I am getting desperate!
Bex
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我采取了完全不同的方法并使用邮政编码。
我已将邮政编码的第一部分存储在数据库中。
当我获得点击地点的详细信息时,我知道这个国家/地区,因此如果是英国,我会检查邮政编码。
如果邮政编码与数据库中的任何邮政编码匹配,我就知道该国家/地区。
请记住,SY 邮政编码跨越威尔士和英格兰,因此您需要所有邮政编码,以便可以将它们分开。
很啰嗦,但是有效!
I took a completely different approach and used postcodes.
I have stored the first parts of the post codes in the DB .
When I get the details of the place clicked I know the country, so if it's United kingdom I check the postcode.
If the post code matches any in the DB I know the country.
Got to bear in mind the SY postcode spans both Wales and England, so you need all the postcodes so you can split them.
Very long winded, but works!
查看 http://home.provide.net/~bratliff/polycluster 的来源/v3/absurd.html 查看如何处理多边形中“荒谬”数量的折线。
编辑:链接已损坏。 Archive.org缓存有页面和一些JS文件,但它似乎不起作用。你也许可以看到 JS 在那里做什么。
View the source of http://home.provide.net/~bratliff/polycluster/v3/absurd.html to see how to handle an "absurd" amount of polylines in a polygon.
Edit: that links's broken. The Archive.org cache has the page and some JS files but it doesn't seem to be working. You might be able to see what the JS is doing there.