且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

确定字符串是否是有效的地理位置

更新时间:2023-11-25 15:41:34

可能最简单的方法是使用类似 Google 地理编码 API.它将接受一个字符串并尝试将其解析到一个位置.您可以获得 XML、JSON、CSV 格式的输出.

Probably the easiest method would be to use something like the Google Geocoding API. It'll take a string and attempt to parse it to a location. You can get output as XML, JSON, CSV.

以下是一些 CSV 输出示例:

Here's some example CSV output:

input : gaborone, botswana
output: 200,4,-24.6541100,25.9087390

input : #siliconcape
output: 602,0,0,0

input : 40.75,-73.997
output: 200,8,"324 W 30th St, New York, NY 10001, USA"