views:

33

answers:

0

I store a PointField field named "coordinates" in a model.

Then, I consult nearest instances from a given one, in the command interpreter, and print its name and the distance in km.

[(p.name, p.distance.m) for p in Model_Name.objects.filter(coordinates__distance_lte=(pnt, 1000000)).distance(pnt)]

The thing is, when the field "coordinates" is of kind geometry, it works well. But if I include the option "geography=True", to get better precision, it returns a much smaller value, even that I am indicating to print it in km as before.

How can I get correct geography calculations?

Thanks