qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.62k stars 3.01k forks source link

error adding (from QGIS Browser) GeoPackage tile layer with identifier that does not match table name #29246

Open qgib opened 5 years ago

qgib commented 5 years ago

Author Name: Robert St. John (@restjohn) Original Redmine Issue: 21429 Affected QGIS version: 3.6.0 Redmine category:browser


I cannot add a raster layer from a GeoPackage tile table whose name does not match the @identifier@ column value in the @gpkg_contents@ table of the GeoPackage.

Steps to reproduce:

  1. Right click the GeoPackage node in the Browser panel and select the New Connection... item.
  2. Browse to a GeoPackage file with the characteristics described above (example attached) and select Open.
  3. In the Browser panel, expand the newly added node for the GeoPackage connection. A raster layer child node should appear with the raster icon and the same name as the value of the @identifier@ column for @gpkg_contents@ table row for the tile table in the GeoPackage. This will be Wetsaw Test for the attached example GeoPackage.
  4. Double click the raster layer child node (or right click and select Add Layer to Project).
  5. QGIS displays an error message at the top of the canvas and a matching error message in the Log Messages panel:
    
    CRITICAL    Invalid Layer : GDAL provider Cannot open GDAL dataset GPKG:/path/to/tiles.gpkg:Wetsaw Test:
             Cannot find table 'Wetsaw Test' in GeoPackage dataset
             Raster layer Provider is not valid (provider: gdal, URI: GPKG:/path/to/tiles.gpkg:Wetsaw Test


If I simply drag and drop the GeoPackage onto the _Layers_ panel, QGIS adds a raster layer for the GeoPackage name after the GeoPackage file, not the @gpkg_contents@.@identifier@ column.  I am not sure what QGIS does in that interaction if the GeoPackage contains multiple tile and/or feature tables.

---

- [tiles.gpkg](https://issues.qgis.org/attachments/download/14482/tiles.gpkg) (Robert St. John)
qgib commented 5 years ago

Author Name: Giovanni Manghi (@gioman)


can you see the same message if you gdalinfo the gpkg in your machine?

giovanni@sibirica:~/Downloads$ gdalinfo tiles.gpkg Warning 1: Database relies on the 'gpkg_crs_wkt' (http://www.geopackage.org/spec/#extension_crs_wkt) extension that should be implemented in order to read it safely, but is not currently. Some data may be missing while reading that database. Driver: GPKG/GeoPackage Files: tiles.gpkg Size is 979, 939 Coordinate System is: PROJCS["WGS 84 / Pseudo-Mercator", GEOGCS["WGS 84", DATUM["WGS_1984", SPHEROID["WGS 84",6378137,298.257223563, AUTHORITY["EPSG","7030"]], AUTHORITY["EPSG","6326"]], PRIMEM["Greenwich",0, AUTHORITY["EPSG","8901"]], UNIT["degree",0.0174532925199433, AUTHORITY["EPSG","9122"]], AUTHORITY["EPSG","4326"]], PROJECTION["Mercator_1SP"], PARAMETER["central_meridian",0], PARAMETER["scale_factor",1], PARAMETER["false_easting",0], PARAMETER["false_northing",0], UNIT["metre",1, AUTHORITY["EPSG","9001"]], AXIS["X",EAST], AXIS["Y",NORTH], EXTENSION["PROJ4","+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs"], AUTHORITY["EPSG","3857"]] Origin = (-8537258.699999999254942,4773269.700000000186265) Pixel Size = (19.109257030487100,-19.109257030487100) Metadata: DESCRIPTION=Wetsaw Test: Baltimore area OSM tiles IDENTIFIER=Wetsaw Test ZOOM_LEVEL=12 Image Structure Metadata: INTERLEAVE=PIXEL Corner Coordinates: Upper Left (-8537258.700, 4773269.700) ( 76d41'29.40"W, 39d21'33.48"N) Lower Left (-8537258.700, 4755326.108) ( 76d41'29.40"W, 39d14' 4.41"N) Upper Right (-8518550.737, 4773269.700) ( 76d31'24.40"W, 39d21'33.48"N) Lower Right (-8518550.737, 4755326.108) ( 76d31'24.40"W, 39d14' 4.41"N) Center (-8527904.719, 4764297.904) ( 76d36'26.90"W, 39d17'49.05"N) Band 1 Block=512x512 Type=Byte, ColorInterp=Red Overviews: 489x469 Mask Flags: PER_DATASET ALPHA Overviews of mask band: 489x469 Band 2 Block=512x512 Type=Byte, ColorInterp=Green Overviews: 489x469 Mask Flags: PER_DATASET ALPHA Overviews of mask band: 489x469 Band 3 Block=512x512 Type=Byte, ColorInterp=Blue Overviews: 489x469 Mask Flags: PER_DATASET ALPHA Overviews of mask band: 489x469 Band 4 Block=512x512 Type=Byte, ColorInterp=Alpha Overviews: 489x469


qgib commented 5 years ago

Author Name: Robert St. John (@restjohn)


No, @gdalinfo@ seems OK with it.

robertstjohn:wetsaw-out stjohnr> gdalinfo tiles.gpkg 
Driver: GPKG/GeoPackage
Files: tiles.gpkg
Size is 979, 939
Coordinate System is:
PROJCS["WGS 84 / Pseudo-Mercator",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.257223563,
                AUTHORITY["EPSG","7030"]],
            AUTHORITY["EPSG","6326"]],
        PRIMEM["Greenwich",0,
            AUTHORITY["EPSG","8901"]],
        UNIT["degree",0.0174532925199433,
            AUTHORITY["EPSG","9122"]],
        AUTHORITY["EPSG","4326"]],
    PROJECTION["Mercator_1SP"],
    PARAMETER["central_meridian",0],
    PARAMETER["scale_factor",1],
    PARAMETER["false_easting",0],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AXIS["X",EAST],
    AXIS["Y",NORTH],
    EXTENSION["PROJ4","+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs"],
    AUTHORITY["EPSG","3857"]]
Origin = (-8537258.699999999254942,4773269.700000000186265)
Pixel Size = (19.109257030487100,-19.109257030487100)
Metadata:
  DESCRIPTION=Wetsaw Test: Baltimore area OSM tiles
  IDENTIFIER=Wetsaw Test
  ZOOM_LEVEL=12
Image Structure Metadata:
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  (-8537258.700, 4773269.700) ( 76d41'29.40"W, 39d21'33.48"N)
Lower Left  (-8537258.700, 4755326.108) ( 76d41'29.40"W, 39d14' 4.41"N)
Upper Right (-8518550.737, 4773269.700) ( 76d31'24.40"W, 39d21'33.48"N)
Lower Right (-8518550.737, 4755326.108) ( 76d31'24.40"W, 39d14' 4.41"N)
Center      (-8527904.719, 4764297.904) ( 76d36'26.90"W, 39d17'49.05"N)
Band 1 Block=512x512 Type=Byte, ColorInterp=Red
  Overviews: 489x469
  Mask Flags: PER_DATASET ALPHA 
  Overviews of mask band: 489x469
Band 2 Block=512x512 Type=Byte, ColorInterp=Green
  Overviews: 489x469
  Mask Flags: PER_DATASET ALPHA 
  Overviews of mask band: 489x469
Band 3 Block=512x512 Type=Byte, ColorInterp=Blue
  Overviews: 489x469
  Mask Flags: PER_DATASET ALPHA 
  Overviews of mask band: 489x469
Band 4 Block=512x512 Type=Byte, ColorInterp=Alpha
  Overviews: 489x469
qgib commented 5 years ago

Author Name: Giovanni Manghi (@gioman)


gioman commented 3 years ago

Still true on the latest master.