[postgis-users] Postgis views
David Blasby
dblasby at refractions.net
Thu Feb 26 16:45:01 PST 2004
> Something like
> "create view ...as select ..., line(point(startx, starty),point(endx,
> endy))..."
> where start/end x/y are floats.
Yes, you can do this. Unfortunately, this isnt something thats easy to
do because the OGC spec doesnt really specify constructors. When we get
to the LWGEOM type, I'll think about adding some easy-to-use geometry
constructors.
Its actually easier to store your data as postgis points and have the
x/y floats "table" as a view.
But if you really want to do it the other way around, you could try
something like this:
SELECT geometry_from_text( 'LINESTRING('||startx||'
'||starty||','||endx||' '||endy||')') FROM <other table>;
(Basically, you're constructing a string like 'LINESTRING(0 0,1 1)' and
converting that to a geometry. Ugly, but it works.)
dave
More information about the postgis-users
mailing list