[gdal-dev] ogr2ogr - exclude table option?

Andreas Neumann a.neumann at carto.net
Wed Nov 30 12:11:14 PST 2016


Hi Even,

Thanks. I will use the 'ogrinfo your.gpkg -sql "DROP TABLE table_name"' 
trick for now.

One thing though: I noticed that the filesize doesn't really shrink. Is 
there a way to compact/vacuum the geopackage after removal of the table?

The table I remove is rather big - so it would have quite an effect on 
the filesize.

----------

On the blacklist / exclude table options for table transfer from Postgis 
to GPKG - can you please send me an estimate/quote offlist? Depending on 
how much this costs, I would be interested in paying for that.

Thanks a lot,

Andreas

Am 30.11.2016 um 18:05 schrieb Even Rouault:
>
> On mercredi 30 novembre 2016 16:21:42 CET Neumann, Andreas wrote:
>
> > Hi,
>
> >
>
> > I want to convert a whole Postgis schema to a geopackage. This works
>
> > fine with
>
> >
>
> > ogr2ogr -f GPKG av_1700.gpkg PG:'dbname=dbname host=localhost
>
> > schemas=schemaname'
>
> >
>
> > Now - my problem is that the schema contains 64 tables and I want to
>
> > convert all tables except one table.
>
> >
>
> > Is there a trick with an exclude option? I know that I can list all
>
> > tables that I want to convert in the sense of a white list with
>
> > 'tables=tab1,tab2,tab3', etc. - but this is complicated for this many
>
> > tables.
>
> >
>
> > I hope that there is / could be some black list option - or the
>
> > possibility of specifying a pattern for selection the tables to be
>
> > converted.
>
> Andreas,
>
> There's no such option (there's no real technical hurdle if one would 
> want to add one, but one can wonder how common this use case is)
>
> The easiest way currently would be to drop the unwished tables after 
> the import : ogrinfo your.gpkg -sql "DROP TABLE table_name". Since 
> GDAL 2.1.2, this not only drops the table but also all references to 
> it in GPKG system tables.
>
> You could also do a tiny script to list the tables and remove the 
> one(s) you don't want from the list before calling ogr2ogr / 
> gdal.VectorTranslate()
>
> Even
>
> -- 
>
> Spatialys - Geospatial professional services
>
> http://www.spatialys.com
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20161130/2b9f7e3f/attachment.html>


More information about the gdal-dev mailing list