Opened 6 years ago

Closed 6 years ago

#4016 closed defect (fixed)

tickets test fails with proj 5.0.0-rc2

Reported by: Bas Couwenberg Owned by: pramsey
Priority: medium Milestone: PostGIS 2.4.4
Component: postgis Version: 2.4.x
Keywords: Cc: Bas Couwenberg

Description

postgis 2.4.3 failed to build with proj 5.0.0-rc2 due to the tickets test failing:

*** /tmp/pg_virtualenv.38D232/log/postgresql-10-regress.log (last 100 lines) ***
              ST_AsText(g::geometry),
              ST_OrderingEquals(g::geometry, St_GeomFromText(ST_AsText(g::geometry))) FROM ( SELECT
        'CURVEPOLYGON (COMPOUNDCURVE(CIRCULARSTRING(0 0,1 1,1 0),(1 2,0 1)))'
        ::text as g ) as foo;
2018-02-09 16:38:58.449 UTC [16809] pbuilder@postgis_reg ERROR:  geometry requires more points
2018-02-09 16:38:58.449 UTC [16809] pbuilder@postgis_reg HINT:  "CURVEPOLYGON (COMPOUNDCURVE EMPTY)" <-- parse error at position 34 within geometry
2018-02-09 16:38:58.449 UTC [16809] pbuilder@postgis_reg STATEMENT:  SELECT g, 
              ST_AsText(g::geometry),
              ST_OrderingEquals(g::geometry, St_GeomFromText(ST_AsText(g::geometry))) FROM ( SELECT
        'CURVEPOLYGON (COMPOUNDCURVE EMPTY)'
        ::text as g ) as foo;
2018-02-09 16:38:58.449 UTC [16809] pbuilder@postgis_reg ERROR:  geometry contains non-closed rings
2018-02-09 16:38:58.449 UTC [16809] pbuilder@postgis_reg HINT:  "...RCULARSTRING(0 0,1 1,1 0),(1 0,0 1)))" <-- parse error at position 67 within geometry
2018-02-09 16:38:58.449 UTC [16809] pbuilder@postgis_reg STATEMENT:  SELECT g, 
              ST_AsText(g::geometry),
              ST_OrderingEquals(g::geometry, St_GeomFromText(ST_AsText(g::geometry))) FROM ( SELECT
        'CURVEPOLYGON (COMPOUNDCURVE(CIRCULARSTRING(0 0,1 1,1 0),(1 0,0 1)))'
        ::text as g ) as foo;
2018-02-09 16:38:58.454 UTC [16809] pbuilder@postgis_reg ERROR:  geometry contains non-closed rings
2018-02-09 16:38:58.454 UTC [16809] pbuilder@postgis_reg HINT:  "TRIANGLE ((1 2 3,4 5 6,7 8 9,1 2 0))" <-- parse error at position 37 within geometry
2018-02-09 16:38:58.454 UTC [16809] pbuilder@postgis_reg STATEMENT:  SELECT g,  
              ST_AsText(g::geometry),
              ST_OrderingEquals(g::geometry, St_GeomFromText(ST_AsText(g::geometry))) FROM ( SELECT
        'TRIANGLE ((1 2 3,4 5 6,7 8 9,1 2 0))'
        ::text as g ) as foo;
2018-02-09 16:38:58.455 UTC [16809] pbuilder@postgis_reg ERROR:  geometry contains non-closed rings
2018-02-09 16:38:58.455 UTC [16809] pbuilder@postgis_reg HINT:  "...0 0 0 1, 0 1 0 2, 1 1 0 3, 0 1 0 1)) " <-- parse error at position 88 within geometry
2018-02-09 16:38:58.455 UTC [16809] pbuilder@postgis_reg STATEMENT:  SELECT g,  
              ST_AsText(g::geometry),
              ST_OrderingEquals(g::geometry, St_GeomFromText(ST_AsText(g::geometry))) FROM ( SELECT
        'TIN ZM ( ((0 0 0 0, 0 0 1 0, 0 1 0 4, 0 0 0 0)), ((0 0 0 1, 0 1 0 2, 1 1 0 3, 0 1 0 1)) )'
        ::text as g ) as foo;
2018-02-09 16:38:58.644 UTC [16813] pbuilder@postgis_reg WARNING:  ST_Force_2d signature was deprecated in 2.1.0. Please use ST_Force2D
2018-02-09 16:38:58.644 UTC [16813] pbuilder@postgis_reg CONTEXT:  PL/pgSQL function _postgis_deprecate(text,text,text) line 14 at RAISE
        SQL function "st_force_2d" during startup
2018-02-09 16:38:58.645 UTC [16813] pbuilder@postgis_reg WARNING:  ST_Force_2d signature was deprecated in 2.1.0. Please use ST_Force2D
2018-02-09 16:38:58.645 UTC [16813] pbuilder@postgis_reg CONTEXT:  PL/pgSQL function _postgis_deprecate(text,text,text) line 14 at RAISE
        SQL function "st_force_2d" during startup
2018-02-09 16:38:58.645 UTC [16813] pbuilder@postgis_reg WARNING:  ST_Force_2d signature was deprecated in 2.1.0. Please use ST_Force2D
2018-02-09 16:38:58.645 UTC [16813] pbuilder@postgis_reg CONTEXT:  PL/pgSQL function _postgis_deprecate(text,text,text) line 14 at RAISE
        SQL function "st_force_2d" during startup
2018-02-09 16:38:58.650 UTC [16813] pbuilder@postgis_reg WARNING:  ST_Force_2d signature was deprecated in 2.1.0. Please use ST_Force2D
2018-02-09 16:38:58.650 UTC [16813] pbuilder@postgis_reg CONTEXT:  PL/pgSQL function _postgis_deprecate(text,text,text) line 14 at RAISE
        SQL function "st_force_2d" during startup
2018-02-09 16:38:58.650 UTC [16813] pbuilder@postgis_reg WARNING:  ST_Force_Collection signature was deprecated in 2.1.0. Please use ST_ForceCollection
2018-02-09 16:38:58.650 UTC [16813] pbuilder@postgis_reg CONTEXT:  PL/pgSQL function _postgis_deprecate(text,text,text) line 14 at RAISE
        SQL function "st_force_collection" during startup
2018-02-09 16:38:58.654 UTC [16813] pbuilder@postgis_reg WARNING:  ST_Force_2d signature was deprecated in 2.1.0. Please use ST_Force2D
2018-02-09 16:38:58.654 UTC [16813] pbuilder@postgis_reg CONTEXT:  PL/pgSQL function _postgis_deprecate(text,text,text) line 14 at RAISE
        SQL function "st_force_2d" during startup
2018-02-09 16:38:58.654 UTC [16813] pbuilder@postgis_reg WARNING:  ST_Force_Collection signature was deprecated in 2.1.0. Please use ST_ForceCollection
2018-02-09 16:38:58.654 UTC [16813] pbuilder@postgis_reg CONTEXT:  PL/pgSQL function _postgis_deprecate(text,text,text) line 14 at RAISE
        SQL function "st_force_collection" during startup
2018-02-09 16:39:18.262 UTC [16933] pbuilder@postgis_reg ERROR:  ST_OffsetCurve only works with LineStrings
2018-02-09 16:39:18.262 UTC [16933] pbuilder@postgis_reg STATEMENT:  SELECT 't0', ST_OffsetCurve('POINT(0 0)', 10);
2018-02-09 16:39:18.346 UTC [16945] pbuilder@postgis_reg ERROR:  Operation on mixed SRID geometries
2018-02-09 16:39:18.346 UTC [16945] pbuilder@postgis_reg STATEMENT:  select 't1', st_asewkt(st_sharedpaths(
          'SRID=10;LINESTRING(0 0, 10 0)', 'SRID=5;LINESTRING(0 0, 100 0)'
        ));
2018-02-09 16:39:18.348 UTC [16945] pbuilder@postgis_reg ERROR:  GEOSSharedPaths: IllegalArgumentException: Geometry is not lineal
2018-02-09 16:39:18.348 UTC [16945] pbuilder@postgis_reg STATEMENT:  select 't6', st_sharedpaths(
          '0101000020E6100000F771D98DE33826C00000000000004440'::geometry,
          '0103000020E61000000100000021000000F771D98DE33820C00000000000004E409610DB16675620C00EC34AD715B54D407AF7FF56CFAD20C008E817B00C6D4D40A8B32666C03B21C017D34B39A92A4D40C096A1DAC5FA21C03309329378F04C4050BE087388E322C06D501336B7C04C401412394E16ED23C061A149F23A9D4C402C7E04EB3A0D25C0A86740E260874C40F471D98DE33826C00000000000804C40BC65AE308C6427C0A86740E260874C40D5D179CDB08428C060A149F23A9D4C409A25AAA83E8E29C06C501336B7C04C402A4D114101772AC03209329378F04C4043308CB506362BC016D34B39A92A4D4072ECB2C4F7C32BC007E817B00C6D4D4057D3D704601B2CC00DC34AD715B54D40F771D98DE3382CC0FFFFFFFFFFFF4D4059D3D704601B2CC0F13CB528EA4A4E4076ECB2C4F7C32BC0F717E84FF3924E4049308CB506362BC0E82CB4C656D54E40324D114101772AC0CCF6CD6C870F4F40A325AAA83E8E29C093AFECC9483F4F40DFD179CDB08428C09F5EB60DC5624F40C665AE308C6427C05898BF1D9F784F40FD71D98DE33826C00000000000804F40347E04EB3A0D25C05898BF1D9F784F401B12394E16ED23C0A05EB60DC5624F4056BE087388E322C094AFECC9483F4F40C496A1DAC5FA21C0CEF6CD6C870F4F40ABB32666C03B21C0EA2CB4C656D54E407CF7FF56CFAD20C0F917E84FF3924E409710DB16675620C0F33CB528EA4A4E40F771D98DE33820C00000000000004E40'::geometry
        );
2018-02-09 16:39:18.367 UTC [16949] pbuilder@postgis_reg ERROR:  Operation on mixed SRID geometries
2018-02-09 16:39:18.367 UTC [16949] pbuilder@postgis_reg STATEMENT:  select 't1', st_asewkt(st_snap(
          'SRID=10;LINESTRING(0 0, 10 0)', 'SRID=5;LINESTRING(0 0, 100 0)', 0
        ));
2018-02-09 16:39:18.802 UTC [16965] pbuilder@postgis_reg ERROR:  GEOSRelate: Invalid boundary node rule 5
2018-02-09 16:39:18.802 UTC [16965] pbuilder@postgis_reg STATEMENT:  SELECT st_relate('POINT(0 0)', 'POINT(1 0)', 5);
2018-02-09 16:39:18.856 UTC [16973] pbuilder@postgis_reg ERROR:  lwgeom_subdivide: cannot subdivide to fewer than 8 vertices per output
2018-02-09 16:39:18.856 UTC [16973] pbuilder@postgis_reg STATEMENT:  SELECT '#3135', st_astext(ST_SubDivide(ST_GeomFromText('POLYGON((1 2,1 2,1 2,1 2))'), 2));
2018-02-09 16:39:18.993 UTC [16981] pbuilder@postgis_reg ERROR:  Tolerance must be a positive number.
2018-02-09 16:39:18.993 UTC [16981] pbuilder@postgis_reg CONTEXT:  SQL function "st_voronoipolygons" statement 1
2018-02-09 16:39:18.993 UTC [16981] pbuilder@postgis_reg STATEMENT:  SELECT 3,  ST_VoronoiPolygons('MULTIPOINT (0 0, 1 1, 2 2)', NULL);
2018-02-09 16:39:18.993 UTC [16981] pbuilder@postgis_reg ERROR:  Tolerance must be a positive number.
2018-02-09 16:39:18.993 UTC [16981] pbuilder@postgis_reg CONTEXT:  SQL function "st_voronoipolygons" statement 1
2018-02-09 16:39:18.993 UTC [16981] pbuilder@postgis_reg STATEMENT:  SELECT 5,  ST_VoronoiPolygons('MULTIPOINT (0 0, 1 1, 2 2)', -2);
2018-02-09 16:39:19.036 UTC [16989] pbuilder@postgis_reg ERROR:  Unable to find 'coordinates' in GeoJSON string
2018-02-09 16:39:19.036 UTC [16989] pbuilder@postgis_reg STATEMENT:  select '#1434.1',ST_GeomFromGeoJSON('{ "type": "Point", "crashme": [100.0, 0.0] }');
2018-02-09 16:39:19.037 UTC [16989] pbuilder@postgis_reg ERROR:  unexpected character (at offset 0)
2018-02-09 16:39:19.037 UTC [16989] pbuilder@postgis_reg STATEMENT:  select '#1434.2',ST_GeomFromGeoJSON('crashme');
2018-02-09 16:39:19.037 UTC [16989] pbuilder@postgis_reg ERROR:  unexpected end of data (at offset 0)
2018-02-09 16:39:19.037 UTC [16989] pbuilder@postgis_reg STATEMENT:  select '#1434.3',ST_GeomFromGeoJSON('');
2018-02-09 16:39:19.037 UTC [16989] pbuilder@postgis_reg ERROR:  invalid GeoJSON representation
2018-02-09 16:39:19.037 UTC [16989] pbuilder@postgis_reg STATEMENT:  select '#1434.4',ST_GeomFromGeoJSON('{}');
2018-02-09 16:39:19.037 UTC [16989] pbuilder@postgis_reg ERROR:  Too few ordinates in GeoJSON
2018-02-09 16:39:19.037 UTC [16989] pbuilder@postgis_reg STATEMENT:  select '#1434.5',ST_GeomFromGeoJSON('{"type":"Point","coordinates":[]}');
2018-02-09 16:39:19.037 UTC [16989] pbuilder@postgis_reg ERROR:  Too few ordinates in GeoJSON
2018-02-09 16:39:19.037 UTC [16989] pbuilder@postgis_reg STATEMENT:  select '#1434.6',ST_GeomFromGeoJSON('{"type":"MultiPoint","coordinates":[[]]}');
2018-02-09 16:39:19.037 UTC [16989] pbuilder@postgis_reg ERROR:  Unable to find 'coordinates' in GeoJSON string
2018-02-09 16:39:19.037 UTC [16989] pbuilder@postgis_reg STATEMENT:  select '#1434.7',ST_GeomFromGeoJSON('{"type":"MultiPoint"}');
2018-02-09 16:39:19.037 UTC [16989] pbuilder@postgis_reg ERROR:  Unable to find 'coordinates' in GeoJSON string
2018-02-09 16:39:19.037 UTC [16989] pbuilder@postgis_reg STATEMENT:  select '#1434.8',ST_GeomFromGeoJSON('{"type":"Point"}');
2018-02-09 16:39:19.038 UTC [16989] pbuilder@postgis_reg ERROR:  The 'coordinates' in GeoJSON ring are not an array
2018-02-09 16:39:19.038 UTC [16989] pbuilder@postgis_reg STATEMENT:  SELECT '#2697', ST_GeomFromGeoJSON('{"type":"Polygon","coordinates":[1]}');
2018-02-09 16:39:19.038 UTC [16989] pbuilder@postgis_reg ERROR:  The 'coordinates' in GeoJSON ring are not an array
2018-02-09 16:39:19.038 UTC [16989] pbuilder@postgis_reg STATEMENT:  SELECT '#2697', ST_GeomFromGeoJSON('{"type":"Polygon","coordinates":[1,1]}');
2018-02-09 16:39:20.076 UTC [17005] pbuilder@postgis_reg ERROR:  pgis_asmvt_transfn: parameter row cannot be other than a rowtype
2018-02-09 16:39:20.076 UTC [17005] pbuilder@postgis_reg STATEMENT:  SELECT encode(ST_AsMVT(1, 'test', 4096, 'geom'), 'base64');
Dropping cluster 10/regress ...
 ### /tmp/pgis_reg/test_91_diff ###
--- tickets_expected    2018-01-16 05:31:17.000000000 +0000
+++ /tmp/pgis_reg/test_91_out   2018-02-09 16:38:53.269350614 +0000
@@ -198,7 +198,7 @@
 #1578|f|f
 #1580.1|Point[S]
 ERROR:  transform: couldn't project point (180 90 0): tolerance condition error (-20)
-#1580.3|Point[S]
+ERROR:  transform: couldn't project point (0 0 0): tolerance condition error (-20)
 #1596.1|public.road_pg.roads_geom SRID:3395 TYPE:POINT DIMS:2 
 ERROR:  invalid SRID: 330000 not found in spatial_ref_sys
 #1596.3|3395
@@ -207,7 +207,7 @@
 NOTICE:  SRID value -1 converted to the officially unknown SRID value 0
 #1596.6|public.road_pg.roads_geom SRID changed to 0
 #1596.7|0
-#1596|Point[GS]
+ERROR:  transform: couldn't project point (-176 -22 0): tolerance condition error (-20)
 #1695|MULTIPOLYGON EMPTY
 #1697.1|0
 #1697.2|0
 ### end of log dumps ###

Attachments (1)

transform.c (1.1 KB ) - added by Algunenano 6 years ago.
transform minimal

Download all attachments as: .zip

Change History (10)

comment:1 by Algunenano, 6 years ago

Building everything from trunk:

I only get a single failing test (regress tickets):

--- tickets_expected	2018-01-15 10:55:27.401400461 +0100
+++ /tmp/pgis_reg/test_91_out	2018-02-13 17:40:16.223852028 +0100
@@ -198,7 +198,7 @@
 #1578|f|f
 #1580.1|Point[S]
 ERROR:  transform: couldn't project point (180 90 0): tolerance condition error (-20)
-#1580.3|Point[S]
+ERROR:  transform: couldn't project point (0 0 0): tolerance condition error (-20)
 #1596.1|public.road_pg.roads_geom SRID:3395 TYPE:POINT DIMS:2 
 ERROR:  invalid SRID: 330000 not found in spatial_ref_sys
 #1596.3|3395
@@ -207,7 +207,7 @@
 NOTICE:  SRID value -1 converted to the officially unknown SRID value 0
 #1596.6|public.road_pg.roads_geom SRID changed to 0
 #1596.7|0
-#1596|Point[GS]
+ERROR:  transform: couldn't project point (-176 -22 0): tolerance condition error (-20)
 #1695|MULTIPOLYGON EMPTY
 #1697.1|0
 #1697.2|0

The svn-2.4 branch is missing some compatibility fixes, at least for json-c and PG11 so I haven't been able to test it yet.

comment:2 by Bas Couwenberg, 6 years ago

Those are the same failures as on my system.

The queries in question:

select '#1580.3', ST_Summary(ST_Transform('SRID=4326;POINT(0 0)'::geometry, 3395));
-- #1596
WITH inp AS ( SELECT
 'POLYGON((-176 -22,-176 -21,-175 -21,-175 -22,-176 -22))'::geography as a,
 'POINT(-176 -22)'::geography as p
) SELECT '#1596', ST_Summary(ST_Intersection(a,p)) FROM inp;

comment:3 by Algunenano, 6 years ago

This is somewhat related to #1580 which is the ticket the test was created for.

I've solved it locally by resetting pj_errno to 0 after an error but I wonder if this behaviour change in proj is intended.

Here is the PR: https://github.com/postgis/postgis/pull/210. It should work with both PROJ 5 (tested with its current HEAD) and 4.9.3 (GH travis build).

in reply to:  3 comment:4 by Bas Couwenberg, 6 years ago

Replying to Algunenano:

I've solved it locally by resetting pj_errno to 0 after an error but I wonder if this behaviour change in proj is intended.

The proj developers should be able to answer that, please post your question on the list:

http://lists.maptools.org/pipermail/proj/2018-February/007990.html

by Algunenano, 6 years ago

Attachment: transform.c added

transform minimal

comment:5 by Algunenano, 6 years ago

I've tried to reproduce it with a minimal repro case (transform.c attached) but I haven't had any luck; it returns a different error (-14 instead of -20) and subsequent calls are not affected. I'll have to keep investigating.

comment:6 by komzpa, 6 years ago

In 16382:

pj_transform: Reset pj_errno after any error

Patch by Raúl Marín Rodríguez

Closes https://github.com/postgis/postgis/pull/210
References #4016

comment:7 by Algunenano, 6 years ago

Apparently the behaviour in proj 5 has changed and it's not resetting pj_errno when it resets the context errno. I've opened a PR there (https://github.com/OSGeo/proj.4/pull/808/files) so I'll keep this open to see if it gets merged and we can clean up the code a bit.

comment:8 by Algunenano, 6 years ago

The fix has been introduced before the final PROJ 5 released, so the hotfix isn't needed in PostGIS.

As I was already there, I've broken down the long error strings and simplified lwproj_from_string since there is already a proj function that does all that. PR to finally close the issue: https://github.com/postgis/postgis/pull/212

comment:9 by komzpa, 6 years ago

Resolution: fixed
Status: newclosed

In 16388:

PROJ: Cleanup point4d_transform and lwproj_from_string

Patch by Raúl Marín Rodríguez

Closes https://github.com/postgis/postgis/pull/212
Closes #4016

Note: See TracTickets for help on using tickets.