Imagine you’re driving a rental car in Rome and the satnav (or GPS) on your phone stops working. This happened to me two years ago when I was commuting by car each day from an Airbnb in Trastevere to an office on Via Amsterdam.
In that moment I remember thinking two things:
I wish I had paid more attention to landmarks on previous drives.
Spatial data applications need to be highly available.
Fast forward to today and the world is different. We’re in the midst of a global pandemic that has inflicted much suffering and has kept us, for the most part, at home. After being home for the past 2+ years, I find myself longing to get out and travel. Since that’s been mostly impossible, I’ve opted to take an imaginary trip to visit some places I’ve enjoyed in the past, and the vehicle for this is a simple demo of the new spatial data functionality in CockroachDB v20.2.
Highly Available Spatial Data Demo
The highly available spatial data demo is a single page web app which, when the page loads, shows a “tourist” (virtual me) on a map in a location selected randomly from a small set, surrounded by the nearest pubs, cafes, restaurants, or bars (my own personal metaverse!). As you pan around the map, the nearby amenities are updated. When any of these is clicked, its name is displayed, along with its distance, in meters, from where the tourist is. The ingredients for this spatial data demo are: Leaflet, Python, Flask, Mapbox, the CockroachDB K8s operator, and data from OpenStreetMap.
Because CockroachDB provides highly available map data, there’s no need to worry about stranding the tourist the way that I was stranded 2 years ago when my map application stopped working.
The video below describes all of this in more detail, and the demo’s GitHub repository contains a detailed README along with everything necessary to reproduce the demo (except for infrastructure and data, though a link is provided to the data set). I hope you enjoy the video!
Spatial Data Demo Resources
If you want to kick the tires on CockroachDB for your spatial data needs check out this sample data set and my github repo. These will help you get started faster.
Data set: https://storage.googleapis.com/crl-goddard-gis/osm_475k_eu.txt.gz
GitHub repository: https://github.com/cockroachlabs-field/crdb-geo-tourist