|
|
(Není zobrazeno 77 mezilehlých verzí od stejného uživatele.) |
Řádek 1: |
Řádek 1: |
| {{Upravit}} | | {{freegiswiki|PostGIS Topology}} |
| | |
| [http://trac.osgeo.org/postgis/wiki/UsersWikiPostgisTopology 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 [[153UZPD#Přednášky|Úvod do zpracování prostorových dat]].
| |
| | |
| == Příklad ==
| |
| | |
| ;Feature table "urbanarea"
| |
| | |
| \d urbanarea
| |
| | |
| <pre>
| |
| Table "public.urbanarea"
| |
| Column | Type | Modifiers
| |
| --------------+-------------------+-------------------------------------------------------------
| |
| ogc_fid | integer | not null default nextval('urbanarea_ogc_fid_seq'::regclass)
| |
| wkb_geometry | geometry |
| |
| cat | integer |
| |
| objectid | integer |
| |
| ua | character varying |
| |
| name | character varying |
| |
| ua_type | character varying |
| |
| Indexes:
| |
| "urbanarea_pk" PRIMARY KEY, btree (ogc_fid)
| |
| "urbanarea_geom_idx" gist (wkb_geometry)
| |
| Check constraints:
| |
| "enforce_dims_wkb_geometry" CHECK (st_ndims(wkb_geometry) = 2)
| |
| "enforce_geotype_wkb_geometry" CHECK (geometrytype(wkb_geometry) = 'POLYGON'::text OR wkb_geometry IS NULL)
| |
| "enforce_srid_wkb_geometry" CHECK (st_srid(wkb_geometry) = 900914)
| |
| </pre>
| |
| | |
| <source lang=sql>
| |
| SELECT cat, ua, name, ST_GeometryType(wkb_geometry) from urbanarea limit 5;
| |
| </source>
| |
| | |
| <pre>
| |
| cat | ua | name | st_geometrytype
| |
| -----+-------+------------+-----------------
| |
| 1 | 29305 | Farmville | ST_Polygon
| |
| 2 | 92404 | Washington | ST_Polygon
| |
| 3 | 35380 | Greenville | ST_Polygon
| |
| 4 | 46315 | La Grange | ST_Polygon
| |
| 5 | 45397 | Kinston | ST_Polygon
| |
| </pre>
| |
| | |
| ; Vytvoření topologického schématu 'urbanarea'
| |
| | |
| <source lang=sql>
| |
| SELECT topology.createtopology('urbanarea');
| |
| </source>
| |
| | |
| <source lang=sql>
| |
| SELECT * from topology.topology;
| |
| </source>
| |
| | |
| <pre>
| |
| id | name | srid | precision
| |
| ----+-----------+------+-----------
| |
| 1 | urbanarea | -1 | 0
| |
| </pre>
| |
| | |
| \dt urbanarea.
| |
| | |
| <pre>
| |
| List of relations
| |
| Schema | Name | Type | Owner
| |
| -----------+-----------+-------+--------
| |
| urbanarea | edge_data | table | martin
| |
| urbanarea | face | table | martin
| |
| urbanarea | node | table | martin
| |
| urbanarea | relation | table | martin
| |
| </pre>
| |
| | |
| <pre>
| |
| \d urbanarea.node
| |
| Table "urbanarea.node"
| |
| Column | Type | Modifiers
| |
| -----------------+----------+------------------------------------------------------------------
| |
| node_id | integer | not null default nextval('urbanarea.node_node_id_seq'::regclass)
| |
| containing_face | integer |
| |
| geom | geometry |
| |
| Indexes:
| |
| "node_primary_key" PRIMARY KEY, btree (node_id)
| |
| "node_gist" gist (geom)
| |
| Check constraints:
| |
| "enforce_dims_geom" CHECK (st_ndims(geom) = 2)
| |
| "enforce_geotype_geom" CHECK (geometrytype(geom) = 'POINT'::text OR geom IS NULL)
| |
| "enforce_srid_geom" CHECK (st_srid(geom) = (-1))
| |
| Foreign-key constraints:
| |
| "face_exists" FOREIGN KEY (containing_face) REFERENCES urbanarea.face(face_id)
| |
| Referenced by:
| |
| TABLE "urbanarea.edge_data" CONSTRAINT "end_node_exists" FOREIGN KEY (end_node) REFERENCES urbanarea.node(node_id)
| |
| TABLE "urbanarea.edge_data" CONSTRAINT "start_node_exists" FOREIGN KEY (start_node) REFERENCES urbanarea.node(node_id)
| |
| | |
| \d urbanarea.edge_data
| |
| Table "urbanarea.edge_data"
| |
| Column | Type | Modifiers
| |
| ---------------------+----------+-----------------------------------------------------------------------
| |
| edge_id | integer | not null default nextval('urbanarea.edge_data_edge_id_seq'::regclass)
| |
| start_node | integer | not null
| |
| end_node | integer | not null
| |
| next_left_edge | integer | not null
| |
| abs_next_left_edge | integer | not null
| |
| next_right_edge | integer | not null
| |
| abs_next_right_edge | integer | not null
| |
| left_face | integer | not null
| |
| right_face | integer | not null
| |
| geom | geometry |
| |
| Indexes:
| |
| "edge_data_pkey" PRIMARY KEY, btree (edge_id)
| |
| "edge_gist" gist (geom)
| |
| "edge_left_face_idx" btree (left_face)
| |
| "edge_right_face_idx" btree (right_face)
| |
| Check constraints:
| |
| "enforce_dims_geom" CHECK (st_ndims(geom) = 2)
| |
| "enforce_geotype_geom" CHECK (geometrytype(geom) = 'LINESTRING'::text OR geom IS NULL)
| |
| "enforce_srid_geom" CHECK (st_srid(geom) = (-1))
| |
| Foreign-key constraints:
| |
| "end_node_exists" FOREIGN KEY (end_node) REFERENCES urbanarea.node(node_id)
| |
| "left_face_exists" FOREIGN KEY (left_face) REFERENCES urbanarea.face(face_id)
| |
| "next_left_edge_exists" FOREIGN KEY (abs_next_left_edge) REFERENCES urbanarea.edge_data(edge_id) DEFERRABLE INITIALLY DEFERRED
| |
| "next_right_edge_exists" FOREIGN KEY (abs_next_right_edge) REFERENCES urbanarea.edge_data(edge_id) DEFERRABLE INITIALLY DEFERRED
| |
| "right_face_exists" FOREIGN KEY (right_face) REFERENCES urbanarea.face(face_id)
| |
| "start_node_exists" FOREIGN KEY (start_node) REFERENCES urbanarea.node(node_id)
| |
| Referenced by:
| |
| TABLE "urbanarea.edge_data" CONSTRAINT "next_left_edge_exists" FOREIGN KEY (abs_next_left_edge) REFERENCES urbanarea.edge_data(edge_id) DEFERRABLE INITIALLY DEFERRED
| |
| TABLE "urbanarea.edge_data" CONSTRAINT "next_right_edge_exists" FOREIGN KEY (abs_next_right_edge) REFERENCES urbanarea.edge_data(edge_id) DEFERRABLE INITIALLY DEFERRED
| |
| | |
| \d urbanarea.face
| |
| Table "urbanarea.face"
| |
| Column | Type | Modifiers
| |
| ---------+----------+------------------------------------------------------------------
| |
| face_id | integer | not null default nextval('urbanarea.face_face_id_seq'::regclass)
| |
| mbr | geometry |
| |
| Indexes:
| |
| "face_primary_key" PRIMARY KEY, btree (face_id)
| |
| "face_gist" gist (mbr)
| |
| Check constraints:
| |
| "enforce_dims_mbr" CHECK (st_ndims(mbr) = 2)
| |
| "enforce_geotype_mbr" CHECK (geometrytype(mbr) = 'POLYGON'::text OR mbr IS NULL)
| |
| "enforce_srid_mbr" CHECK (st_srid(mbr) = (-1))
| |
| Referenced by:
| |
| TABLE "urbanarea.node" CONSTRAINT "face_exists" FOREIGN KEY (containing_face) REFERENCES urbanarea.face(face_id)
| |
| TABLE "urbanarea.edge_data" CONSTRAINT "left_face_exists" FOREIGN KEY (left_face) REFERENCES urbanarea.face(face_id)
| |
| TABLE "urbanarea.edge_data" CONSTRAINT "right_face_exists" FOREIGN KEY (right_face) REFERENCES urbanarea.face(face_id)
| |
| </pre>
| |
| == Externí odkazy ==
| |
| | |
| * [http://2010.foss4g.org/presentations/3555.pdf State of the art of FOSS4G for topology and network analysis]
| |
| * [http://www.postgis.org/documentation/manual-svn/Topology.html PostGIS 2.0 Topology section of manual]
| |
| | |
| {{Databáze}}
| |
| {{GIS}}
| |
| {{GFOSS}}
| |