Prologue:
This often raises the question in SO:
I wanted to make an example in SO Documentation, but the chapter was geodjangonever removed, and after the Documentation was turned off on August 8, 2017, I will follow up on this widely-spread and discussed meta-answer and write my example as an answer to my question.
Of course, I would be more than happy to see any other approach.
Question:
Suppose the model:
class MyModel(models.Model):
name = models.CharField()
coordinates = models.PointField()
Where I save a point in a variable coordinateas a point lan, lng, alt:
MyModel.objects.create(
name='point_name',
coordinates='SRID=3857;POINT Z (100.00 10.00 150)')
:
p1 = MyModel.objects.get(name='point_1').coordinates
p2 = MyModel.objects.get(name='point_2').coordinates
d = Distance(m=p1.distance(p2))
d=X .
:
:
p1.coordinates = 'SRID=3857;POINT Z (100.00 10.00 200)'
150 , :
d = Distance(m=p1.distance(p2))
d=X , , .
3D- ?