1

Let's say I have the following input.csv file:

Column1,Column2,latitude,longitude
testData,TestData,-23.547384,-46.643363
testData,TestData,-23.555297,-46.635642

I know I can convert it from CSV to SpatiaLite with the command:

ogr2ogr -f "SQLite" -dsco SPATIALITE=YES -oo X_POSSIBLE_NAMES=longitude -oo Y_POSSIBLE_NAMES=latitude output.sqlite input.csv

However, even though the SpatiaLite database is successfully created, when I look to the column headers I see the following:

enter image description here

Here column1 and column2 are not as the original file (Column1 and Column2). Is there any way of preserving the capital letters on the header while converting from CSV to SpatiaLite with ogr2ogr?

1 Answer 1

4

I recommend to read the documentation https://gdal.org/drivers/vector/sqlite.html

Layer Creation Options

LAUNDER=YES/NO: Controls whether layer and field names will be laundered for easier use in SQLite. Laundered names will be converted to lower case and some special characters(‘ - #) will be changed to underscores. Default to YES.

ogr2ogr -f "SQLite" -dsco SPATIALITE=YES  -lco LAUNDER=NO -oo X_POSSIBLE_NAMES=longitude -oo Y_POSSIBLE_NAMES=latitude casetest.sqlite casetest.csv

ogrinfo casetest.sqlite -al -so
INFO: Open of `casetest.sqlite'
      using driver `SQLite' successful.

Layer name: casetest
Geometry: Point
Feature Count: 2
Extent: (-46.643363, -23.555297) - (-46.635642, -23.547384)
Layer SRS WKT:
(unknown)
FID Column = OGC_FID
Geometry Column = GEOMETRY
Column1: String (0.0)
Column2: String (0.0)
latitude: Real (0.0)
longitude: Real (0.0)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.