PDA

View Full Version : Adding nodes to upstream links



Andrew B
October 22, 2015, 09:20 AM
I have GIS data where the most upstream link on each line is missing an upstream manhole. Is there a SQL script that will allow me to add the upstream nodes to all of these lines automatically?

Thank you!

Duncan Kitts
October 29, 2015, 06:36 AM
I think the closest you'll be able to do with SQL is to add a node based on the links upstream co-ordinates. From the 'SQL in InfoWorks ICM, ICMLive Configuration Manager and Infonet help topic:-
"To add individual objects the syntax is:

INSERT INTO<table name> (field1, field 2,... fieldn) VALUES (val1,val2,... valn)
INSERT INTO node (node_id,x,y) VALUES ('N1', 123, 456)"

DCJ
June 5, 2018, 06:45 AM
When I use the following SQL to insert a node into the table, a data type error occurs.

SET $new_node_id = node_id+"S";
SET $new_x = x+10;
SET $new_y = y+10;

INSERT INTO node (node_id,x,y) VALUES ($new_node_id, $new_x, $new_y)



variable $new_node_id has already been used in a different context - this context 'Scalar', previous context 'All Nodes'
variable $new_x has already been used in a different context - this context 'Scalar', previous context 'All Nodes'
variable $new_y has already been used in a different context - this context 'Scalar', previous context 'All Nodes'

Duncan Kitts
June 6, 2018, 12:46 AM
Try the following:-

SET $new_node_id = node_id+"S";
SET $new_x = x+10;
SET $new_y = y+10;

INSERT INTO node (node_id,x,y) SELECT $new_node_id,$new_x,$new_y;