Morgan Conrad

Lights and Buoys

Gather USCG and CCG information about marine navigational aids, and display on a map

This is actually two pieces of software

  1. A node.js application to scrape and parse information about lights and buoys
  2. A web page that combines that info with NOAA maps, using leaflet.js

Part 1: Gather Lights and Buoys

This code is public, with a simplistic CLI, on Github





A large JSON file with a little metadata and a long list of "aids".

This file contains a lot of aids that are not lights: they are foghorns and similar. It also contains some duplicates. Along the border, for example in the Salish Sea area, the Canadian files contain some entries for lights in the U.S.A., and vice versa. I wrote another small Node utility, filterData.js, to filter the data, and also sort it in descending order of range.

Part 2: Show on a Map

Demo here

  1. Uses leaflet.js
  2. Uses the filtered and sorted list for speed. The sorting ensures that smaller lights appear "on top of" the larger lights, so one can access their titles and popups.
  3. Map "tiles" come from the NOAA tiler service
  4. Lights within the visible bounds of the map are added as Circle markers to a Layer Group over the map
  5. The map has two TileLayers, "Day", and a darker one for "Night".
  6. The very basic "About/Help" page is generated from markdown.

Blinking the Lights!

  1. The mapping software attempts to parse the light's "characteristic". This is a messy process and takes some shortcuts.
  2. If you switch to the "Night" layers, the lights blink according to their parsed characteristic. This feature is inspired by this wonderful Lighthouse Map .
    • His information for lights in the U.S.A and Canada is incomplete, therefore Part 1 of this project!
    • I stole a few ideas from his code, such as a random seed to offset the timings of the lights.

JavaScript nodejs leaflet.js