KhAn SaAb
KhAn SaAb

Reputation: 5366

how to get location using Latitude and Longitude in java?

I am getting longitude and latitude from JSP using HTml5 in Servlet, i want exract exact location(City name,Country name) using these two parameters.Any suggestion to Resolve this ISSUE.

Upvotes: 1

Views: 2869

Answers (2)

cafebabe1991
cafebabe1991

Reputation: 5176

Use Google geocoding service to get the location by passing a pair of latitude and longitude...it returns the response as accurate as possible in the form of JSON or XML whichever you prefer..

Here is a link the sensor parameter is a must so make sure for a browser you say false for a device having it pass true..

so just use the HttpURLConnection class and read the response from this url and you will get the response. Parse the response for formatted_address object.

This contains the address you need.

its awesome..

Upvotes: 1

kabochkov
kabochkov

Reputation: 1096

You can also try this service http://wiki.openstreetmap.org/wiki/Nominatim

Upvotes: 0

Related Questions