[postgis-users] Creating a linestring from two points
Per-Olof Norén
pelle at alma.nu
Fri Nov 8 07:17:48 PST 2002
Hi Dave,
Sorry for the delay. I managed to figure somthing similar out before you
could answer it.
Anyway, I used the function x(point1) instead of xmin though. Isn´t a
point´s bounding box the point itself?
or is a point´s bounding box point+1 unit in every direction? Need
update using your suggestion?
My query:
update lank set lank_geom =
GeometryFromText('LINESTRING(' || x(parent.nod_geom) || ' ' ||
y(parent.nod_geom)
|| ',' || x(child.nod_geom) || ' ' || y(child.nod_geom) || ')', 30800)
from lank l,
nod parent,
nod child
where lank.parent_nod_id = parent.nod_id
and lank.child_nod_id = child.nod_id
and l.parent_nod_id = l.parent_nod_id
Thanx in advance,
Per-Olof
David Blasby wrote:
>Per-Olof,
>
>Unfortunately OGC didnt define any constructors for geometries. I should
>really add a few functions to do this - perhaps I'll get some time in the
>next little while.
>
>If you want to construct a line from 2 points, I suggest you build up a WKT
>string:
>
>Lets look at a simple example - a table with 3 geometry columns called
>'point1','point2','line'. The point1 and point2 column have points in them.
>
>The function xmin(geometry) returns the xmin of the geometry's bounding
>box. For a point, the points X value is the same as the bounding box's X
>value. The '||' operator concatenates 2 strings.
>
>UPDATE <table> SET line =
> geometryFromText(
> 'LINESTRING('|| xmin(point1)||' ' || ymin(point1) ||','||
>xmin(point2) || ' '|| ymin(point2) || ')'
> );
>
>dave
>
>
>_______________________________________________
>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