Andrea Peri - Lots of testing on topology, checking for correctness
Andreas Forø Tollefsen - raster testing
Chris English - topology stress testing loader functions
+ Salvatore Larosa - Lots of topology testing
Brian Hamlin - Benchmarking
(also experimental experimental branches
before they are folded into core)
snapped := ST_Snap(noded, iedges, tol);
#ifdef POSTGIS_TOPOLOGY_DEBUG
- RAISE DEBUG 'Snapped: %', ST_AsText(snapped);
+ RAISE DEBUG 'Snapped to edges: %', ST_AsText(snapped);
#endif
noded := ST_Difference(snapped, iedges);
END IF;
-- 2.1. Node with existing nodes within tol
+ -- TODO: check if we should be only considering _isolated_ nodes!
sql := 'WITH nearby AS ( SELECT n.geom FROM '
|| quote_ident(atopology)
|| '.node n WHERE ST_DWithin(n.geom, '
|| quote_literal(noded::text)
|| '::geometry, '
- || tol || ') ) SELECT (st_dump(st_unaryunion(st_collect(geom)))).geom FROM nearby;';
+ || tol || ') ) SELECT st_collect(geom) FROM nearby;';
#ifdef POSTGIS_TOPOLOGY_DEBUG
RAISE DEBUG '%', sql;
#endif
- FOR rec IN EXECUTE sql
- LOOP
- -- Use the node to split edges
- SELECT ST_Collect(geom)
- FROM ST_Dump(ST_Split(noded, rec.geom))
- INTO STRICT noded;
+ EXECUTE sql INTO inodes;
+
+ IF inodes IS NOT NULL THEN -- {
#ifdef POSTGIS_TOPOLOGY_DEBUG
- RAISE DEBUG 'Split by %: %', ST_AsText(rec.geom), ST_AsText(noded);
+ RAISE DEBUG 'Intersecting nodes: %', ST_AsText(inodes);
#endif
- END LOOP;
+
+ -- TODO: consider snapping once against all elements
+ --- (rather than once with edges and once with nodes)
+ noded := ST_Snap(noded, inodes, tol);
+#ifdef POSTGIS_TOPOLOGY_DEBUG
+ RAISE DEBUG 'Snapped to nodes: %', ST_AsText(noded);
+#endif
+
+ FOR rec IN SELECT (ST_Dump(inodes)).*
+ LOOP
+ -- Use the node to split edges
+ SELECT ST_Collect(geom)
+ FROM ST_Dump(ST_Split(noded, rec.geom))
+ INTO STRICT noded;
+#ifdef POSTGIS_TOPOLOGY_DEBUG
+ RAISE DEBUG 'Split by %: %', ST_AsText(rec.geom), ST_AsText(noded);
+#endif
+ END LOOP;
#ifdef POSTGIS_TOPOLOGY_DEBUG
- RAISE DEBUG 'Split: %', ST_AsText(noded);
+ RAISE DEBUG 'Split: %', ST_AsText(noded);
#endif
+ END IF; -- }
-- 3. For each (now-noded) segment, insert an edge
FOR rec IN SELECT (ST_Dump(noded)).geom LOOP
, 2) ORDER BY 2;
SELECT check_changes();
+-- Test snapping of line over a node( http://trac.osgeo.org/postgis/ticket/??? )
+
+DELETE FROM city_data.edge_data; DELETE FROM city_data.node;
+DELETE FROM city_data.face where face_id > 0;
+
+SELECT '#1654.1', 'N', ST_AddIsoNode('city_data', 0, 'POINT(0 0)');
+SELECT check_changes();
+SELECT '#1654.2', TopoGeo_addLineString('city_data',
+ 'LINESTRING(-10 1, 10 1)'
+, 2);
+SELECT check_changes();
+
+
-- Cleanups
DROP FUNCTION check_changes();
SELECT DropTopology('city_data');