[postgis-users] distance from polygon for a point that is inside

strk at refractions.net strk at refractions.net
Fri Sep 16 10:49:44 PDT 2005


On Fri, Sep 16, 2005 at 02:46:08PM -0300, ricardd at mathstat.dal.ca wrote:
> Hello postgis-users,
> I recently started using postGIS and I'm really impressed with its
> capabilities. Kudos to the developers.
> 
> This is probably an easy question for the gurus, so please bear with me.
> 
> Is there a way to calculate the minimum distance between a point and the
> boundary of a polygon when the point is located inside the polygon? I have
> been using distance(polygon, point), but it returns 0 when
> contains(polygon, point)=T.

Try:
	-- min distance to any boundary
	SELECT distance(point, boundary(polygon));
Or:
	-- min distance to exterior ring
	SELECT distance(point, ExteriorRing(polygon));

--strk;




More information about the postgis-users mailing list