3

Possible Duplicate:
Best way to get geo-location in Java

Is it possible to get the longitude and latitude value from IP address in java? If it is possible, please let me know.actually I am building an application in android which would track users based on their ip address. for doing this if I'm having latitude and longitude values then I can easily get location of user using google map in android but major task is to obtain latitude and longitude from ip address. I'm working on this if anyone have any idea please let me know thanks in advance.

Community
  • 1
  • 1
Minav Patel
  • 31
  • 1
  • 3
  • 1
    I believe this question has been asked before. Please try the search function and see if an answer has been found. – SnareChops Dec 27 '12 at 06:02
  • 1
    @Minav Patel: check these links: http://stackoverflow.com/questions/1415851/best-way-to-get-geo-location-in-java, http://stackoverflow.com/questions/2257170/how-to-get-city-name-based-on-ip-address-in-java, http://www.javaquery.com/2011/10/geolocation-javaquery-api.html – Cindrella Dec 27 '12 at 06:06

3 Answers3

1

There are several webservices, which provides you latitude and longitude value from ip address.. one such is api.ipinfodb.com for ex, you can latitude and longitude by sending request like,

http://api.ipinfodb.com/v3/ip-city/?key=<your_api_key>&ip=74.125.45.100&format=json

this returns the data in json format.(you need to register to get your API key).

or you can download database from,

http://dev.maxmind.com/geoip/geolite

http://dev.maxmind.com/geoip/downloadable

you can download datasets but u have to constantly update it.

cyn0
  • 522
  • 2
  • 7
  • 23
1

This API returns the location of an IP address (country, region, city, zipcode, latitude, longitude) and the associated timezone in XML format.

Though IP based location detection does have lots of drawbacks.

Get location of wifi ip in android

Community
  • 1
  • 1
Yauraw Gadav
  • 1,706
  • 1
  • 18
  • 39
0

I think you might get the location using Ip address, but that would not be the actual location it would only give you the area of network service provider.

cyn0
  • 522
  • 2
  • 7
  • 23
Bhavdip Sagar
  • 1,951
  • 15
  • 27