AddFace, minor additions to other functions and note about dependencies on GEOS 3.3

git-svn-id: http://svn.osgeo.org/postgis/trunk@6629 b70326c6-7e19-0410-871a-916f4a2858ee
This commit is contained in:
Regina Obe 2011-01-15 14:33:51 +00:00
parent c635eadddc
commit 8e30bfb742

View file

@ -8,7 +8,7 @@
<para>Details of this project can be found at <ulink url="http://trac.osgeo.org/postgis/wiki/UsersWikiPostgisTopology">PostGIS Tology Wiki</ulink></para>
<para>All functions and tables associated with this module are installed in a schema called <varname>topology</varname>.</para>
<para>Functions that are defined in SQL/MM standard are prefixed with ST_ and functions specific to PostGIS are not prefixed.</para>
<para>To build PostGIS 2.0 with topology support, compile with the --with-topology option as described in <xref linkend="postgis_installation"/></para>
<para>To build PostGIS 2.0 with topology support, compile with the --with-topology option as described in <xref linkend="postgis_installation"/>. Some functions depend on GEOS 3.3+ so you should compile with GEOS 3.3+ to fully utilize the topology support.</para>
<sect1 id="Topology_Types">
<sect1info>
@ -480,13 +480,14 @@ face without edges | 0 |
<refsection>
<title>Description</title>
<para>Adds an edge to the edge table and associated nodes to the nodes table of the specified <varname>toponame</varname> schema using the specified linestring geometry and returns the edgeid of the new record.</para>
<para>Adds an edge to the edge table and associated nodes to the nodes table of the specified <varname>toponame</varname> schema using the specified linestring geometry and returns the edgeid of the new record.
The newly added edge has "universe" face on both sides and links to itself.</para>
<note><para>If the <varname>aline</varname> geometry crosses an existing linestring edge, or intersects an existing not at the endpoints, then an error is thrown and the edge is not added.</para></note>
<note><para>The geometry of <varname>aline</varname> must be have the same <varname>srid</varname> as defined for the topology otherwise an invalid spatial reference sys error will be thrown.</para></note>
<!-- use this format if new function -->
<para>Availability: 2.0.0</para>
<para>Availability: 2.0.0 requires GEOS &gt;= 3.3.0.</para>
</refsection>
@ -517,17 +518,77 @@ edgeid
</refsection>
</refentry>
<refentry id="AddNode">
<refentry id="AddEdge">
<refnamediv>
<refname>AddNode</refname>
<refname>AddEdge</refname>
<refpurpose>Adds a point node to the nodes table in the specified topology schema and returns the nodeid of new node. If point already exists as node, the existing nodeid is returned.</refpurpose>
<refpurpose>Adds a linestring edge to the edge table and associated nodes to the point nodes table of the specified topology schema using the specified linestring geometry and returns the edgeid of the new record.</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcprototype>
<funcdef>integer <function>AddNode</function></funcdef>
<funcdef>integer <function>AddEdge</function></funcdef>
<paramdef><type>varchar </type> <parameter>toponame</parameter></paramdef>
<paramdef><type>geometry </type> <parameter>aline</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsection>
<title>Description</title>
<para>Adds an edge to the edge table and associated nodes to the nodes table of the specified <varname>toponame</varname> schema using the specified linestring geometry and returns the edgeid of the new record.
The newly added edge has "universe" face on both sides and links to itself.</para>
<note><para>If the <varname>aline</varname> geometry crosses an existing linestring edge, or intersects an existing not at the endpoints, then an error is thrown and the edge is not added.</para></note>
<note><para>The geometry of <varname>aline</varname> must be have the same <varname>srid</varname> as defined for the topology otherwise an invalid spatial reference sys error will be thrown.</para></note>
<!-- use this format if new function -->
<para>Availability: 2.0.0 requires GEOS &gt;= 3.3.0.</para>
</refsection>
<refsection>
<title>Examples</title>
<programlisting>SELECT topology.AddEdge('ma_topo', ST_GeomFromText('LINESTRING(227575.8 893917.2,227591.9 893900.4)', 26986) ) As edgeid;
-- result-
edgeid
--------
1
SELECT topology.AddEdge('ma_topo', ST_GeomFromText('LINESTRING(227591.9 893900.4,227622.6 893844.2,227641.6 893816.5,227704.5 893778.5)', 26986) ) As edgeid;
-- result --
edgeid
--------
2
SELECT topology.AddEdge('ma_topo', ST_GeomFromText('LINESTRING(227591.2 893900, 227591.9 893900.4,227704.5 893778.5)', 26986) ) As edgeid;
-- gives error --
ERROR: Edge intersects (not on endpoints) with existing edge 1
</programlisting>
</refsection>
<!-- Optionally add a "See Also" section -->
<refsection>
<title>See Also</title>
<para><xref linkend="CreateTopology"/></para>
</refsection>
</refentry>
<refentry id="AddFace">
<refnamediv>
<refname>AddFace</refname>
<refpurpose>Adds a polygon to the faces table in the specified topology schema and returns the faceid of new face.
If face already exists the id of the existing face is returned. Edges of the polygon must already otherwise an error is thrown.</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis>
<funcprototype>
<funcdef>integer <function>AddFace</function></funcdef>
<paramdef><type>varchar </type> <parameter>toponame</parameter></paramdef>
<paramdef><type>geometry </type> <parameter>apoint</parameter></paramdef>
</funcprototype>
@ -537,8 +598,9 @@ edgeid
<refsection>
<title>Description</title>
<para>Adds a point node to the nodes table in the specified topology schema. The <xref linkend="AddEdge" /> function automatically adds start and end points of an edge when called so not necessary to explicitly add nodes of an edge.</para>
<note><para>If the <varname>apoint</varname> geometry already exists as a node, the node is not added but the existing nodeid is returned.</para></note>
<para>Add a face primitive to a topology and get it's identifier. For a newly added face, its edges will be appropriately linked (marked as left-face or right-face).</para>
<para>The target topology is assumed to be valid (containing no self-intersecting edges). An exception is raised if: The polygon boundary is not fully defined by existing edges or the polygon overlaps an existing face.</para>
<note><para>If the <varname>apolygon</varname> geometry already exists as a face the face id of the existing face is returned.</para></note>
<!-- use this format if new function -->
<para>Availability: 2.0.0</para>
@ -547,14 +609,38 @@ edgeid
<refsection>
<title>Examples</title>
<programlisting>SELECT topology.AddNode('ma_topo', ST_GeomFromText('POINT(227641.6 893816.5)', 26986) ) As nodeid;
SELECT topology.AddEdge('ma_topo', ST_GeomFromText('LINESTRING(227591.9 893900.4,227622.6 893844.2,227641.6 893816.5,227704.5 893778.5)', 26986) ) As edgeid;
<programlisting>
-- first add the edges we use generate_series as an iterator (the below will only work for polygons with &lt; 10000 points because of our max in gs)
SELECT topology.AddEdge('ma_topo', ST_MakeLine(ST_PointN(geom,i), ST_PointN(geom, i + 1) )) As edgeid
FROM (SELECT ST_NPoints(geom) AS npt, geom
FROM
(SELECT ST_Boundary(ST_GeomFromText('POLYGON((234896.5 899456.7,234914 899436.4,234946.6 899356.9,234872.5 899328.7,234891 899285.4,234992.5 899145,
234890.6 899069,234755.2 899255.4,234612.7 899379.4,234776.9 899563.7,234896.5 899456.7))', 26986) ) As geom
) As geoms) As facen CROSS JOIN generate_series(1,10000) As i
WHERE i &lt; npt;
-- result --
nodeid
edgeid
--------
4
3
4
5
6
7
8
9
10
11
12
(10 rows)
-- then add the face -
SELECT topology.AddFace('ma_topo',
ST_GeomFromText('POLYGON((234896.5 899456.7,234914 899436.4,234946.6 899356.9,234872.5 899328.7,234891 899285.4,234992.5 899145,
234890.6 899069,234755.2 899255.4,234612.7 899379.4,234776.9 899563.7,234896.5 899456.7))', 26986) ) As faceid;
-- result --
faceid
--------
1
</programlisting>
</refsection>