I have no trouble reading files of different types using GDAL's Java bindings (version 2.2.1) via the org.gdal.ogr.ogr.OpenShared(filePath)
method to create a DataSource
. If I want to create a SQLite file from a DataSource, however, how would I do it?
Looking in the JavaDocs, I've found some ExportTo
methods on the Geometry
object that you can use to manually build GeoJSON, WKT, KML and others: http://gdal.org/java/org/gdal/ogr/Geometry.html
There doesn't seem to be anything in the Driver class that would let you use them to export a DataSource however.
Using ogr2ogr it would be as simple as running the following:
ogr2ogr -f "SQLite" ./output.sqlite3 ./input.geojson
And there is this technique for running ogr2ogr from within Java, but I would have assumed there'd be something native in the Java bindings.