Topology_Load_Tiger — Loads a defined region of tiger data into a PostGIS Topology and transforming the tiger data to spatial reference of the topology and snapping to the precision tolerance of the topology.
text Topology_Load_Tiger(varchar topo_name, varchar region_type, varchar region_id
Loads a defined region of tiger data into a PostGIS Topology. The faces, nodes and edges are transformed to the spatial reference system of the target topology and points are snapped to the tolerance of the target topology. The created faces, nodes, edges maintain the same ids as the original Tiger data faces, nodes, edges so that datasets can be in the future be more easily reconciled with tiger data. Returns summary details about the process.
This would be useful for example for redistricting data where you require the newly formed polygons to follow the center lines of streets and for the resulting polygons not to overlap.
This function relies on Tiger data as well as the installation of the PostGIS topology module. For more information, refer to 11章トポロジ and 「コンフィギュレーション」. If you have not loaded data covering the region of interest, then no topology records will be created. This function will also fail if you have not created a topology using the topology functions.
Most topology validation errors are a result of tolerance issues where after transformation the edges points don't quite line up or overlap. To remedy the situation you may want to increase or lower the precision if you get topology validation failures.
topo_name The name of an existing PostGIS topology to load data into.
region_type The type of bounding region. Currently only
county are supported. Plan is to have several more. This is the table to look into to define the region bounds. e.g
region_id This is what TIGER calls the geoid. It is the unique identifier of the region in the table. For place it is the
plcidfp column in
tiger.place. For county it is the
cntyidfp column in
Create a topology for Boston, Massachusetts in Mass State Plane Feet (2249) with tolerance 0.25 feet and then load in Boston city tiger faces, edges, nodes.
SELECT topology.CreateTopology('topo_boston', 2249, 0.25); createtopology -------------- 15 -- 60,902 ms ~ 1 minute on windows 7 desktop running 9.1 (with 5 states tiger data loaded) SELECT tiger.topology_load_tiger('topo_boston', 'place', '2507000'); -- topology_loader_tiger -- 29722 edges holding in temporary. 11108 faces added. 1875 edges of faces added. 20576 nodes added. 19962 nodes contained in a face. 0 edge start end corrected. 31597 edges added. -- 41 ms -- SELECT topology.TopologySummary('topo_boston'); -- topologysummary-- Topology topo_boston (15), SRID 2249, precision 0.25 20576 nodes, 31597 edges, 11109 faces, 0 topogeoms in 0 layers -- 28,797 ms to validate yeh returned no errors -- SELECT * FROM topology.ValidateTopology('topo_boston'); error | id1 | id2 -------------------+----------+-----------
Create a topology for Suffolk, Massachusetts in Mass State Plane Meters (26986) with tolerance 0.25 meters and then load in Suffolk county tiger faces, edges, nodes.
SELECT topology.CreateTopology('topo_suffolk', 26986, 0.25); -- this took 56,275 ms ~ 1 minute on Windows 7 32-bit with 5 states of tiger loaded -- must have been warmed up after loading boston SELECT tiger.topology_load_tiger('topo_suffolk', 'county', '25025'); -- topology_loader_tiger -- 36003 edges holding in temporary. 13518 faces added. 2172 edges of faces added. 24761 nodes added. 24075 nodes contained in a face. 0 edge start end corrected. 38175 edges added. -- 31 ms -- SELECT topology.TopologySummary('topo_suffolk'); -- topologysummary-- Topology topo_suffolk (14), SRID 26986, precision 0.25 24761 nodes, 38175 edges, 13519 faces, 0 topogeoms in 0 layers -- 33,606 ms to validate -- SELECT * FROM topology.ValidateTopology('topo_suffolk'); error | id1 | id2 -------------------+----------+----------- coincident nodes | 81045651 | 81064553 edge crosses node | 81045651 | 85737793 edge crosses node | 81045651 | 85742215 edge crosses node | 81045651 | 620628939 edge crosses node | 81064553 | 85697815 edge crosses node | 81064553 | 85728168 edge crosses node | 81064553 | 85733413