Changes between Initial Version and Version 1 of UsersWikiPostgisTopology


Ignore:
Timestamp:
Apr 14, 2009, 11:19:22 AM (15 years ago)
Author:
pierre
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • UsersWikiPostgisTopology

    v1 v1  
     1= Postgis Topology =
     2
     3
     4PostGIS topology support is in pre-alpha stage.
     5It consists in a topology schema model and accessory functions.
     6
     7With topology support enabled you can store [wiki:UsersWikiTopologicalPrimitives topological elements],
     8define TopoGeometry objects as being composed by these elements,
     9convert TopoGeometry objects to simple [wiki:UsersWikiGeometryType Geometry] objects
     10to use all functions defined on the latter.
     11
     12Topological elements are Faces, Edges and Nodes.
     13
     14An entity-relationship diagram of the topology concepts can
     15be found in the CVS repository of PostGIS (head branch), under
     16the topology/ER directory.
     17
     18The CVS repository also contains initial code, being a set of
     19definitions and pl/pgsql functions. A README file therein contains
     20usage and test notes.
     21
     22= Enabling Postgis Topology =
     23
     24In order to enable postgis support you need to be equipped with the following:
     25
     26 * A schema-aware postgresql installation (7.3 and up)
     27 * PostGIS-1.1.x (current HEAD branch in CVS)
     28 * Geos-2.1 or up
     29
     30Move under the topology/ directory and run:
     31
     32{{{
     33$ make
     34$ psql -f topology.sql <your_test_database>
     35
     36}}}
     37
     38No C libs involved so far, so no need to make install.
     39
     40To uninstall/disable just drop the 'topology' schema. It contains
     41all the objects installed by the topology.sql script (remember to cascade).
     42
     43= Creating a Topology =
     44
     45Topology data are stored in named SCHEMAs, where the topology
     46name is the name of the SCHEMA containing its data.
     47
     48A catalogue of avalable topologies is kept under the
     49"topology"."topology" table.
     50
     51To create/destroy a topology:
     52
     53{{{
     54SELECT topology.CreateTopology(name, [srid], [tolerance [srid]], [tolerance]);
     55SELECT topology.DropTopology(name);
     56
     57}}}
     58
     59
     60== Loading Topology data ==
     61
     62To load topology data in a topology you can use INSERT
     63statements filling up the Edge, Node and Face relations
     64under your topology schema:
     65
     66
     67 * Edge
     68  * edge_id integer PRIMARY KEY
     69  * start_node integer REFERENCES Node.node_id)
     70  * end_node integer REFERENCES Node.node_id)
     71  * next_left_edge integer REFERENCES abs(Edge.edge_id)
     72  * next_right_edge integer REFERENCES abs(Edge.edge_id)
     73  * left_face integer REFERENCES Face.face_id
     74  * right_face integer REFERENCES Face.face_id
     75  * geom geometry ( a linestring )
     76
     77
     78 * Node
     79  * node_id integer PRIMARY KEY
     80  * containing_face integer REFERENCES Face.face_id
     81  * geom geometry ( a point )
     82
     83 * Face
     84  * face_id integer PRIMARY KEY
     85  * mbr box2d ( can be NULL )
     86
     87Details on semantic are contained in the SQL/MM specification, which
     88this implementation follows as for these views structure.
     89
     90== Validating Topology ==
     91
     92To verify validity of a topology:
     93
     94{{{
     95SELECT * FROM topology.ValidateTopology(name);
     96
     97}}}
     98
     99The return set will contain references to elements involved in the invalidity.
     100
     101== Editing a Topology ==
     102
     103See TopologyEditing
     104
     105= Working with !TopoGeometry objects =
     106
     107See CreatingTopoGeometryObjects
     108
     109== Getting simple Geometry values from !TopoGeometry objects ==
     110
     111You currently need to explicit call the TopoGeometry=>Geometry
     112cast function. This will probably be made implicit when the
     113code is more tested:
     114
     115{{{
     116SELECT topology.Geometry(TopoGeometry);
     117
     118}}}
     119
     120= Testing Topology implementation =
     121
     122Tests are included under the topology/test/ directory.
     123Run make w/out args to see a list of supported targets.