Git Product home page Git Product logo

spatial-indexer's Introduction

Spatial Indexer

This project is using Apache Jena library to generate a spatial index file from a TDB2 dataset. Generating the spatial index file before starting a Fuseki instance with GeoSPARQL support can save some precious time when starting the Fuseki instance.

If you want to play with Fuseki with GeoSPARQL support, you may be interested in: https://github.com/zazuko/fuseki-geosparql.

Build

Build the package using the following command:

mvn clean package

Run the tool

Once you built the package, you can run the spatial indexer tool by using this command:

java -jar target/spatialindexer-*-jar-with-dependencies.jar \
  --dataset /tmp/test-ds \
  --index /tmp/test-spatial.index

You can edit the paths with some specific values.

Supported options:

  • --dataset, -d: path to the dataset (required)
  • --index, -i: path to the spatial index file to generate (required)
  • --srs, -s: manually set a SRS URI, by default, it will take the one that is the most present in the dataset or use CRS84 as a fallback

Docker image

The Docker image is configurable using the following environment variables:

  • JAVA_OPTIONS: add some Java options (default: empty)
  • SRS_URI: specify a SRS URI to use (default: empty)
  • DATASET_PATH: path to the dataset (default: /databases/ds)
  • SPATIAL_INDEX_FILE_PATH: path to the spatial index file to generate (default: /databases/ds/spatial.index)

If you want to run it quickly on a dataset on your machine, go in the dataset directory, then run the following:

docker run --rm \
  -v$(pwd):/databases/ds \
  ghcr.io/zazuko/spatial-indexer:latest \
  --srs http://www.opengis.net/def/crs/OGC/1.3/CRS84

This will generate a spatial.index file in your dataset directory.

Since the container is running as root, you may need to change permissions for the generated spatial index file, by using something similar to:

sudo chown "${USER}" spatial.index

If you want to create a Docker image that uses this tool, you can do something like this:

FROM ...

# ...

# make sure you have a Java runtime somewhere in the image

# ...
COPY --from=ghcr.io/zazuko/spatial-indexer:latest /app/spatialindexer.jar .
# ...

Or if you want to directly fetch the jar file locally, you can use this command:

docker pull ghcr.io/zazuko/spatial-indexer:latest
CONTAINER_ID=$(docker create ghcr.io/zazuko/spatial-indexer:latest)
docker cp "${CONTAINER_ID}:/app/spatialindexer.jar" .
docker stop "${CONTAINER_ID}"
docker rm "${CONTAINER_ID}"

Make sure to use a full semver tag of the image instead of latest to avoid any breaking change in your workflow.

spatial-indexer's People

Contributors

dependabot[bot] avatar ludovicm67 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.