pyguymer3.geo.extract_polys¶
- pyguymer3.geo.extract_polys(shape, /, *, onlyValid=False, repair=False)[source]¶
Extract the Polygons from the shape
This function accepts any Shapely geometry and returns a flat list of all of the Polygons contained within.
- Parameters:
shape (list, shapely.geometry.point.Point, shapely.geometry.multipoint.MultiPoint, shapely.geometry.polygon.LinearRing, shapely.geometry.linestring.LineString, shapely.geometry.multilinestring.MultiLineString, shapely.geometry.polygon.Polygon, shapely.geometry.multipolygon.MultiPolygon, shapely.geometry.collection.GeometryCollection) – the Shapely geometry
onlyValid (bool, optional) – only return valid Polygons (checks for validity can take a while, if being called often)
repair (bool, optional) – attempt to repair invalid Polygons
- Returns:
polys – a flat list of all of the Polygons
- Return type:
list of shapely.geometry.polygon.Polygon
Note
To pass GeoJSON objects you must first convert them to Shapely objects by doing something like
shape = shapely.geometry.shape(shape).Copyright 2017 Thomas Guymer [1]
References