Search code examples
geolocationgeocodinggeospatialcomputational-geometrygeo

Geo-Coding to Region and Provider


I'm working on a product which heavily relies on Geo-Data to map locations of 'places' matching a certain criteria.

Right now when a user add's a 'place' to our inventory, using google's geo-data service I autocomplete what the user enters and grab the lat/lon/name and store it in our database.

So lets say I have got 100 places across France and Switzerland which have been logged and added to the database. The next step would be for a user to then enter a 'search' destination (again using autocomplete) and then using the Haversine formula find all within an X proximity.

So using the example above, the user could enter Geneva (which is on the border of France and Switzerland) and we search say X KM's from that and we would pull up all locations within that radius and that could be in Switzerland OR France...

however I would also like to be able to say show me all products within a 'country' so taking above example show me all 'places' in Switzerland? Now in my mind this would not be able to use the Haversine forumula, in fact how could it even use lat/lon? so does that mean that when doing the Geo lookups I should store the 'Country' data as part of the lookup? or is there a more elegant solution?

Anyone who has done this and faced this issue, would greatly appreciate how you solved this?

Also if any can recommend some geo-coding services? Google's free edition only allows 2.5K lookups a day which will get used very quickly!

Much appreciated any help


Solution

  • It really depends on what technology you are using (particularly your database).

    I think the answer to this question is covered here: Given the lat/long coordinates, how can we find out the city/country?. The answer includes both a database approach and a service approach.