The user can be located by using following ways:-
- Using the IP addr.
easiest to achieve but most unreliable due to the uncertainty of network addresses /
topologies.
- Using the latitude, longitude pair
most accurate solution, but most of the end users don’t know about their latitude,
longitude value.
- Using the zipcodes
nice to think but quite difficult to achieve, although ZipCodes are being used for
quite a long time but this is not a standard yet. (see link
http://en.wikipedia.org/wiki/Postal_code ). ZipCode alone is not sufficient for
calculation of distance we need to convert it to latitude, longitude pair which is an
overhead.
- Using user’s address
most compelling thought since each user will have at least one geographic address.
Address alone is not sufficient for calculation of distance we need to convert it to
latitude, longitude pair which is an overhead.
The Best option will be to use options 2,3.4 together, You can do that in two steps:-
- First determine the latitude, longitude from the address.
- Then use this lat, long value for further processing i.e. storing in
database etc.
For various options available for this see the answer of this question