O'Reilly logo

Data Visualization: Representing Information on Modern Web by Swizec Teller, Ændrew Rininsland, Simon Timms, Andy Kirk

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Proximity detection and the Voronoi geom

A Voronoi geom chops a geographic shape into discrete regions around points, such that no section overlaps and the entirety of the area is covered. Anything within a particular point's section is closer to that point than to any other point. We're going to use this to figure out what the closest major airport is to your current location, which we'll supply via the HTML5 Geolocation API.

Replace your call to app.get in chapter6.js with the following:

app.get('/', (req, res) => { res.send(`<!doctype html> <html> <head> <title>Find your nearest airport!</title> </head> <body> <form method="POST" action="/"> <h1>Enter your latitude and longitude, or allow your browser to check.</h1> <input type="text" name="location" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required