[postgis-devel] Issue 137 in postgis: st_distance, shortestline (, st_maxdistance)
codesite-noreply at google.com
codesite-noreply at google.com
Sun Apr 5 08:05:16 PDT 2009
Comment #8 on issue 137 by post... at jordogskog.no: st_distance, shortestline
(, st_maxdistance)
http://code.google.com/p/postgis/issues/detail?id=137
Here is a new patch in wich I try to preserve the order of incoming
geometries. If
that order isn't preserved st_shortestline will be quite useless.
I'm not totally sure that I have succeeded to think of all possibilities
where the
order will be mixed up. But I will look through it some more.
In this patch the bug discussed in issue 146 should be fixed to.
Now, let me just give an example of the use of the function
st_shortestline, why I
think it should be in postgis.
It is efficient and simple to use for snapping.
Let's say you have an GPS-point taken on a road some where. The point will
not be
exactly on the road beacause of precision issues both to the GPS and the
map.
To find the closest point to the gps-point on the road-line using
st_shortestline we
just do:
SELECT st_endpoint(ST_shortestline(g1,g2)) As pointonroad from
(select ST_geomFromEWKT('POINT(2 4)') As g1, ST_geomFromEWKT('LINESTRING(1
2, 2 5)')
As g2) a;
Here the order of inputing geometrys to st_shortestline is of importance.
/Nicklas Avén
Attachments:
20090405.patch 418 KB
--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings
More information about the postgis-devel
mailing list