Opened 7 years ago
Closed 6 years ago
#3914 closed defect (wontfix)
ERROR: XX000: SQL/MM Spatial exception - geometry crosses edge 3051
Reported by: | Lars Aksel Opsahl | Owned by: | strk |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 2.5.0 |
Component: | topology | Version: | master |
Keywords: | Cc: |
Description
The problem I am working on is described in https://trac.osgeo.org/postgis/ticket/3838 , but basically what I do is that I use Postgis Topology to merge updates updates from images into old vector dataset.
I have forked out Postgis to https://github.com/larsop/postgis today so I can make tests that be pulled down when testing updates.
This is output from PostGIS_Full_Version() POSTGIS="2.5.0dev r16058" [EXTENSION] PGSQL="96" GEOS="3.6.1-CAPI-1.10.1 r0" SFCGAL="1.3.0" PROJ="Rel. 4.9.3, 15 August 2016" GDAL="GDAL 1.11.5, released 2016/07/01" LIBXML="2.9.0" LIBJSON="0.12" TOPOLOGY RASTER
Attachments (3)
Change History (16)
by , 7 years ago
Attachment: | Screen Shot 2017-10-25 at 07.20.26.png added |
---|
by , 7 years ago
Attachment: | Screen Shot 2017-10-25 at 13.31.19.png added |
---|
Here is an overview of the two datasets (the yellow is old data, the light green is new data from an image)
comment:1 by , 7 years ago
I pushed falling test to https://github.com/larsop/postgis/commit/7c6ce675640eb6011c8d786aa4c4a4bc341f02a7 called snapto_tc .
by , 7 years ago
Attachment: | Screen Shot 2017-10-25 at 13.57.50.png added |
---|
Here is picture of the error in tc1. The red parts of the green fails to added to a data set with purpur lines
comment:2 by , 7 years ago
I have simplified the test at https://github.com/larsop/postgis/blob/svn-trunk/topology/test/regress/snapto_tc1.sql
I have also made a new test https://github.com/larsop/postgis/blob/svn-trunk/topology/test/regress/snapto_tc2.sql where I have broken the failing linestring into single line pieces and then I am able to add the data without any errors.
comment:3 by , 7 years ago
Here is a new test https://github.com/larsop/postgis/blob/svn-trunk/topology/test/regress/snapto_tc3.sql where there I have two almost parallel lines and then I add a crossing line and that fails with a error. This case can be solved by either increase tolerance level when adding the first lines or decrease tolerance level when adding the last line. But the main problem with that approach is that we add need the original data with a high tolerance level and the updated data with a lower tolerance level because we want to snapto the original lines if possible.
comment:4 by , 7 years ago
Why is this code working ok ?
select DropTopology('test_snapto'); select CreateTopology('test_snapto'); select TopoGeo_addLinestring('test_snapto','LINESTRING(609285.46 6549990.58,609277.63 6549983.87)',0); SELECT ST_Length(geom) from test_snapto.edge_data; select TopoGeo_addLinestring('test_snapto','LINESTRING(609281.0371 6549986.79,609292 6549984)',2);
And not this, where i add a new linstrings and then removes it, before adding the last line string ?
select DropTopology('test_snapto'); select CreateTopology('test_snapto'); select TopoGeo_addLinestring('test_snapto','LINESTRING(609285.46 6549990.58,609277.63 6549983.87)',0); select TopoGeo_addLinestring('test_snapto','LINESTRING(609277.63 6549983.87,609281.0371 6549986.79)',0); SELECT ST_Length(geom) from test_snapto.edge_data; select ST_RemEdgeModFace('test_snapto', 2); SELECT ST_Length(geom) from test_snapto.edge_data; select TopoGeo_addLinestring('test_snapto','LINESTRING(609281.0371 6549986.79,609292 6549984)',2);
comment:5 by , 7 years ago
Component: | postgis → topology |
---|---|
Milestone: | → PostGIS 2.4.2 |
Owner: | changed from | to
comment:6 by , 7 years ago
I guess the first addition introduces a node, which is not removed by removing the edge. Check with QGIS TopoViewer, is very helpful for debugging PostGIS Topology.
comment:7 by , 7 years ago
Thanks thats correct, when I added ST_RemoveIsoNode('test_snapto', 3), then the code worked ok.
Is that a bug in ST_RemEdgeNewFace or is it suppose to be done by the code calling is ST_RemEdgeNewFace as below ?
select DropTopology('test_snapto'); select CreateTopology('test_snapto'); select TopoGeo_addLinestring('test_snapto','LINESTRING(609285.46 6549990.58,609277.63 6549983.87)',0); select TopoGeo_addLinestring('test_snapto','LINESTRING(609277.63 6549983.87,609281.0371 6549986.79)',0); select ST_RemEdgeNewFace('test_snapto', 2); select ST_RemoveIsoNode('test_snapto', 3); select TopoGeo_addLinestring('test_snapto','LINESTRING(609281.0371 6549986.79,609292 6549984)',2);
comment:8 by , 7 years ago
I now got the this test to fail when having only one edge existing in the database from before.
select CreateTopology('test_snapto'); select TopoGeo_addLinestring('test_snapto','LINESTRING(609285.46 6549990.58,609277.63 6549983.87,609281.0371 6549986.79)',0); select TopoGeo_addLinestring('test_snapto','LINESTRING(609281.0374 6549987.9,609292 6549984)',2); ERROR: XX000: SQL/MM Spatial exception - geometry crosses edge 1
comment:9 by , 7 years ago
Knut a co worker of mee commented that the first line in the example above has a spike. Postgis says the line is valid and simple .
If I remove the spike the code works ok in Postgis Topology.
select CreateTopology('test_snapto'); select TopoGeo_addLinestring('test_snapto','LINESTRING(609285.46 6549990.58,609281.0371 6549986.79,609277.63 6549983.87)',0); select TopoGeo_addLinestring('test_snapto','LINESTRING(609281.0371 6549986.79,609292 6549984)',2);
comment:10 by , 7 years ago
Milestone: | PostGIS 2.4.2 → PostGIS 2.4.3 |
---|
comment:11 by , 7 years ago
Milestone: | PostGIS 2.4.3 → PostGIS 2.4.4 |
---|
comment:12 by , 7 years ago
Milestone: | PostGIS 2.4.4 → PostGIS 2.5.0 |
---|
comment:13 by , 6 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
I'm all confused reading this. Is there anything that can be done here? strk I'm marking this as a won't fix. Feel free to reopen if you can actually do anything about it. Sounds like you have no plans to.
Here is a big picture of the two datasets