pysal.lib.cg.get_polygon_point_dist

pysal.lib.cg.get_polygon_point_dist(poly, pt)[source]

Returns the distance between a polygon and point.

get_polygon_point_dist(Polygon, Point) -> number

Parameters:
poly : a polygon to compute distance from
pt : a point to compute distance from

Examples

>>> poly = Polygon([Point((0, 0)), Point((1, 0)), Point((1, 1)), Point((0, 1))])
>>> pt = Point((2, 0.5))
>>> get_polygon_point_dist(poly, pt)
1.0
>>> pt2 = Point((0.5, 0.5))
>>> get_polygon_point_dist(poly, pt2)
0.0