[gdal-dev] ogr2ogr adding metadata

Lars laasunde at hotmail.com
Mon Jun 25 23:52:41 PDT 2018


Even,

Appreciate the response.

Your example is interesting but there are a couple of issues. Importing a random .000 file using ogr2ogr yields 6 tables in the database. Which tables are created depend on the data and are unknown to me prior to import, so it is difficult to generate the SQL in advance. This approach does not scale very well if data yields a number of tables.

Another issue was when adding the SQL statement for one specific table caused the import to ignore the other 5 tables. Is this the expect result or should all 6 table be imported?

Regards, Lars

________________________________
Fra: Even Rouault <even.rouault at spatialys.com>
Sendt: fredag 22. juni 2018 23.15
Til: gdal-dev at lists.osgeo.org
Kopi: Lars
Emne: Re: [gdal-dev] ogr2ogr adding metadata

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20180626/a24cd9dd/attachment.html>


More information about the gdal-dev mailing list