[GRASS-user] GeoPackage and multiple tables

Moritz Lennert mlennert at club.worldonline.be
Sat Mar 16 08:24:53 PDT 2019


Le Sat, 16 Mar 2019 07:23:19 -0700,
Ken Mankoff <mankoff at gmail.com> a écrit :

> Hello,
> 
> I'm trying to export a vector to GeoPackage. The vector has 3 layers
> and each layer has an associated table. When I view the data
> (pre-export) in GRASS it looks good, but when I export and open in
> QGIS I only see the layer1 table. Am I doing something wrong or is
> this a bug/limit in the GeoPackage exporter? Here is an MWE using the
> nc_spm_08_grass7 data set. I'm using grass 7.4.0. I note v.out.ogr
> does warn
> 
> > # WARNING: The combination of types is not supported by all
> > formats.  
> 
> But I think this is always printed and that GeoPackage can support a
> combination of types.

v.out.ogr has a layer parameter which is set to 1 by default. I'm not
sure v.out.ogr in its current state can export several layers at once.

Try running v.out.ogr three times, changing layer each time and using
the -u flag for updating the existing gpkg file:

v.out.ogr -c input=pal output_layer=pal1 output=pal.gpkg layer=1
v.out.ogr -c input=pal output_layer=pal2 output=pal.gpkg layer=2 -u --o
v.out.ogr -c input=pal output_layer=pal3 output=pal.gpkg layer=3 -u --o

Moritz

> 
>   -k.
> 
> 
> grass ./nc_spm_08_grass7/PERMANENT
> 
> g.mapset -c gpgk
> g.copy vector=poi_names_wake at PERMANENT,points
> g.copy vector=lakes at PERMANENT,areas
> g.copy vector=railroads at PERMANENT,lines
> 
> v.category in=areas out=areas_2 op=chlayer layer=1,2
> v.category in=lines out=lines_3 op=chlayer layer=1,3
> v.patch in=points,areas_2,lines_3 output=pal
> 
> v.db.addtable map=pal table="tbl_points" layer=1
> v.db.addtable map=pal table="tbl_areas" layer=2
> v.db.addtable map=pal table="tbl_lines" layer=3
> 
> v.db.connect -p map=pal
> # Vector map <pal> is connected by:
> # layer <1/tbl_points> table <tbl_points> in database
> </home/kdm/data/grass/nc_spm_08_grass7/gpgk/sqlite/sqlite.db> through
> driver <sqlite> with key <cat> # layer <2/tbl_areas> table
> <tbl_areas> in database
> </home/kdm/data/grass/nc_spm_08_grass7/gpgk/sqlite/sqlite.db> through
> driver <sqlite> with key <cat> # layer <3/tbl_lines> table
> <tbl_lines> in database
> </home/kdm/data/grass/nc_spm_08_grass7/gpgk/sqlite/sqlite.db> through
> driver <sqlite> with key <cat> # GRASS 7.4.0
> (nc_spm_08_grass7):~/data/grass > 
> 
> v.db.addcolumn map=pal layer=1 column="pt INT"
> v.db.addcolumn map=pal layer=2 column="ar INT"
> v.db.addcolumn map=pal layer=3 column="ln INT"
> 
> v.db.update map=pal layer=1 column=pt value=42
> v.db.update map=pal layer=2 column=ar value=43
> v.db.update map=pal layer=3 column=ln value=44
> 
> v.out.ogr -c input=pal output=pal.gpkg --o
> # WARNING: The combination of types is not supported by all formats.
> 



More information about the grass-user mailing list