flopy.utils.geometry Module

Container objects for working with geometric information

flopy.utils.geometry.get_polygon_area(verts)

Calculate the area of a closed polygon

Parameters:

verts : numpy.ndarray

polygon vertices

Returns:

area : float

area of polygon centroid

flopy.utils.geometry.get_polygon_centroid(verts)

Calculate the centroid of a closed polygon

Parameters:

verts : numpy.ndarray

polygon vertices

Returns:

centroid : tuple

(x, y) of polygon centroid

flopy.utils.geometry.shape(pyshp_shpobj)

Convert a pyshp geometry object to a flopy geometry object.

Parameters:pyshp_shpobj : shapefile._Shape instance
Returns:shape : flopy.utils.geometry Polygon, Linestring, or Point

Notes

Currently only regular Polygons, LineStrings and Points (pyshp types 5, 3, 1) supported.

Examples

>>> import shapefile as sf
>>> from flopy.utils.geometry import shape
>>> sfobj = sf.Reader('shapefile.shp')
>>> flopy_geom = shape(list(sfobj.iterShapes())[0])