libpysal.cg.get_polygon_point_intersect

libpysal.cg.get_polygon_point_intersect(poly, pt)[source]

Returns the intersection of a polygon and point.

Parameters:
polylibpysal.cg.Polygon

A polygon to check for an intersection.

ptlibpysal.cg.Point

A point to check poly for an intersection.

Returns:
ret{libpysal.cg.Point, None}

The intersection of a poly and pt if one exists, otherwise None.

Examples

>>> poly = Polygon([Point((0, 0)), Point((1, 0)), Point((1, 1)), Point((0, 1))])
>>> pt = Point((0.5, 0.5))
>>> i = get_polygon_point_intersect(poly, pt)
>>> str(i)
'(0.5, 0.5)'
>>> pt2 = Point((2, 2))
>>> get_polygon_point_intersect(poly, pt2)