I have the following problem:
I created two points, for example:
SRID=3857;POINT Z (62780.8532226825 5415035.177460473 100)
SRID=3857;POINT Z (62785.8532226825 5415035.177460473 70)
As you can see, there is 5m difference in X coordinates, and 30m in Z coordinates.
When I run a.distance(b)
in django shell, it returns 5, which is wrong.
However, whenIi run in a psql shell:
SELECT ST_3DDistance(a.coordinates, b.coordinates)
FROM restapi_entityxyz a, restapi_entityxyz b
WHERE a.external_id='6841zef1561' AND b.external_id='1G23Fzd';
It returns:
st_3ddistance
------------------
30.4138126514911
Which is the correct answer.
Is it a lack of functionality in geodjango
or a bug?
Should I use a custom library to perform such a calculation?
My environment is the following:
- Python 3.5,
- Django,
- postgresql 9.4 + postgis
- gdal and a lot of python libraries.