一次查找多个地方的纬度和经度
I have a long list of towns and cities, and I'd like to add latitude and longitude information to each of them.
Does anyone know the easiest way to generate this information once?
See also Geocode multiple addresses
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
第三个视频的第一部分展示了如何使用 Google Refine 和地理编码获取纬度和经度。无需编写新脚本。 非常适合进行一次此类更改。
http://code.google.com/p/google-refine/
The first part of the third video shows how to get latitude and Longitude using Google Refine and geocoding. No need to write a new script. Ideal for doing this kind of change once.
http://code.google.com/p/google-refine/
或者使用 www.geonames.org - 有相应的语言 API。或者开放街道地图的提名:http://wiki.openstreetmap.org/wiki/Nominatim - google有稍微更严格的服务条款。
Or use www.geonames.org - there's language APIs for that. Or Open Street Map's Nominatim: http://wiki.openstreetmap.org/wiki/Nominatim - google have slightly more restrictive terms of service.
您可以使用 Google 地理编码 API。通过以下网址检查 API:http://code.google.com/apis/maps /documentation/geocoding/
接下来是编写一些代码。我正在用 C# 做类似的事情,这里很简单。
You can use the Google Geocoding API. Check the API at this URL: http://code.google.com/apis/maps/documentation/geocoding/
What follows next is writing some code. I am doing something similar in C# and it is quite easy here.
大多数地理编码服务只能处理您所需要的行政名称的查询,例如市镇和地区。所以我选择一个你喜欢的也可以处理批量或批量请求,例如,Bing Spatial Data API(这里有一篇关于用它进行批量地理编码。)
如果您的预算有限并且有很多工作要做,另一种方法可能会很有用,那就是下载 Geonames 数据库 并编写一些代码将其导入数据库或为其建立索引;然后查询它,但是以及您喜欢的频率,例如,如果您将地点放在另一个表中,您可以
SELECT [...] FROM my_places LEFT JOIN geonames [...]
。我曾经将 Geonames DB 导入到普通的 PostgreSQL 中,如果您想尝试的话,代码可能仍然存在于 git 存储库中(评论,我会找到它并附上。)Most geocoding services can handle queries with only administrative names which is what you're after, e.g., municipality and region. So I'd choose one you like that also handles batch or bulk requests, e.g., the Bing Spatial Data API (here's an article on batch geocoding with it.)
An alternative approach that might be useful if you're on a budget and have a lot of these to do would be to download the Geonames database and write a bit of code to import it into your database or index it; then query it however and how often you like, e.g., if you put your places in another table you could
SELECT [...] FROM my_places LEFT JOIN geonames [...]
. I used to import Geonames DB into a vanilla PostgreSQL nightly and probably still have the code in a git repo somewhere if that's a route you want to try (comment and I'll find it and attach.)对于使用谷歌的服务,我认为这是最准确的。
查看 http://www.torchproducts.com/tools/geocode
For a service that uses google, which I find most accurate.
Look at http://www.torchproducts.com/tools/geocode