[postgis-users] points from st_distance

Stephen Woodbridge woodbri at swoodbridge.com
Wed Feb 11 08:49:51 PST 2009


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




More information about the postgis-users mailing list