home shape

ArangoDB | Geo Demonstration Using Foxx – Location-Aware Applications

Geo data is getting more and more important for today’s applications. The growing number of location-aware services, IoT applications and other solutions using latitude and longitude ask for precise and fast processing of geo data.

Let me show you in this quick demonstration how you can use geo functions and visualize your data using Foxx and leaflet.js.


First install the Foxx Service hosted on GitHub: https://github.com/arangodb-foxx/demo-geo

To do that, simply open the ArangoDB Web UI and install either via the GitHub method or download the zip-file and import it.

After the finished installation you need to import the needed datasets as well using arangoimp:

./arangoimp restaurants.json --collection restaurants
./arangoimp neighborhoods.json --collection neighborhoods


Open the Web UI’s Services menu and click on the newly installed Foxx service “geo-example”. You’ll see a button “Show Interface”. Just hit the button and start exploring some geo functionalities.


* Click the `Random restaurant` button to draw and point to a random restaurant.
* Click the `Random neighborhood` button to draw and point to a random neighborhood.
* Click on a `drawn neighborhood` to also show all restaurants within that range.

Technical background

In total there are three routes defined inside the Foxx service `index.js`:

  1. /restaurants (returns a random restaurant)
  2. /neighborhoods (returns a random neighborhood)
  3. /pointsInNeighborhood/:id (returns all restaurants within a neighborhood, id is the document-handle)

The first two routes only use the collections `any()` function. The third route defines a small AQL query to do the calculation of restaurants (points) in the neighborhoods (polygons). The browser logic is implemented in `frontend/js/app.js`. The used library to do the rendering is leaflet.js. Feel free to examine the code for more details or ask questions your questions in the comments below.

Heiko Kernbach avatar 1518160583 92x92

Heiko Kernbach

Heiko is a JavaScript and C++ Developer working on ArangoDB’s frontend and backend. He holds a Bachelor degree in Computer Science and is passionate about new technologies and programming. Whilst completing his Bachelor degree, Heiko dived deeper into ArangoDB and focused on developing geo location-based services.


  1. […] You can try the new geo_cursor in ArangoDB yourself by following this tutorial or you can get a simple demonstration here. […]

Leave a Comment

Get the latest tutorials, blog posts and news: