[gdal-dev] Determining Native Data Field Type Names for a Given Layer or Driver

Even Rouault even.rouault at spatialys.com
Wed Sep 27 13:32:23 PDT 2017


On mercredi 27 septembre 2017 15:22:15 CEST Andrew Joseph wrote:
>   Thanks, this worked out better than I could have hoped! I used:
> 
>     final String url = "/test_data/shapefiles/myshp.shp";
>     final Dataset shapefileDs = gdal.OpenEx(url);
>     final Vector<String> options = new Vector<>(Arrays.asList(
>         "-of", "PGDump",
>         "-where", "0=1",
>         "-lco", "FID=fid",
>         "-lco","GEOMETRY_NAME=geom",
>         "-lco","LAUNDER=NO"));
> 
>     gdal.VectorTranslate("/vsistdout", shapefileDs, new
> VectorTranslateOptions(options));
> 
> In terms of efficiency, is it better to use -limit 0 or -where FALSE?

Ah yes, -limit 0 will work much faster.

> 
> Also, is there any means of removing the BEGIN; and COMMIT; statements? 

I don't think so.

> 
> As a side note, I noticed that the BEGIN; statement in the dump is  issued
> after the DROP TABLE -which would mean the relevant table would be deleted
> even if the data load transaction failed -not sure if this is intended
> behavior or a bug.

I'm not completely sure if it is intended or not. From what I see, the PG driver does the same 
thing. There are perhaps issues with dropping a table in a transaction. I remember having 
some issues recently when creating (and perhaps overwriting) hundreds/thousands of tables 
in the same ogr2ogr invokation. This exhausted some PG server limitation.


-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20170927/09c3bba7/attachment.html>


More information about the gdal-dev mailing list