2

I'm inside a bash script trying to import a GeoJSON file into a SQLite DB. I tried both ...

SPATIALITE_SECURITY=relaxed sqlite3 'db.sqlite' "SELECT load_extension('mod_spatialite')" "SELECT ImportGeoJSON('file.geojson', 'osmgeojson')"

... and ...

export SPATIALITE_SECURITY=relaxed
sqlite3 'db.sqlite' "SELECT load_extension('mod_spatialite')" "SELECT ImportGeoJSON('file.geojson', 'osmgeojson')"

... but either way I get this error:

Error: no such function: ImportGeoJSON

Note that in both cases I did set SPATIALITE_SECURITY=relaxed as the docs said ( http://www.gaia-gis.it/gaia-sins/spatialite-sql-latest.html ).

I'm sure that SpatiaLite is loaded correctly, as it throws no error and this command ...

SPATIALITE_SECURITY=relaxed sqlite3 'db.sqlite' "SELECT load_extension('mod_spatialite')" "SELECT spatialite_version()"

... returns ...

4.3.0a

What could be causing this error?

1 Answer 1

0

Looking at Spatialite's timeline I realised that ImportGeoJSON() was introduced after 5.0.0-beta0 so obviously it wasn't supported by the 4.3.0a I had on my system.

I have updated Spatialite to 5.0.1 (actually I had to upgrade Ubuntu 20.04 to 21.04 to do that without compiling it) and now the function is recognised.

1
  • Spatialite 5.0.1 on Ubuntu 22.04 does not recognise the function. Possibly something else missing. Jan 11, 2023 at 10:18

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.