DEV Community

Roberto B.
Roberto B.

Posted on • Updated on

RESTful web service for geospatial data

If you want to play with Geospatial data, probably you need some tools that allow you to:

  • store/import/export geo data;
  • search data by proximity or that are included in a specific area;
  • obtain statistics;
  • aggregate/cluster data;
  • connect with multiple sources;
  • realtime notification on data changes.


In these days I was playing with XYZ Hub.
XYZ Hub is a RESTful web service for geospatial data.
It is opensource and you can obtain sources here:

In this post I'm going to list all step needed to install XYZ Hub on your Macbok.

XYZ Hub needs some 3rd party tools like Postgresql for storing data and Redis to manage queues and some other things.

In order to simplify the local setup, and start to play quickly, I suggest you to user Docker.
XYZ Hub uses 3 containers managed by Docker Compose. The file that orchestrates the setup is .


You need to: obtain sources, install dependencies, run containers.

You are going to use:

  • git clone to obtain sources
  • mvn to install all dependencies
  • docker-compose up to run all services needed
git clone
cd xyz-hub
mvn clean install
docker-compose up -d
Enter fullscreen mode Exit fullscreen mode

If you don't have maven (mvn command) on your local machine, you could install it via Homebrew:

brew install maven
Enter fullscreen mode Exit fullscreen mode

Consuming APIs

Once you have your services up and running you can start to play with APIs exposed by XYZ Hub.
With the default configuration you can access to APIs with http://localhost:8080

The documentation of APIs:

To obtain all spaces:

curl -H "content-type:application/json" http://localhost:8080/hub/spaces
Enter fullscreen mode Exit fullscreen mode

Probably the response is empty, so let's create a new space

curl -H "content-type:application/json" -d '{"title": "my first space", "description": "my first geodata repo"}' http://localhost:8080/hub/spaces
Enter fullscreen mode Exit fullscreen mode

You will see a json response. The most important attribute is "id". This is the identifier of your space.

For example in my case, the response was:

{"id":"hsL2VQik","title":"my first space","description":"my first geodata repo","storage":{"id":"psql","params":null},"owner":"ANONYMOUS","createdAt":1581839550657,"updatedAt":1581839550657,"contentUpdatedAt":1581839550657,"volatility":0.010202997130407065,"autoCacheProfile":{"browserTTL":0,"cdnTTL":0,"serviceTTL":0}}
Enter fullscreen mode Exit fullscreen mode

so hsL2VQik is my space id.

Space, Features, Data, Tags

If you are not familiar with these terms, I suggest you to read quickly . It refers to XYZ Hub Cloud, but you can find useful informations also for your local installation.

Unofficial PHP SDK

In my spare time I started to implement an open source PHP SDK for consuming these APIs. So it means that for creating space, adding data to space you could use a fluent PHP Library instead of use directly HTTPS APIs.
If you want to contribute, or simply use, or provide feedback or suggestions:

Any feedback is welcome

I'm here to learn and improve every day.
So if you have some suggestion or feedback, this is appreciated!

Top comments (0)