[gdal-dev] ogr2ogr adding metadata

Even Rouault even.rouault at spatialys.com
Fri Jun 22 14:15:36 PDT 2018


On vendredi 22 juin 2018 09:41:02 CEST Lars wrote:
> Hello folks,
> 
> Using ogr2ogr (version 2.2.3) to import s57 into PostgreSQL which works
> great.
> 
> What is the recommended approach for adding metadata to all inserted data?
> 
> Say I wanted to add current date to all inserted data. Does ogr2ogr support
> such operation? Tried using the "-mo" argument but it did not make any
> inpact (same result with argument as without). Ideally I do not want the
> client to be adding this information as a post insert operation (if even
> possible).

Lars,

-mo will work only with very few target drivers (I can only think to 
GeoPackage actually). This is per-layer/per-table metadata. There's perhaps 
the equivalent in PostgreSQL but this isn't implemented by GDAL

But you can add a column with the current timestamp for example with

ogr2ogr -update PG:xxxxxx poly.shp \
       -sql "SELECT *, CURRENT_TIMESTAMP FROM poly" -dialect SQLITE

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list