swn.SurfaceWaterNetwork.from_lines#
- classmethod SurfaceWaterNetwork.from_lines(lines, polygons=None)#
Create and evaluate a new SurfaceWaterNetwork from lines for segments.
- Parameters:
- linesgeopandas.GeoSeries
Input lines of surface water network. Geometries must be
LINESTRING
orLINESTRING Z
. Index is used for segment numbers. The geometry is copied to the segments property.- polygonsgeopandas.GeoSeries, optional
Optional input polygons of surface water catchments. Geometries must be
POLYGON
. Index must be the same assegments.index
.
Examples
>>> import geopandas >>> import swn >>> lines = geopandas.GeoSeries.from_wkt([ ... "LINESTRING (60 100, 60 80)", ... "LINESTRING (40 130, 60 100)", ... "LINESTRING (70 130, 60 100)"]) >>> lines.index += 100 >>> n = swn.SurfaceWaterNetwork.from_lines(lines) >>> n <SurfaceWaterNetwork: 3 segments: [100, 101, 102] 2 headwater: [101, 102] 1 outlets: [100] no diversions />