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:

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:


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.