On Thu, Jun 27, 2019 at 7:37 AM Micha Silver <tsvi...@gmail.com> wrote: > > > On 26/06/2019 23:44, Markus Metz wrote: > > > > On Wed, Jun 26, 2019 at 10:16 PM Micha Silver <tsvi...@gmail.com> wrote: > > > > > > > > > > > > micha@TP480:code$ ogrinfo -so ../GIS/Ashalim/ashalim_train_pts.gpkg > > INFO: Open of `../GIS/Ashalim/ashalim_train_pts.gpkg' > > using driver `GPKG' successful. > > 1: ashalim_train_pts (Point) > > 2: layer_styles (None) > > > > > > The style ??!! > > > > > > I removed that "layer_styles" table from the gpkg db, and deleted the entry from gpkg_contents, and now the import works. > > > > Who would have guessed ? > > > > I suppose that I should have specified the layer in v.import to avoid this problem. > > Yes, specifying the layer should work. > > I have seen this layer_styles layer before in other GPKG files but don't know what this is good for. GDAL documentation at > https://gdal.org/drivers/vector/gpkg.html > does not mention any style information. > > > It comes from QGIS, where you can save a default layer styling directly into the gpkg. Very convenient, but I never thought it would appear to GRASS as a second layer without geometry or CRS.
This is not GRASS, it is OGR that recognizes it as a separate layer without geometry or CRS. I guess ogr2ogr skips this layer because there are no geometries in it. In theory, v.in.ogr could skip empty OGR layers, but in practice it is not always easy to get the feature count of a layer, it depends on the data format. Sometimes, e.g. for OSM pbf, you need to read the whole OGR datasource to figure out the number of features per layer. In v.in.ogr, there are already a number of special cases for specific OGR-supported formats, and I would like to keep these format-specific treatments to a minimum, avoiding yet another special case for GPKG + empty layer. Ideally, the GPKG driver of OGR would not expose such empty or special layers. Markus M
_______________________________________________ grass-user mailing list grass-user@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/grass-user