I'm using postgis and geodjango and have a lot of region geometry as multipolygon fields and it seems many of these have holes in them, is there any method I can use to close these holes and retain the outer boundary?
Thanks
the documentation states
Whereas indexing on a Polygon will return the ring (a LinearRing object) corresponding to the index:
so in principle if P
is your polygon, you can extract just the exterior ring (index 0), thus ignoring all the inner rings (defining the "holes"), and use it to construct a new polygon:
from django.contrib.gis.geos import Polygon
P_ext = Polygon(P[0])
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.