This package is used to check point inside/outside of polygon/multipolygon. It is supported polygon to array, convert multipolygon dataframe to polygon, find the min and max item in 2D array.
pip install PointInPolygon
or
pip install --upgrade PointInPolygon
- Import package
import PointInPolygon as pnp
- Geometry Polygon to Array (skip steps to simplify the data and reduce the size of array, if it is multipolygon, it needs to convert to polygon first)
pnp.Geo2Array(geo, skip=0)
- Convert df multipolygon to polygon (the column name should be geometry)
pnp.MultiPolygon2Polygon(df)
- Check point in polygon (list or 2D tuple)
pnp.PointInPolygon(point, polygon)
- Get min value from array based on index
pnp.minValue(array, index)
- Get max value from array based on index
pnp.maxValue(array, index)