views:

25

answers:

0

Consider an app that stores geocode data for photos. I want to be able to return albums of photos from within a city, within a state or within a country.

Currently the database uses location strings for matching (location_name = "London, UK"). This is a very simple calculation compared to actively querying through map geometry, but has accuracy issues. Also, alternate names or localizations cause records to not match ("London, UK" won't match "London, United Kingdom").

Radius searching is an option with Great Circle distances, but for geographic areas that are weird shapes (Tennessee or Texas for example), that also presents accuracy issues.

So, what's the best way to match locations in a database?