[postgis-users] st_closespoint weridness

Dave Potts dave.potts at pinan.co.uk
Fri Oct 5 15:07:47 PDT 2012


Martin Davis wrote:
> If the point is inside the polygon, the distance between them is 0.
Hmm  I do not understand, then nearest point should be along the boundary
of the polygon.

> Can't get closer than that!
>
> You may want to try ST_ClosestPoint(ST_Boundary(poly), point)

This worked, many thanks

Dave.
>
> On 10/5/2012 12:10 PM, Dave Potts wrote:
>> just tried a
>>
>> select st_closestpoint(poly,point) and got the result point
>>
>> The point is within a the closed polygon poly, the version is postgis
>> 2.0
>> is there any sane reason why this behave in this manner.  I had expected
>> to the value of the x/y coordinate pair from the polylgon that is
>> nearest
>> to point, not the value of point!
>>
>> Any suggestions as what I might be doing wrong?  or an suggestions for a
>> better way of doing this?
>>
>> regards
>>
>>
>> Dave.
>>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>


-- 





More information about the postgis-users mailing list