Determine if a string is a valid geographic location

南笙酒味 提交于 2019-12-05 19:04:43

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.

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"

I think I've found a solution - just sharing it here in case anyone else needs it:

Use Google Maps API geocoding - feed it addresses and get co-ordinates back. Details for doing it via PHP: http://www.phpriot.com/articles/google-maps-geocoding/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!