Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
joggienl committed Jun 5, 2024
0 parents commit 3f55b95
Show file tree
Hide file tree
Showing 9 changed files with 5,718 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

# General rules for all files
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = tab
insert_final_newline = true
max_line_length = 80
trim_trailing_whitespace = true

# Make sure to not trim whitespaces for markdown, they serve a purpose
[*.md]
trim_trailing_whitespace = false

# No final new line for SVG files
[*.svg]
insert_final_newline = false

# Make sure commit message body does not exceed 70 characters
[COMMIT_EDITMSG]
max_line_length = 70
23 changes: 23 additions & 0 deletions .github/workflows/npm-build-and-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages

name: Node.js Package

on:
release:
types: [created]

jobs:
build-and-publish-npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm run build
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.DS_Store
node_modules
dist
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Jogchum Koerts

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Spatialite Extension

If you want to use GEO functions inside directus and are using SQLite as your
database backend, you need the [SpatiaLite](https://www.gaia-gis.it/fossil/libspatialite/index)
extension for SQLite.

![screenshot](https://raw.githubusercontent.com/joggienl/directus-hook-sqlite-spatialite/v1.0.0/docs/screenshot.png)

This Directus extension will load the module into the database (it will add it
to every connection, that is the way how it works for SQLite).

Note that your Directus backend will need the library to be installed. If you are
using the official docker image you can easily build your own image with the
library included.

```Dockerfile
FROM directus/directus:10.12.0

## Install SQLite SpatiaLite: extend the SQLite core to support fully fledged Spatial SQL
## capabilities.
## https://pkgs.alpinelinux.org/package/edge/community/x86/libspatialite

USER root
RUN <<EOF
apk --no-cache add libspatialite sqlite
ln -s mod_spatialite.so.8 /usr/lib/mod_spatialite
EOF
USER node

```

## Some additional notes

This extension is inspired on the links in the list below.

- https://github.com/directus/directus/discussions/7758
- https://github.com/directus/directus/issues/13271
- https://github.com/directus/directus/pull/9917
- https://medium.com/@joelmalone/a-quick-sqlite3-and-spatialite-primer-7d9fc086e66b
Binary file added docs/screenshot.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 3f55b95

Please sign in to comment.