[gdal-dev] Problem with merging SHAPEs into SpatiaLite

Casper Børgesen caboe at sdfe.dk
Wed Oct 4 01:58:25 PDT 2017


Hi Jukka

I tried only to discover that the error is probably about an invalid (?) layer name (-nln). ogr2ogr doesn't complain if I give it a layer name with a dash in the middle, like 'some-thing'. When appending data to the layer using the same layer name, I get the error message.

I don't know if this type of layer names are indeed invalid and if so, the current behaviour of ogr2ogr not complaining is intended.

Regards, Casper

-----Original Message-----
From: gdal-dev [mailto:gdal-dev-bounces at lists.osgeo.org] On Behalf Of jratike80
Sent: 3. oktober 2017 20:52
To: gdal-dev at lists.osgeo.org
Subject: Re: [gdal-dev] Problem with merging SHAPEs into SpatiaLite

Casper Børgesen-2 wrote
> 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

Could you share a small test dataset for reproducing the issue?

-Jukka Rahkonen-




--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html
_______________________________________________
gdal-dev mailing list
gdal-dev at lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev


More information about the gdal-dev mailing list