mirror of
https://git.osgeo.org/gitea/postgis/postgis
synced 2024-10-23 16:42:35 +00:00
Snap new lines over existing nodes (#1654)
Also add Salvatore to the list of testing heroes :) git-svn-id: http://svn.osgeo.org/postgis/trunk@9409 b70326c6-7e19-0410-871a-916f4a2858ee
This commit is contained in:
parent
2aa8da7e1f
commit
bcf0caf894
1
NEWS
1
NEWS
|
@ -10,6 +10,7 @@ PostGIS 2.0.0beta1
|
|||
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)
|
||||
|
|
|
@ -838,7 +838,7 @@ BEGIN
|
|||
|
||||
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);
|
||||
|
@ -864,29 +864,45 @@ BEGIN
|
|||
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 'Split: %', ST_AsText(noded);
|
||||
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);
|
||||
#endif
|
||||
END IF; -- }
|
||||
|
||||
-- 3. For each (now-noded) segment, insert an edge
|
||||
FOR rec IN SELECT (ST_Dump(noded)).geom LOOP
|
||||
|
||||
|
|
|
@ -189,6 +189,19 @@ SELECT '#1650.3', TopoGeo_addLineString('city_data',
|
|||
, 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');
|
||||
|
|
|
@ -149,4 +149,12 @@ N|65|0|POINT(0 0)
|
|||
#1650.3|66
|
||||
N|66||POINT(10 0)
|
||||
E|66|sn65|en66
|
||||
#1654.1|N|67
|
||||
N|67|0|POINT(0 0)
|
||||
#1654.2|67
|
||||
#1654.2|68
|
||||
N|68||POINT(-10 1)
|
||||
N|69||POINT(10 1)
|
||||
E|67|sn68|en67
|
||||
E|68|sn67|en69
|
||||
Topology 'city_data' dropped
|
||||
|
|
Loading…
Reference in a new issue