Answer the question
In order to leave comments, you need to log in
How to get distances between two IP addresses using Django GIS?
How to get the distance between two IP addresses using Django GIS ?
Answer the question
In order to leave comments, you need to log in
The answer to the question can consist of 2 parts. 1 - you need to get the coordinates of both IP addresses, 2 - determine the distance between 2 points.
from django.contrib.gis.geoip import GeoIP
g = GeoIP()
g.lon_lat('65.55.39.10')
from django.contrib.gis.geos import Point, GEOSGeometry
pnt = GEOSGeometry('SRID=4326;POINT(40.396764 -3.68042)')
pnt2 = GEOSGeometry('SRID=4326;POINT( 48.835797 2.329102 )')
pnt.distance(pnt2)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question