[postgis-users] Creating linestring from two points
Per-Olof Norén
pelle at alma.nu
Mon Nov 4 04:26:51 PST 2002
Hi all,
I´ve been lurking around this list for some time and I´ve finally got a
proper
project to make use of postgis in the real world.
I have mapserver 3.5 and postgis 0.7 working just fine. It really rocks.
No problems there to report apart from mapserver installation nightmare
with all those little graphical and projection package dependencies. I´m
really looking forward to a debian package installed by my dear litttle
dselect :-)
I have a postgis SQL question though:
Consider the following two tables (names are in a "sweenglish" mix of
swedish and english, ignore spelling and so on).
create table nod (
nod_id varchar(4) primary key not null,
namn varchar(50) not null,
status int not null
);
select AddGeometryColumn('crm', 'nod', 'nod_geom', 30800, 'POINT', 2 );
create table lank (
parent_nod_id varchar(4) not null,
child_nod_id varchar(4) not null,
nat_id varchar(4) not null,
nat_shortnbr int not null,
primary key(parent_nod_id, child_nod_id, nat_id)
);
select AddGeometryColumn('crm', 'lank', 'lank_geom', 30800,
'LINESTRING', 2 );
Theese tables describes a network topology and I have populated table
nod with a few tuples, including their geometry (points)
I Also populated everything *but* the geometry (lank_geom) for the lank
table.
My question then boils down to:
How do I construct a linestring value to insert into lank.lank_geom from
two given points from nod.nod_geom using update?
The two points is then obtain by joining the lank table twice against
nod table.
Its basacially the postgis functions/operators that creates a linestring
from two points I´m looking for
Is it all possible?
Thanx in advance,
Per-Olof Norén
More information about the postgis-users
mailing list