Convert address to latitude and longitude in java for distance based suggestion

StackOverflow https://stackoverflow.com/questions/22573728

  •  19-06-2023
  •  | 
  •  

Pregunta

My requirement is in a web application user enters address and I should show the suggestions to him based on the 10 miles radius of users address. Technologies I am using Struts 2.0, Java & mysql

For that I thought of achieving in the below way:

  1. Convert Latitude and longitude and store in DB while user registration process

  2. Use mysql queries for finding the nearest locations based on the latitude and longitude values stored

I could able to find the queries required from mysql side all I need now is how to convert an address into latitude and longitude.

Is there any opensource api for doing that. I Tried google maps web service and js api but using geocode data other than showing maps is restricted as per the licence terms.

To achieve what I require is it can be done in any other way, if there please help me on that. If not could you please point me to any opensource web service or js api or java api for converting address to latitude and longitude.

Thank you.

¿Fue útil?

Solución

Have a look at Mapquest's geocoding API.

Do check out their Terms of Use, though. Here are a few of the requirements:

  • OpenStreetMap must be given credit for the data.
  • Please place “Geocoding Courtesy of MapQuest ” on your page, or in the copyright area of the map and please link the word “MapQuest” to http://www.mapquest.com.
  • If your application will get heavy usage, please let us know by sending us an email at open@mapquest.com. Please include the estimate of your expected usage so that we will be aware and accommodate the extra traffic.
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top