Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#2912 closed defect (invalid)

rt_raster_gdal_polygonize: Couldn't create a OGR Datasource to store pols

Reported by: strk Owned by: Bborie Park
Priority: medium Milestone:
Component: raster Version: master
Keywords: invalid Cc:


I get these error messages causing failure of 3 regression tests:

rt_raster_gdal_polygonize: Couldn't create a OGR Datasource to store pols

When building against GDAL from the 1.11 branch (rev 27610)

failing tests are rt_addband, rt_polygon, rt_mapalgebrafctngb and rt_geos_relationships

The failure happens in trunk, didn't test in 2.1 branch yet

Change History (9)

comment:1 by Bborie Park, 8 years ago

Hmmmm. How strange. I haven't touched that code in a long time. Maybe something changed recently… I'll see how 2.0 plays.

comment:2 by strk, 8 years ago

Built against GDAL trunk (rev 27609) is ok. I'll try 1.11 again with a full rebuild.

comment:3 by strk, 8 years ago

Resolution: invalid
Status: newclosed

A clean rebuild fixed it, so this was invalid. Sorry for the noise.

comment:4 by strk, 8 years ago

So I found that these errors were due to setting skew to the requested output skew in gdal_warp for so called "default georeferenced" rasters. Similarly to what was done for scale by r12928

Here's the patch:

diff --git a/raster/rt_core/rt_warp.c b/raster/rt_core/rt_warp.c
index 10964c4..369eaf4 100644
--- a/raster/rt_core/rt_warp.c
+++ b/raster/rt_core/rt_warp.c
@@ -999,6 +999,8 @@ rt_raster rt_raster_gdal_warp(
                 *       I'm not sure the above division was needed */
                gt[1] = _scale[0] * 10;
                gt[5] = -1 * _scale[1] * 10;
+               gt[2] = _skew[0]; /* skew_x */
+               gt[4] = _skew[1]; /* skew_y */
                rt_raster_set_geotransform_matrix(rast, gt);
                rt_raster_set_srid(rast, SRID_UNKNOWN);

Without the patch, calling _st_gdalwarp with a skew results in the wrong skew being set to the output raster if the raster has the default georeference (like #2911 was for scale). I'm not sure if there's a public API to affect skew.

comment:5 by strk, 8 years ago

Resolution: invalid
Status: closedreopened

I'm reopening as I'm getting the error again, even with no further change in rt_warp.c and after a full rebuild. Bad dragons around.

comment:6 by strk, 8 years ago

Switching again to GDAL trunk and rebuilding postgis raster fixes the issue. Simply upgrading GDAL without rebuilding PostGIS does not fix it.

Maybe there's a compile-time switch changing behavior based on GDAL version ?

comment:7 by Bborie Park, 8 years ago

Keywords: invalid added
Resolution: invalid
Status: reopenedclosed

Yeah. There definitely are compile-time switches that change behavior for GDAL 1.x to 2.x. It sounds like you are changing major versions and expecting PostGIS to work.

comment:8 by strk, 8 years ago

After yet another full rebuild (make clean; ./configure; make && make check) I confirm it's always fixed on rebuild.

comment:9 by Bborie Park, 8 years ago

For GDAL, major versions are 1.10, 1.11, 2.0. Minor versions are 1.10.1, 1.11.0 and 2.0.0.

You can swap out minor versions within a major version (1.10.0 to 1.10.1) without recompiling PostGIS.

Note: See TracTickets for help on using tickets.