[postgis-users] sql statements for angles on multilinestrings
David Blasby
dblasby at refractions.net
Wed Jun 23 10:27:43 PDT 2004
Thomas Preuth wrote:
> -----------------------------------------------------------------------------------------------------------------
> Hello,
>
> I have two questions concerning postgis.
> The issue is:
>
> The column the_geom includes lines (multilinestring) as geometries, which
> define their position by two coordinates. A symbol should be placed at
> first coordinate. The base of the symbol should be perpendicular to the
> line. Therefore I need the tilt angle of the multilinestring.
> So my questions:
> 1.)How can I extract the first coordinate of the multilinestring with a
> sql statement?
> 2.)How can I get the tilt angle of the multilinestring (to the horizontal)
> with a sql statement?
1.
SELECT startpoint(geometryN(the_geom,1)) FROM <table>
2.
I'm not sure what you exactly you mean by "tilt angle", but you
can extract the (x,y) coordinates from a linestring like this:
x( pointN( geometryN( the_geom,1), 1))
y( pointN( geometryN( the_geom,1), 1))
x( pointN( geometryN( the_geom,1), 2))
y( pointN( geometryN( the_geom,1), 2))
Postgresql supports all the trigonometry functions, so it should be
easy to compute the "tilt angle".
dave
More information about the postgis-users
mailing list