Highly Available Spatial Data: Finding Pubs in London
The highly available spatial data demo is a single page web app that shows a "tourist" on a map in a location selected randomly from a small set.
Join the DZone community and get the full member experience.Join For Free
Spatial Data and High Availability
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 and 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 eight months, I find myself longing to get out and travel. Since that's not going to happen in reality, 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.
Spatial Data Demo
The highly available spatial data demo is a single page web app which, when the page loads, shows a "tourist" on a map in a location selected randomly from a small set, surrounded by the nearest pubs, cafes, restaurants, or bars (the type of amenity is also randomly selected). 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
- Data set: https://storage.googleapis.com/crl-goddard-gis/osm_475k_eu.txt.gz
- GitHub repository: https://github.com/cockroachlabs-field/crdb-geo-tourist
Spatial Data Reference Material
Published at DZone with permission of Michael Goddard. See the original article here.
Opinions expressed by DZone contributors are their own.