point_in_polygon#

static GeometryOperators.point_in_polygon(point, polygon, tolerance=1e-08)[source]#

Determine if a point is inside, outside the polygon or at exactly at the border.

The method implements the radial algorithm (https://es.wikipedia.org/wiki/Algoritmo_radial)

This version supports also self-intersecting polygons.

pointList

List of [x, y] coordinates.

polygonList

[[x1, x2, …, xn],[y1, y2, …, yn]]

tolerancefloat

tolerance used for the algorithm. Default value is 1e-8.

Returns:
int
  • -1 When the point is outside the polygon.

  • 0 When the point is exactly on one of the sides of the polygon.

  • 1 When the point is inside the polygon.