Changes between Version 3 and Version 4 of UsersWikiExamplesNetworkTopology
- Timestamp:
- 06/14/09 20:36:47 (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
UsersWikiExamplesNetworkTopology
v3 v4 33 33 The above query creates a node table from a roads table by selecting all the start and end points from the road segments while maintaining the link between the node geometry and the line segment id. Then nodes are grouped into a single topologically distinct set where every POINT references an array of line segment ids as integer[]. 34 34 35 {{{ 36 -- node table DDL 37 CREATE TABLE nodes ( 38 the_geom geometry, 39 road_leaving integer[], 40 road_entering integer[] 41 ); 42 }}} 43 35 44 2. The next step is to assign a unique id for each node and to add two new attributes to the roads table to hold the node references. 36 45 … … 41 50 ALTER TABLE roads ADD from_node integer; 42 51 ALTER TABLE roads ADD to_node integer; 52 53 -- Sample data in table 54 SELECT node_id, road_leaving, road_entering FROM nodes WHERE node_id = 1764; 55 node_id | road_leaving | road_entering 56 ---------+-----------------+---------------- 57 1764 | {712,NULL,NULL} | {NULL,781,745} 58 (1 row) 43 59 }}} 44 60 … … 97 113 [[Image(network_topology2.png)]] 98 114 99 Notes: Alternatively, we could have first created a distinct set of nodes, assigned a unique id to the nodes, and spatially transferred a node_id attribute to every road by intersecting the roads and nodes. However, such spatial operations are very expensive to perform. Also, in this case, it's not needed since we already have a relationship between a line and a node (the node is just the start or end point of the line it originated from).100 115 116 '''Notes''': Alternatively, we could have first created a distinct set of nodes, assigned a unique id to the nodes, and spatially transferred a node_id attribute to every road by intersecting the roads and nodes. However, such spatial operations are very expensive to perform. Also, in this case, it's not needed since we already have a relationship between a line and a node (the node is just the start or end point of the line it originated from). 117