If I understand you correctly, your link table already contains the necessary data to create a linestring (node_1/node_2 or startpoint/endpoint). You could denormalize your link table to contain a geometry column or create a new table.

CREATE TABLE lines AS
SELECT
   links.id,
   links.weight,
   ST_MakeLine(a.the_geom, b.the_geom) AS the_geom
FROM links, nodes a, nodes b
WHERE links.node_1 = a.node_id
AND links.node_2 = b.node_id;

-- Kevin

ah...@elegantdesigns.ca wrote:
i am resubmitting this as I missed an important fact.

Hello list,

** I have a [edit]non geometric[/edit] table in the following format:

id    node_1    node_2    weight
1     1         2         5.4
2     1         3         2
3     2         4         6
4     4         4         1


the table is about 2,000 rows long.

** I also have a point table gid the_geom node_id
-      -           -


i was wondering what query should i do so i can create
* a line table between the corresponding nodes, and add to that
* a weight field/attribute that corresponds to the newly created link

Thank you,
dassouki
_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users

Reply via email to