[gdal-dev] ogr2ogr adding metadata

Andreas Oxenstierna ao at t-kartor.se
Wed Jun 27 00:16:44 PDT 2018


A S57 file with only 6 feature object classes? Normally there should be 
many more.

I would add triggers to each table in the database for timestamps.
Potential workflow:
1 ogr for initial import into own schema
2 Postgre script, reading all tables in the schema using the 
information_schema info, to truncate and add triggers
3 ogr for final import


> 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
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev


-- 
Hälsningar

Andreas Oxenstierna
T-Kartor Geospatial AB
mobile: +46 733 206831
mailto: ao at t-kartor.se
http://www.t-kartor.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20180627/0b725aea/attachment.html>


More information about the gdal-dev mailing list