SQLIte with SpatialData

Hello!

Today I came across a n option to use sqlite with spatial data. I learned that an extension is needed. And then it is still a question if Directus would support such data somehow. I am totally new to this, so please forgive my vague formulations!
But if any of you works with spatial data in Directus, would you mind sharing your know-how and expertise? How to setup in generell, then within Directus and so on. Thank you!

1 Answer

1

Directus has basic support for spatial data types if supported by the database (requires the “spatialite” plugin for sqlite or “postgis” for postgres). After installing the required database plugin no additional configuration is needed on the Directus side to work with it. These types can then be used in combination with the Map interface or Map layout.

"After installing the required database plugin..." – I am trying to get spatialite installed, primarily with this hook: https://github.com/joggienl/directus-hook-sqlite-spatialite But the description about HOW to install it is nothing but a riddle to me... I created a ./build/Dockerfile and put this (taken from said extension) there: sh FROM directus/directus:11.9.3 USER root RUN apk add --no-cache libspatialite \ && ln -s /usr/lib/mod_spatialite.so.8 /usr/lib/mod_spatialite.so USER node RUN pnpm install directus-hook-sqlite-perf@1.1.0 But this does not work. What would be correct?

–

If you're using docker i'd recommend using postgres with postgis instead as there is a ready-to-go docker for that image: postgist/postgis. Unless you're familiar enough with linux systems and docker to build a custom docker image that includes the sqlite extension.

–

This all has to happen on an existing SQLite instance, so switching to PostGRES is no option. Aside from that I find the idea of having a file as DB that can easily be copied and moved way too nice, and I hope Directus will always support SQlite, maybe even endorse it more! And maybe even include the Spatialie plugin... :-)

–