[postgis-users] RE : Linestring intersections + intersection order
Francois Hugues
hugues.francois at irstea.fr
Sat Jun 16 05:15:16 PDT 2012
Hello,
I think you could order your points using st_distance. Something like this request should work :
select
st_distance(st_startpoint(a.the_geom), st_intersection(a.the_geom, b.the_geom)),
st_intersection(a.the_geom, b.the_geom) the_geom
from my_single_linestring a, my_table_of_linestrings b
where st_intersects (a.the_geom, b.the_geom)
order by st_distance(st_startpoint(a.the_geom), st_intersection(a.the_geom, b.the_geom))
I don't know how to have a simple id (1, 2, 3, ..., n) without creating a new table with serial column or using a plpg function with a loop.
Hugues
-------- Message d'origine--------
De: postgis-users-bounces at postgis.refractions.net de la part de Ed Linde
Date: ven. 15/06/2012 22:44
À: PostGIS Users Discussion
Objet : [postgis-users] Linestring intersections + intersection order
Hi all,
I am trying to compute the intersection between a given linestring and a
whole set of linestrings in a table.
So the idea is that this single linestring will get intersected by the
lines in the table at multiple points.
Only thing is that i know the start and end of the linestring and I would
like to know the ORDER in which
these intersections took place.
So the end result is that I get to see my query linestring along with all
the "intersection points" with an increasing
ID to indicate which point comes before the other. Hope that made sense. :)
Cheers,
Ed
-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 3439 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20120616/1068a6dc/attachment.bin>
More information about the postgis-users
mailing list