JuliaGeo / GDALBuilder

MIT License
2 stars 1 forks source link

Compile with sqlite driver #5

Closed yeesian closed 5 years ago

yeesian commented 6 years ago

Discourse discussion.

visr commented 6 years ago

Yeah another good one to add. Shouldn't be too much work since this already exists:

https://github.com/JuliaDatabases/SQLiteBuilder

niclasmattsson commented 6 years ago

Bump. My use case is that I need to perform a SQL UPDATE command in ogrinfo to create an integer field (so that I can use this field for rasterization later). Apparently UPDATE is not supported in OGR SQL and requires SQlite instead.

julia> run(`$gdalpath/ogrinfo globtest.shp -dialect SQLite -sql "UPDATE globtest SET FID=CAST(substr(GID_1,5) AS INTEGER)"`)                                                                                                                
INFO: Open of `globtest.shp'                                                                                              
      using driver `ESRI Shapefile' successful.                                                                           
ERROR 6: The SQLite driver needs to be compiled to support the SQLite SQL dialect                                         
Process(`'C:\Users\niclas\.julia\packages\GDAL\vec6Y\deps\usr\bin/ogrinfo' globtest.shp -dialect SQLite -sql 'UPDATE globtest SET FID=CAST(substr(GID_1,5) AS INTEGER)'`, ProcessExited(0))                                                                                                                                                                      
yeesian commented 6 years ago

@niclasmattsson might you be interested in giving it a shot?

robot144 commented 5 years ago

i would like to use the gpkg format, which uses sqlite for storage. would this also help for my issue?

visr commented 5 years ago

Yes, I assume that GeoPackage support is also added with this.

So in 4aa05a92f1a2c7b42147e750aa132d1548fa2d42 I added libsqlite3. But it is not yet live due to several issues with the builds:

https://github.com/JuliaGeo/LibGEOS.jl/pull/56 ~https://travis-ci.org/JuliaGeo/PROJBuilder/builds/442663332~

https://github.com/JuliaGeo/GDAL.jl/pull/60

visr commented 5 years ago

Closing this as the v3.0.0-3 build used in https://github.com/JuliaGeo/GDAL.jl/pull/66 is compiled with this driver (still adding this as a test in the PR).

Some relevant lines from the build.log:

checking for sqlite3_open in -lsqlite3... yes
checking for SQLite3 library >= 3.0.0... yes
checking for sqlite3_column_table_name in -lsqlite3... no
configure: rasterlite2 support disabled

  SQLite support:            yes

So yes it is supported. But there are also more SQLite extensions that can be used that are currently not built in the SQLiteBuilder, like sqlite3_column_table_name for rasterlite2. Or GPKG can use the SQLite rtree extension:

https://gdal.org/drivers/vector/gpkg.html http://www.geopackage.org/guidance/extensions/rtree_spatial_indexes.html

Probably best to open seperate issues about those when we need them.