1

I'm trying to get a large number of GeoTiff files into a geopackage for a project we'll be using QField for. Ideally, I'd like to batch the process, but in testing small samples out I'm running into problems with single images from the original data. Here's an example of the problem:

The command:

    C:\OSGeo4W64\bin>gdal_translate --config OGR_SQLITE_SYNCHRONOUS OFF 
-co  APPEND_SUBDATASET=YES -co TILE_FORMAT=PNG_JPEG -a_srs EPSG:26917 
-of GPKG "C:[Path]\ORTH175670482202017FBS.tif" "C:[Path]\ORTH175670482202017FBS.gpkg"

The result:

Input file size is 10020, 10020 

0ERROR 1: RASTER_TABLE must be set to a non empty value

I am fairly certain that the rasters have data tables - the output for gdalinfo on the file looks legitimate (see below), but I really wouldn't know any different since this is a new level of GIS data manipulation for me.

What is this problem, and is there any way to fix it?

I'm running in a Windows environment (Windows 7), using OSGeo4W/QGIS 2.18.13.

gdalinfo output:

C:\OSGeo4W64\bin>gdalinfo "C:[Path]\ORTH175670482202017FBS.tif
"
Driver: GTiff/GeoTIFF
Files: C:\Users\James\Milton_Tiff\ORTH175670482202017FBS.tif
Size is 10020, 10020
Coordinate System is:
PROJCS["NAD83 / UTM zone 17N",
    GEOGCS["NAD83",
        DATUM["North_American_Datum_1983",
            SPHEROID["GRS 1980",6378137,298.257222101,
                AUTHORITY["EPSG","7019"]],
            TOWGS84[0,0,0,0,0,0,0],
            AUTHORITY["EPSG","6269"]],
        PRIMEM["Greenwich",0,
            AUTHORITY["EPSG","8901"]],
        UNIT["degree",0.0174532925199433,
            AUTHORITY["EPSG","9122"]],
        AUTHORITY["EPSG","4269"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",-81],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AXIS["Easting",EAST],
    AXIS["Northing",NORTH],
    AUTHORITY["EPSG","26917"]]
Origin = (566999.000000000000000,4823001.000000000000000)
Pixel Size = (0.100000000000000,-0.100000000000000)
Metadata:
  AREA_OR_POINT=Area
  TIFFTAG_RESOLUTIONUNIT=1 (unitless)
  TIFFTAG_XRESOLUTION=0
  TIFFTAG_YRESOLUTION=0
Image Structure Metadata:
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  (  566999.000, 4823001.000) ( 80d10'13.73"W, 43d33'25.04"N)
Lower Left  (  566999.000, 4821999.000) ( 80d10'14.18"W, 43d32'52.56"N)
Upper Right (  568001.000, 4823001.000) ( 80d 9'29.07"W, 43d33'24.71"N)
Lower Right (  568001.000, 4821999.000) ( 80d 9'29.53"W, 43d32'52.24"N)
Center      (  567500.000, 4822500.000) ( 80d 9'51.63"W, 43d33' 8.64"N)
Band 1 Block=10020x1 Type=Byte, ColorInterp=Red
Band 2 Block=10020x1 Type=Byte, ColorInterp=Green
Band 3 Block=10020x1 Type=Byte, ColorInterp=Blue
Band 4 Block=10020x1 Type=Byte, ColorInterp=Undefined
4
  • GDALInfo says it's either an RGBA or RGBI dataset, nothing about a table. What makes you think there's a subdataset to copy? Nov 15, 2017 at 22:48
  • 1
    @Michael Stimson, subdataset refers here to the target format as documented in gdal.org/drv_geopackage_raster.html. The command looks correct but try also be giving the table name explicitly as in the example gdal_translate -of GPKG new.tif existing.gpkg -co APPEND_SUBDATASET=YES -co RASTER_TABLE=new_table. If it fails with your full image name, try a simple name like foo. What is your GDAL version?
    – user30184
    Nov 16, 2017 at 7:28
  • @user30184 Adding {-co RASTER_TABLE=new_table} cleared the error and I was able to create a .gpkg file from the .tiff. My GDAL version is 2.2.2. Thanks for your help.
    – rwjd
    Nov 16, 2017 at 20:06
  • RASTER_TABLE creation option is optional so it feels like a bug in either the code or in the documentation. Could you use C:[Path]\ORTH175670482202017FBSas a table name?
    – user30184
    Nov 16, 2017 at 21:01

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.