Opened 11 years ago
Closed 11 years ago
#649 closed defect (fixed)
ST_Snap crashes on some inputs
Reported by: | robe | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 3.4.1 |
Component: | Default | Version: | 3.4.0 |
Severity: | Unassigned | Keywords: | |
Cc: | history |
Description
This was logged as an issue in PostGIS at:
http://trac.osgeo.org/postgis/ticket/2426
Doesn't seem to be an issue in 3.3
SELECT ST_Snap('POLYGON Z ((-71.1319 42.2512 0,-71.1318 42.2511 20,-71.1317 42.2511 -20,-71.1317 42.251 5,-71.1317 42.2509 4,-71.132 42.2511 6,-71.1319 42.2512 30))'::geometry, 'GEOMETRYCOLLECTION Z (MULTIPOLYGON Z (((-71.0821 42.3036 2,-71.0822 42.3036 2,-71.082 42.3038 2,-71.0819 42.3037 2,-71.0821 42.3036 2))),POLYGON Z ((-71.1261 42.2703 1,-71.1257 42.2703 1,-71.1257 42.2701 1,-71.126 42.2701 1,-71.1261 42.2702 1,-71.1261 42.2703 1)))'::geometry, 0.5)
Just in case that doesn't crash for you, the original I was trying it from was a statement generated by the PostGIS garden monkey script.
{{{SELECT ST_Snap(foo1.the_geom, foo2.the_geom, 0.5) As result, ST_AsText(foo1.the_geom) As ref1_geom, ST_AsText(foo2.the_geom) As ref2_geom
FROM ((SELECT geom As the_geom
FROM (VALUES ( ST_GeomFromEWKT('SRID=4326;POLYGONM((-71.1319 42.2503 1,-71.132 42.2502 3,-71.1323 42.2504 -2,-71.1322 42.2505 1,-71.1319 42.2503 0))') ),
( ST_GeomFromEWKT('SRID=4326;POLYGONM((-71.1319 42.2512 0,-71.1318 42.2511 20,-71.1317 42.2511 -20,-71.1317 42.251 5,-71.1317 42.2509 4,-71.132 42.2511 6,-71.1319 42.2512 30))') )
) As g(geom))) As foo1 CROSS JOIN ((SELECT ST_Collect(geom) As the_geom FROM (VALUES ( ST_GeomFromEWKT('SRID=4326;MULTIPOLYGON(((-71.0821 42.3036 2,-71.0822 42.3036 2,-71.082 42.3038 2,-71.0819 42.3037 2,-71.0821 42.3036 2)))') ),
( ST_GeomFromEWKT('SRID=4326;POLYGON((-71.1261 42.2703 1,-71.1257 42.2703 1,-71.1257 42.2701 1,-71.126 42.2701 1,-71.1261 42.2702 1,-71.1261 42.2703 1))') ) ) As g(geom) CROSS JOIN generate_series(1,3) As i GROUP BY i )) As foo2 LIMIT 2;
}}}
Change History (9)
comment:3 by , 11 years ago
Can you reduce this down to the 2 geometries and 1 double inputs to GEOSSnap ?
comment:4 by , 11 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
I can't reproduce any problem with GEOS and that input.
comment:5 by , 11 years ago
GEOS answer (valgrind clean):
POLYGON ((-71.0819 42.3037, -71.13200000000001 42.2502, -71.1323 42.2504, -71.126 42.2701, -71.12609999999999 42.2702, -71.12609999999999 42.2703, -71.12569999999999 42.2701, -71.12569999999999 42.2703, -71.0822 42.3036, -71.0821 42.3036, -71.08199999999999 42.3038, -71.0819 42.3037))
comment:6 by , 11 years ago
Resolution: | invalid |
---|---|
Status: | closed → reopened |
Reopening as further info from the PostGIS ticket suggest there's actually a bug in LineStringSnapper.cpp line 349
comment:7 by , 11 years ago
Bingo, the actual offending input is:
A: LINESTRING(-71.1317 42.2511,-71.1317 42.251,-71.1317 42.2509) B: MULTIPOINT(-71.1261 42.2703,-71.1257 42.2703,-71.1261 42.2702)
Assertion failing:
snap/LineStringSnapper.cpp:349: void geos::operation::overlay::snap::LineStringSnapper::snapSegments(geos::geom::CoordinateList&, const ConstVect&): Assertion `pf != 0.0' failed.
comment:8 by , 11 years ago
Simplified input for A:
A: LINESTRING(-71.1317 42.2511,-71.1317 42.2509)
comment:9 by , 11 years ago
Cc: | added |
---|---|
Resolution: | → fixed |
Status: | reopened → closed |