[gdal-dev] Problem with merging SHAPEs into SpatiaLite

Casper Børgesen caboe at sdfe.dk
Tue Oct 3 01:22:40 PDT 2017


Hi devs

I am trying to merge a bunch of SHAPE files into a few SpatiaLite files. To make it more simple I have two kinds of data sets A and B and each data set has two SHAPE files. So my result should end up being a SpatiaLite file for each data set.

I am using the following commands to create the SpatiaLite files:

If it's the first file:
ogr2ogr -f SQLite -dsco SPATIALITE=YES -gt 100000 -lco SPATIAL_INDEX=NO out_A.spatialite A_1.shp -nln A
Else:
ogr2ogr -gt 100000 -update -append A.spatialite A_2.shp -nln A

If it's the first file:
ogr2ogr -f SQLite -dsco SPATIALITE=YES -gt 100000 -lco SPATIAL_INDEX=NO out_B.spatialite B_1.shp -nln B
Else:
ogr2ogr -gt 100000 -update -append B.spatialite B_2.shp -nln B

For some reason I haven't found yet, the last command fails with the following message (both A's work just fine):

ERROR 1: Layer B already exists, CreateLayer failed.
Use the layer creation option OVERWRITE=YES to replace it.
ERROR 1: Terminating translation prematurely after failed
translation of layer B (use -skipfailures to skip errors)

The two data sets are both linestrings but has different attributes. Both 1 and 2 in each data set has been created programmatically the same way.

I am using GDAL 2.2.2 (x64) on Windows 7 from OSGeo4W.

What could be the reason for this error?

Regards, Casper

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


More information about the gdal-dev mailing list