views:

30

answers:

1

I'm building a site where my users will be able to specify locations (say, their residence, etc.). Then, I want to do 2 things to this information:

  1. Plot these location on a mapping service (such as Google Map)
  2. Allow users to search by location (e.g. find all users that live in or are in a certain radius from XYZ city)

The question I have is this: what is the best way for me to implement such features?

My concern is that my database of location information may or may not be in sync with the mapping service I use.

For example, say I have a list of cities and a user picks XYZ city from my list. Later, it turns out that city is not recognized by the mapping service. No way to plot the location on the map (but I could still provide the search by location feature).

If I try to use the database of the mapping service (if I can get a hold of something like that), I may end up being "locked in" to using that mapping service. Plus, these databases tend to be HUGE (and probably too much information for a simple application like mine).

Any recommendations on how to go about solving this problem? Thanks.

A: 

You should not rely only on the Cities but take the coordinates into account (watch out for different mappings of the world - this will change the coordinates). If you use the coordinates, you are independet from the service because x,y will always be x,y no matter the application or geo-provider. WIth the help of reverser geo-location services, you should be able to have something like that pretty easy.

This is very biased opinion: if(!!) you stick to, say Google, you can be quite sure that they won't quit the service in the next 1-2 years (maybe if there is a new uber-technology) but I doubt that very much. So I think it is ok to stick to a single service if you trust it and are sure that it will live for more than a few years.

DrColossos
So, I have a database of locations that is independent of the geo-provider. I user this users to guide them with their address selection (e.g. drop down of cities), then to a reverse geo-location service so that I can also store the lat/long information? Then it's that lat/long information that I provide to the geo-provider???
StackOverflowNewbie
Yes, I would see that as a possibility altough you could store the lat/long AND the adress together so you don't need a reverse lookup all the time
DrColossos
Definitely store BOTH. When a user wants to search for other users nearby, your system will need to have some way to know which other users to submit to the map service. Most likely the best way would be to get all users with the same city and state, then submit *only those* user's addresses (or lat/long) to the map service en masse (if the service allows that).
pheadbaq