[postgis-users] RE: postgis-users] a line' s direction
Hartmut Tschauner
hartmut.tschauner at gmail.com
Thu Sep 15 07:45:49 PDT 2005
Ahmet,
You would use a query like the following, which returns the azimuth from the
start point to the end point of a simple line(string):
SELECT azimuth(pointn(the_geom, 1),
pointn(the_geom, npoints(the_geom))) as azimuth
FROM rivers;
If you need to deal with multi geometries, it would get a bit more
complicated. For example, the azimuth from the start point to the end point
of the first geometry:
SELECT azimuth(pointn(geometryn(the_geom, 1), 1),
pointn(geometryn(the_geom, 1), npoints(the_geom))) as azimuth
FROM rivers;
Cheers,
Hartmut
Hartmut Tschauner
Department of Archaeology
Seoul National University
Gwanak-Gu Sillim 9-dong San 56-1
Seoul, 151-742
Korea
ph. +82 (2) 880-9260
>thank you for your help about line direction. I tested: bzk=> select
astext(wkb_geometry) from bartin_fay limit 1; astext
>-----------------------------------------------------------
LINESTRING(458329.385 4604735.295,458326.082 4604735.287) (1 row) bzk=>
select public.azimuth('point(458329.385 4604735.295)', 'point(458326.082
4604735.287)'); azimuth ------------------ 269.861227562345 (1 row)
>~~~~~~~~~~~~~~~~~~ which function can I use to get end points of lines to
input function ? I have a huge dataset containing linestring geometric data.
kind regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20050915/6a2b0a85/attachment.html>
More information about the postgis-users
mailing list