Skip to content

Commit

Permalink
using the outermost linering as the boundary if the polygon has hole
Browse files Browse the repository at this point in the history
  • Loading branch information
senmao committed Oct 18, 2019
1 parent f249163 commit c3f5d3c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion equi7grid/image2equi7grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,17 @@ def retrieve_raster_boundary(infile, gdal_path=None, nodata=None,
# get polygons from dataset
multipolygon = ogr.Geometry(ogr.wkbMultiPolygon)
for feature in dst_ds.GetLayerByIndex():
multipolygon.AddGeometry(feature.GetGeometryRef())
polygon = feature.GetGeometryRef()

# When the polygon has hole inside, only the out line ring will
# be used as extent polygon
if polygon.GetGeometryCount() > 1:
ring = polygon.GetGeometryRef(0)
poly = ogr.Geometry(ogr.wkbPolygon)
poly.AddGeometry(ring)
polygon = poly

multipolygon.AddGeometry(polygon)
multipolygon.AssignSpatialReference(dst_ds.GetLayer(0).GetSpatialRef())

geom = multipolygon
Expand Down

0 comments on commit c3f5d3c

Please sign in to comment.