Changes between Version 3 and Version 4 of UsersWikiExamplesNetworkTopology


Ignore:
Timestamp:
Jun 14, 2009, 8:36:47 PM (15 years ago)
Author:
kneufeld
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • UsersWikiExamplesNetworkTopology

    v3 v4  
    3333The 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[].
    3434
     35{{{
     36-- node table DDL
     37CREATE TABLE nodes (
     38  the_geom geometry,
     39  road_leaving integer[],
     40  road_entering integer[]
     41);
     42}}}
     43
    35442. 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.
    3645
     
    4150ALTER TABLE roads ADD from_node integer;
    4251ALTER TABLE roads ADD to_node integer;
     52
     53-- Sample data in table
     54SELECT 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)
    4359}}}
    4460
     
    97113[[Image(network_topology2.png)]]
    98114
    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).
    100115
     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