simpler clean_geometry
This commit is contained in:
parent
5c474e73b5
commit
14b2119f02
1 changed files with 1 additions and 6 deletions
|
@ -9,12 +9,7 @@ def clean_geometry(geometry):
|
||||||
return geometry
|
return geometry
|
||||||
|
|
||||||
if isinstance(geometry, Polygon):
|
if isinstance(geometry, Polygon):
|
||||||
p = Polygon(list(geometry.exterior.coords))
|
return geometry.buffer(0)
|
||||||
for interior in geometry.interiors:
|
|
||||||
p = p.difference(Polygon(list(interior.coords)))
|
|
||||||
|
|
||||||
if isinstance(p, Polygon) and p.is_valid:
|
|
||||||
return p
|
|
||||||
|
|
||||||
return geometry
|
return geometry
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue