How can calculate the real distance between two points with GeoDjango?
<pre><code>from django.contrib.gis.geos import Point

p1 = Point(36.74851779201058, -6.429006806692149, srid=4326)
p2 = Point(37.03254161520977, -8.98366068931684, srid=4326)
p1.distance(p2)
Out: 2.5703941316759376
</code></pre>

<p>But what is the unit of this float number?</p>

<p>If you calculate this distance, this is <a href="http://boulter.com/gps/distance/?from=36.74851779201058%2C-6.429006806692149&amp;to=37.03254161520977%2C%20-8.98366068931684&amp;units=k" rel="nofollow">229.88 Km</a>. You can get it too using geopy:</p>

<pre><code>from geopy.distance import distance
distance(p1, p2)
Out: Distance(229.883275249)
distance(p1, p2).km
Out: 229.88327524944066
</code></pre>

<p>I have read that you can get (so so) this, if you divide the previous number for 111:</p>

<pre><code>(2.5703941316759376 / 111) * 10000
Out: 231.5670388897241  # kilometers
</code></pre>

<p>Is there any way to get the real distance using only GeoDjango? Or should I use geopy?</p>

<p>GeoDjango returns the Cartesian distance between points as a float value in degrees. To get the value of Distance in km or miles you can do the following:  </p>

<pre><code>

    dist = p1.distance(p2)
    dist.km # or dist.mi for miles

</code></pre>

<p>source: <a href="https://docs.djangoproject.com/en/1.10/ref/contrib/gis/functions/#distance" rel="nofollow">https://docs.djangoproject.com/en/1.10/ref/contrib/gis/functions/#distance</a></p>

python django gis geodjango