pyguymer3.geo.extract_lines¶
- pyguymer3.geo.extract_lines(shape, /, *, onlyValid=False)[source]¶
Extract the LineStrings from the shape
This function accepts any Shapely geometry and returns a flat list of all of the LineStrings 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 LineStrings (checks for validity can take a while, if being called often)
- Returns:
lines – a flat list of all of the LineStrings
- Return type:
list of shapely.geometry.linestring.LineString
Notes
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