From: Regina Obe Date: Tue, 24 May 2011 03:03:41 +0000 (+0000) Subject: Document ST_ChangeEdgeGeom, revise function to confirm to new plpgsql coding standard... X-Git-Tag: 2.0.0alpha1~1597 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3905413dcbd0a279f8d19e6095d8d7a84670837a;p=postgis Document ST_ChangeEdgeGeom, revise function to confirm to new plpgsql coding standard. Get rid of redundant && check since its already encapsulated in ST_Intersects and ST_Within git-svn-id: http://svn.osgeo.org/postgis/trunk@7216 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/doc/extras_topology.xml b/doc/extras_topology.xml index f7a60e1c4..bf1667201 100644 --- a/doc/extras_topology.xml +++ b/doc/extras_topology.xml @@ -1606,6 +1606,57 @@ Updates all existing joined edges and relationships accordingly. + + + ST_ChangeEdgeGeom + + Changes the linestring that define the specified edge. Will raise an error if the start and end points are not the same as the original or the new linestring + crosses an existing edge (not add end points) or new linestring is not simple. + + + + + + integer ST_ChangeEdgeGeom + varchar atopology + integer anedge + geometry acurve + + + + + + Description + + Changes the linestring that defines the specified edge. Will raise an error if the start and end points are not the same as the original or the new linestring + crosses an existing edge (except at end points) or intersects another edge. + If any arguments are null, the given edge does not exist in the node table of the topology schema) , + the acurve is not a LINESTRING, the anode and anothernode are not the start + and endpoints of acurve then an error is thrown. + If the spatial reference system (srid) of the acurve geometry is not the same as the topology an exception is thrown. + If the new acurve is not simple, then an error is thrown. + + + Availability: 1.x + &sqlmm_compliant; SQL-MM: Topo-Geo and Topo-Net 3: Routine Details X.3.6 + + + + + Examples + SELECT topology.ST_ChangeEdgeGeom('ma_topo', 1, ST_GeomFromText('LINESTRING(227591.9 893900.4,227622.6 893844.3,227641.6 893816.6, + 227704.5 893778.5)', 26986) ); + ---- + Edge 1 changed + + + + + See Also + + + + ST_ModEdgeSplit @@ -1662,9 +1713,9 @@ SELECT topology.ST_ModEdgeSplit('ma_topo', 3, ST_SetSRID(ST_Point(227594,893910 See Also - - - + , + , + , diff --git a/topology/sql/sqlmm.sql b/topology/sql/sqlmm.sql index 30b6e69f8..462694c29 100644 --- a/topology/sql/sqlmm.sql +++ b/topology/sql/sqlmm.sql @@ -1721,13 +1721,10 @@ LANGUAGE 'plpgsql' VOLATILE; -- -- ST_ChangeEdgeGeom(atopology, anedge, acurve) -- -CREATE OR REPLACE FUNCTION topology.ST_ChangeEdgeGeom(varchar, integer, geometry) +CREATE OR REPLACE FUNCTION topology.ST_ChangeEdgeGeom(atopology varchar, anedge integer, acurve geometry) RETURNS TEXT AS $$ DECLARE - atopology ALIAS FOR $1; - anedge ALIAS FOR $2; - acurve ALIAS FOR $3; aface INTEGER; face GEOMETRY; snodegeom GEOMETRY; @@ -1809,8 +1806,7 @@ BEGIN -- FOR rec IN EXECUTE 'SELECT node_id FROM ' || quote_ident(atopology) || '.node - WHERE geom && ' || quote_literal(acurve::text) || '::geometry - AND ST_Within(geom, ' || quote_literal(acurve::text) || '::geometry)' + WHERE ST_Within(geom, ' || quote_literal(acurve::text) || '::geometry)' LOOP RAISE EXCEPTION 'SQL/MM Spatial exception - geometry crosses a node'; @@ -1822,8 +1818,6 @@ BEGIN FOR rec IN EXECUTE 'SELECT * FROM ' || quote_ident(atopology) || '.edge_data ' || ' WHERE edge_id != ' || anedge - || ' AND geom && ' - || quote_literal(acurve::text) || '::geometry ' || ' AND ST_Intersects(geom, ' || quote_literal(acurve::text) || '::geometry)' LOOP