[postgis-users] points from st_distance

Paragon Corporation lr at pcorp.us
Thu Feb 12 19:56:36 PST 2009


 Typo.  Of course I meant

SELECT ST_Intersection(A, ST_Buffer(B, ST_Distance(A,B) + 0.001) )

Then if you really wanted the points -- you would use the imaginary not yet
invented ST_DumpPoints should the result not be point or be a geometry
collection of some sort.



-----Original Message-----
From: Paragon Corporation [mailto:lr at pcorp.us] 
Sent: Thursday, February 12, 2009 10:49 PM
To: 'PostGIS Users Discussion'
Subject: RE: [postgis-users] points from st_distance

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
*g0,Geometry *g1)

So does that just need to be exposed via CAPI?

Thanks,
Regina



 

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Martin
Davis
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.
>   

--
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022

_______________________________________________
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