php - Determine if a string is a valid geographic location -


I have found a bunch of "places" - some are accurate (Gaborone, Botswana), some geocodes (40.75, -73.9 9 7) and some completely useless (#siliconcape) I have to run through the list and find a way to determine the city and country of each string and geocode, and will have to return the spaces to the invalid places.

Is there any type of library / service / API / method can be used to determine whether a given string represents valid geographical location or not? Accounting for errors, ordering errors, etc.

Perhaps the easiest way would be to use something like that. It takes a string and tries to parse it at some place. You can get output as XML, JSON, CSV.

Here are some examples of 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 W30th St. New York, NY 10001, USA"  

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -