libpysal.cg.get_polygon_point_dist¶
- libpysal.cg.get_polygon_point_dist(poly, pt)[source]¶
Returns the distance between a polygon and point.
- Parameters:¶
- poly : libpysal.cg.Polygon¶
A polygon to compute distance from.
- pt : libpysal.cg.Point¶
a point to compute distance from
- Returns:¶
dist – The distance between
polyandpoint.- Return type:¶
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