PostGIS Topology: Porovnání verzí
Řádek 167: | Řádek 167: | ||
* [http://strk.keybit.net/blog/2011/10/14/postgis-topology-iso-sqlmm-complete/ PostGIS topology ISO SQL/MM complete] | * [http://strk.keybit.net/blog/2011/10/14/postgis-topology-iso-sqlmm-complete/ PostGIS topology ISO SQL/MM complete] | ||
* [http://strk.keybit.net/blog/2012/04/13/simplifying-a-map-layer-using-postgis-topology/ Simplifying a map layer using PostGIS topology] | * [http://strk.keybit.net/blog/2012/04/13/simplifying-a-map-layer-using-postgis-topology/ Simplifying a map layer using PostGIS topology] | ||
* Topo-Geo-and-Topo-Net - [http://www.wiscorp.com/H2-2004-168r2-Topo-Geo-and-Topo-Net-1-The-Concepts.pdf The Concepts] {{bullet}} [http://www.wiscorp.com/H2-2005-107r2-Topo-Concepts-The-Sequel.pdf Concepts, The Sequel] {{bullet}} [http://www.wiscorp.com/H2-2005-108r2-Topo-Routine-Details.pdf Routine Details] | |||
{{Databáze}} | {{Databáze}} | ||
{{GIS}} | {{GIS}} | ||
{{GFOSS}} | {{GFOSS}} |
Verze z 14. 4. 2012, 20:07
PostGIS Topology je rozšíření pro PostGIS umožňující topologickou správu vektorových dat v prostředí PostGIS/PostgreSQL.
Více přednášky Úvod do zpracování prostorových dat.
Příklad (kltm50)
Data z cvičné databáze pgis_student.
CREATE SCHEMA my_schema;
SET search_path TO my_schema,public,topology,gis1;
Feature table 'tm50_cr'
CREATE TABLE tm50_cr AS SELECT DISTINCT k.ogc_fid,k.tm50,k.geom FROM kltm50 AS k JOIN obce AS o ON ST_Overlaps(k.geom, o.geom);
SELECT COUNT(*) FROM tm50_cr;
count ------- 289 (1 row)

Vytvoření topologického schématu 'topo_tm50_cr'
SELECT topology.createtopology('topo_tm50_cr', find_srid('gis1', 'kltm50', 'geom'), 1);
Argumenty:
- find_srid('gis1', 'kltm50', 'geom') → 2065 (EPSG)
- 1 (přesnost v mapových jednotkách, tj. v tomto případě v metrech)
SELECT * from topology.topology;
id | name | srid | precision | hasz ----+--------------+------+-----------+------ 1 | topo_tm50_cr | 2065 | 1 | f (1 row)
\dt topo_tm50_cr.
List of relations Schema | Name | Type | Owner --------------+-----------+-------+--------- topo_tm50_cr | edge_data | table | postgis topo_tm50_cr | face | table | postgis topo_tm50_cr | node | table | postgis topo_tm50_cr | relation | table | postgis (4 rows)
Přidání atributu topologie do feature table
SELECT topology.AddTopoGeometryColumn('topo_tm50_cr', 'my_schema', 'tm50_cr', 'topo', 'POLYGON');
SELECT * FROM topology.layer;
topology_id | layer_id | schema_name | table_name | feature_column | feature_type | level | child_id -------------+----------+-------------+------------+----------------+--------------+-------+---------- 1 | 1 | my_schema | tm50_cr | topo | 3 | 0 |
Poznámka: feature_type '3' odpovídá 'face' (1 - node, 2 - edge).
Sestavení topologie (Geometry → TopoGeometry)
UPDATE tm50_cr set topo = topology.toTopoGeom(geom, 'topo_tm50_cr', 1);
SELECT tm50,topo from tm50_cr limit 3;
tm50 | topo -----------+------------ M-33-29-D | (1,1,1,3) M-33-30-C | (1,1,2,3) M-33-30-D | (1,1,3,3) (3 rows)
Poznámka:
(1,1,1,3) odpovídá (topology_id,layer_id,id,type)
Počet uzlů:
SELECT count(*) FROM topo_tm50_cr.node;
count ------- 313 (1 row)
Počet hran:
SELECT count(*) FROM topo_tm50_cr.edge;
count ------- 601 (1 row)
Počet stěn:
SELECT count(*) FROM topo_tm50_cr.face;
count ------- 290 (1 row)
Hrany, které vedou z anebo do uzlu číslo '164'
SELECT edge_id,left_face,right_face FROM topo_tm50_cr.edge WHERE start_node = 164 OR end_node = 164;
edge_id | left_face | right_face ---------+-----------+------------ 289 | 146 | 134 310 | 160 | 146 308 | 172 | 134 360 | 172 | 160 (4 rows)

Externí odkazy
- State of the art of FOSS4G for topology and network analysis
- PostGIS 2.0 Topology section of manual
- Topogie • Sedm mostů města Královce • Topological modeling
- Vektorové modely
- strk's page about PostGIS
- PostGIS topology ISO SQL/MM complete
- Simplifying a map layer using PostGIS topology
- Topo-Geo-and-Topo-Net - The Concepts • Concepts, The Sequel • Routine Details