Topology_Load_Tiger — 將定義的虎 (tiger) 資料區域載入到 PostGIS 拓樸中,並將虎資料轉換為拓樸的空間參考,並對齊到拓樸的精度容差。
text Topology_Load_Tiger(
varchar topo_name, varchar region_type, varchar region_id)
;
將定義的虎 (tiger) 資料區域載入到 PostGIS 拓樸中。面、節點和邊會轉換為目標拓樸的空間參考系統,並且點會對齊到目標拓樸的容差。建立的面、節點、邊會保留與原始虎資料面、節點、邊相同的 ID,以便未來更容易與虎資料協調。傳回有關該過程的摘要詳細資訊。
這對於需要新形成的 polygon 遵循街道中心線,並且結果 polygon 不重疊的重新劃分選區資料來說會很有用。
![]() |
|
此函式依賴於虎資料以及 PostGIS 拓樸模組的安裝。如需更多資訊,請參閱第 9 章,拓樸和第 2.2.3 節,「組建設定」。如果您沒有載入涵蓋感興趣區域的資料,則不會建立任何拓樸記錄。如果您沒有使用拓樸函式建立拓樸,此函式也會失敗。 |
![]() |
|
大多數拓樸驗證錯誤是由於容差問題造成的,在轉換後,邊緣點並不能完全對齊或重疊。要解決此問題,如果您遇到拓樸驗證失敗,您可能需要增加或降低精度。 |
必要參數
topo_name
要載入資料的現有 PostGIS 拓樸的名稱。
region_type
邊界區域的類型。目前僅支援 place
和 county
。計畫將支援更多類型。這是用於定義區域邊界的表格。例如 tiger.place
, tiger.county
region_id
這是 TIGER 稱作 geoid 的值。它是表格中區域的唯一識別碼。對於 place,它是 tiger.place
中的 plcidfp
欄位。對於 county,它是 tiger.county
中的 cntyidfp
欄位
可用性: 2.0.0
以 0.25 英尺的容差在麻薩諸塞州州立平面英尺 (2249) 中建立波士頓的拓樸,然後載入波士頓城市的虎面、邊、節點。
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 -------------------+----------+-----------
以 0.25 公尺的容差在麻薩諸塞州州立平面公尺 (26986) 中建立薩福克的拓樸,然後載入薩福克縣的虎面、邊、節點。
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