[postgis-users] points from st_distance

nicklas.aven at jordogskog.no nicklas.aven at jordogskog.no
Fri Feb 13 06:15:10 PST 2009


I dived into the source code. It was surprisingly readable even if I have never studied c-code before. 
My problem is that I don't know anything about compiling and things like that so I can't test what I want to do, and I haven't found any easy "howto"-compile postgis on the net. 
 
I have put my conclusions in a html-file here:
http://jordogskog.no/distance.html
 
As I understand it shouldn't be a very big thing to implement this and I even think the handling would be moreconsistently with my suggestion of changing in function distance2d_pt_seg. But as I have said, I'm just an amateur but I was so glad I understod some of the source-code so I have to try :-) If someone have an easy how-to compile postgis for windows it would be great. /Nicklas
 

2009-02-13 Paragon Corporation wrote:

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
>
>
>
>_______________________________________________
>postgis-users mailing list
>postgis-users at postgis.refractions.net
>http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20090213/d6e2b548/attachment.html>


More information about the postgis-users mailing list