I have a Java application and I would like to find out the location of a visitor. The API would give me a the zip code of visitor and then based on that zip code, I will find fire a query and get users in my application within 25/50 mile radius.
Alternatively visitor can type in the zip code of their interest and application should return users withing x mile of radius.
For the users who are registered in the system, we have only their zip code.
I have looked around some options but not found the exact solution. I do not want to download the database of zip code and maintain them.
I do not think Google API support this kind of stuff.
I have a Java application and I would like to find out the location
Share
I could not find any service which offers API . After much research i found that you will have to download zip codes along with their latitude and longitude positions into a table. Then
calculate co ordinates within the radius you want to search.
This is the website which helped me a lot.
http://www.dougv.com/2009/03/27/getting-all-zip-codes-in-a-given-radius-from-a-known-point-zip-code-via-php-and-mysql/
Here is the calculation in java if you really if you do not want to work with php
//this you will get by querying the database against the zip code
Double latitude = Double.parseDouble(zipCode.getLatitude());
Double longitude = Double.parseDouble(zipCode.getLongitude());