I'm familiar with Django, but new to GeoDjango and PostGIS.
I have a problem where I want to find the nearest MuliPolygon to a point. The point can be outside or within the MultiPolygon. Nearest means the nearest boundary point.
I know that I can calculate the distance between two points with from django.contrib.gis.db.models.functions import Distance
- but I don't want to use the centroid
because it is possible the border of a MultiPolygon is closer to one point than the centroid
of another.
I have a model Land
with a field surface_area
which is a MultiPolygon
. I have a point object created with from django.contrib.gis.geos import Point
. This is the data I'm using to try and build a query.
Any help with best practices would be appreciated.