[postgis-users] points from st_distance
lr at pcorp.us
Thu Feb 12 19:49:21 PST 2009
More on this topic.
In my comment
SELECT ST_Intersection(A, ST_Buffer(B, ST_Distance(A,B)))
I forgot to add that generally you need to add a bit of a tolerance.
SELECT ST_Intersection(A, ST_Buffer(B, ST_Distance(A,B)) + 0.001)
As has been mentioned before because of the floating point issues and so
forth the above without tolerance often returns nothing.
Note to Martin,
Is this JTS code you added in GEOS already? Doing a quick glance at the GEOS
operation.distance.DistanceOp class, I noticed some functions that look like
they may return minimum distance points - DistanceOp::closestPoints(Geometry
So does that just need to be exposed via CAPI?
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Martin
Sent: Thursday, February 12, 2009 11:51 AM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] points from st_distance
> On the topic itself, this is doable, but note that distance does not
> calculate the shortest distance points (sometimes they are between
> vertices, note) it just calculates the segmentA/segmentB distances and
> finds the minimum.
This is how the JTS algorithm works as well. It is possible to identify the
points which determine the shortest distance, and it's not too hard to do.
I added this to JTS once I realized that this is quite useful for
visualizing the distance.
Senior Technical Architect
Refractions Research, Inc.
postgis-users mailing list
postgis-users at postgis.refractions.net
More information about the postgis-users