Thursday, July 29, 2010

Re: Calculate distance between 2 latitude/longitude Point

> *
> In [45]: Point(40.96312364002175,
> -5.661885738372803).distance(Point(40.96116097790996, -5.66283792257309))
> Out[45]: 0.0021814438604553388

The results are what you get from the db. The thing is, you can't
assume that the distance in degrees is the same everywhere, so you
can't use a simple formula like multiplying by the circumference at
equator. Instead let the db do the work for you by telling what
coordinate system your input is and what do you want as output. Good
examples can be found in PostGIS (Postgresql with GIS) documentation:

http://postgis.refractions.net/documentation/manual-1.5/ST_Distance.html

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment