Geographic Information Systems Asked by Alvin Sartor on May 1, 2021
We use Postgis for Django to locate the objects inside a certain viewport. It works great at the equator, but the farther we move, the more distorted the viewport becomes.
Here is the result (the red line shows the "ignored area"):
Same on the southern hemisphere:
We retrieve the viewport from Maps, build a Polygon and intersect it with the coordinates of the objects:
viewport = Polygon.from_bbox((southeast_lng, southeast_lat, northwest_lng, northwest_lat,))
result = queryset.filter(coordinates__intersects=viewport)
The coordinates field in the object are defined as following:
coordinates = models.PointField(_('Coordinates'), srid=4326, null=True, geography=True)
Additional info:
geography=False
fixes it! But then we have problems at the 180th meridian.Does anyone know what might be causing this?
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP