[postgis-users] points from st_distance

Paragon Corporation lr at pcorp.us
Wed Feb 11 12:38:09 PST 2009


Steve,

Maybe I misunderstood his question.  I thought what he was asking was

1) since ST_Distance gives the distance between the 2 points of each
geometry that are closest.  What is that point(s) that it is using.

So our thinking is is that any of the points that satisfies the below
condition is a solution to that

So say you have Geometry A and geometry B and you want to know what set of
points on Geometry A are closest to Geometry B

The answer would be

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

Hope that helps,
Regina  

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Stephen
Woodbridge
Sent: Wednesday, February 11, 2009 11:50 AM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] points from st_distance

Hmmmm, why not do something like:


select *, ST_distance(point, object) as dist from table expand(point,
min_distance) && object and dist <= min_distance order by dist limit 1;

-Steve


Paragon Corporation wrote:
> 
> Nicklas,
>  
> You are correct there is no function for doing this.  We have on 
> occasion needed to do this ourselves and what we usually do is
>  
> 1) first find the minimum distance
> 2) figure out which point/pointset on the geometry satisfies the 
> minimum distance using buffer and intersection (with minimum distance 
> being the buffer distance).
>  
> I think I have the code lying around here somewhere.
>  
> As far as ST_Distance goes.  Haven't looked at the code that closely, 
> but it does some sort of recursive call and there could be more than 
> one point that satisfies the condition and it only cares about the 
> first one it comes across so such a thing may or may not be quite what 
> you are looking for.
>  
> Hope that helps,
> Regina
>  
>  
> 
> *From:* postgis-users-bounces at postgis.refractions.net
> [mailto:postgis-users-bounces at postgis.refractions.net] *On Behalf Of 
> *nicklas.aven at jordogskog.no
> *Sent:* Wednesday, February 11, 2009 4:47 AM
> *To:* postgis-users at postgis.refractions.net
> *Subject:* [postgis-users] points from st_distance
> 
> Hallo
> 
> I have a question or suggestion.
> 
> If I have missed some functionality please tell me.
> 
> The thing is I have often needed information about from which points 
> the distance in st_distance is calculated.
> I mean, somewhere in the function the information have to be. Would it 
> be possible to build a new function which returned the distance, 
> startpoint, endpoint as array or something like that.
> 
> Am I right about that this functionality is missing and am I right 
> about that the points have to be identified somewhere in the function 
> and that it ought to be possible to present them in a function.
> 
> If I'm right so far I would like to come this as a suggestion.
> 
> I also have to thank you all for postgis.
> It has been a very nice experience to start handling the gis analysing 
> and processing in database-environment.
> My next step is to try to manage any of the procedural languages. Then 
> I guess I can do just anything with all the points and polygons out there
:-).
> 
> /Nicklas
> 
> 
> ----------------------------------------------------------------------
> --
> 
> _______________________________________________
> 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


__________ Information from ESET NOD32 Antivirus, version of virus signature
database 3842 (20090210) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com







More information about the postgis-users mailing list