Null Island buoy map with MapLibre GL JS

Null Island is the spot at 0° latitude and 0° longitude, where data with a missing location ends up when the blank turns into zeros. There's no island, just the Atlantic Ocean, about 4.9 km deep. But from 1998 to 2021 there was a weather buoy, Station 13010, called Soul, moored to the sea floor there. Satellites fixed its position most days, and it was rarely at 0°, 0°. This map plays back every day of it, with the last 60 days in orange.

The buoy that day The 60 days before Every day since 1998 The equator and prime meridian

The buoy was tied to an anchor nearly 5 km below, and currents and wind pushed it around the anchor, often a few kilometers away from it. Every year or so a ship came to swap it for a fresh one, and each new anchor landed somewhere a little different, so the scribbles drift around 0°, 0° over the years. The farthest the buoy got while it was anchored was 8.4 km west-southwest of 0°, 0°, in May 2004.

Twice it got away from its anchor, though the data doesn't say how. In February 2002 it went east at about 55 km a day, and its last position, nine days later, was 400 km away, about halfway to São Tomé. In April 2010 it went northeast and was 63 km away after a week. Each time, it was months before a new buoy took its place.

Each position is the average of a day's satellite fixes, rounded to a thousandth of a degree, or about 110 meters, so the line moves in steps. Days with no fix are left out. The record ends in March 2021, when the station was retired.

Build it yourself

A Node.js script saves the buoy's positions as GeoJSON lines, and a page draws all 23 years at once over 0°, 0°, from blue in 1998 to orange in 2021. It's the map above without the playback. It was tested with MapLibre GL JS 6.15 in Chromium and Node.js 22.

What you need

  • Node.js 18 or later.
  • A browser key with the Map tiles product, made as API keys shows. Add http://localhost:* to its allowed origins, so it works from your computer while you build. Map tiles are free, and signing up takes a minute, with no credit card. NOAA's data needs no key.

Collect the positions

Make a folder for the map, and in it a file called buoy.mjs:

buoy.mjs
import { writeFile } from "node:fs/promises";

const url =
  'https://coastwatch.pfeg.noaa.gov/erddap/tabledap/pmelTaoDyPos.csv?time,LON_502,LAT_500&station="0n0e"&LON_502!=NaN';
const response = await fetch(url);
if (!response.ok) throw new Error(`ERDDAP returned ${response.status}`);
const rows = (await response.text()).trim().split("\n").slice(2);

const features = [];
let previous;
for (const row of rows) {
  const [time, lon, lat] = row.split(",");
  const day = Date.parse(time) / 86400000;
  const year = Number(time.slice(0, 4));
  const point = [Number(lon) > 180 ? Number(lon) - 360 : Number(lon), Number(lat)];
  const joined = previous && day - previous.day <= 6;
  if (!joined || year !== previous.year) {
    features.push({ type: "Feature", properties: { year }, geometry: { type: "LineString", coordinates: joined ? [previous.point] : [] } });
  }
  features.at(-1).geometry.coordinates.push(point);
  previous = { day, year, point };
}

const lines = features.filter((feature) => feature.geometry.coordinates.length > 1);
await writeFile("buoy.geojson", JSON.stringify({ type: "FeatureCollection", features: lines }));
console.log(`Saved ${rows.length} days, ${rows[0].slice(0, 10)} to ${rows.at(-1).slice(0, 10)}`);
  • ERDDAP serves PMEL's buoy data as CSV, filtered in the URL: the time and the precise longitude and latitude, for the station called 0n0e, on days that have a position. Its first two rows are the column names and their units.
  • PMEL writes longitudes from 0° to 360°, so the few just west of the prime meridian come back near 360 and are turned into negative numbers.
  • Each line holds one year, so the page can color it by year, and breaks where more than six days have no position, so it doesn't draw a straight line across a gap.

Run it:

Terminal
node buoy.mjs

It downloads about 230 KB, then prints Saved 6567 days, 1998-02-02 to 2021-03-22 and writes buoy.geojson. If ERDDAP answers 503, it's busy: wait a minute and run it again.

Make the page

Next to buoy.geojson, make index.html, with your browser key in place of mapricot_pk_…:

index.html
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>The buoy at Null Island</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/maplibre-gl@6.15.0/dist/maplibre-gl.css">
    <script type="importmap">
      {
        "imports": {
          "maplibre-gl": "https://cdn.jsdelivr.net/npm/maplibre-gl@6.15.0/+esm"
        }
      }
    </script>
  </head>
  <body style="margin: 0">
    <div id="map" style="height: 100vh"></div>
    <script type="module">
      import * as maplibregl from "maplibre-gl";

      const map = new maplibregl.Map({
        container: "map",
        style: "https://api.mapricot.com/tiles/v1/styles/dark.json?key=mapricot_pk_…",
        bounds: [
          [-0.08, -0.08],
          [0.08, 0.08],
        ],
      });
      map.addControl(new maplibregl.ScaleControl());
      await map.once("load");

      map.addSource("zero", {
        type: "geojson",
        data: {
          type: "FeatureCollection",
          features: [
            { type: "Feature", properties: {}, geometry: { type: "LineString", coordinates: [[-180, 0], [180, 0]] } },
            { type: "Feature", properties: {}, geometry: { type: "LineString", coordinates: [[0, -85], [0, 85]] } },
          ],
        },
      });
      map.addLayer({ id: "zero", type: "line", source: "zero", paint: { "line-color": "#868e96", "line-dasharray": [4, 4] } });

      map.addSource("buoy", { type: "geojson", data: "buoy.geojson", attribution: "Buoy: NOAA PMEL GTMBA, PIRATA" });
      map.addLayer({
        id: "buoy",
        type: "line",
        source: "buoy",
        paint: {
          "line-color": ["interpolate", ["linear"], ["get", "year"], 1998, "#4dabf7", 2021, "#fd7e14"],
          "line-opacity": 0.5,
          "line-width": 1,
        },
      });
    </script>
  </body>
</html>
  • The map opens on a box 0.08° each way from 0°, 0°, about 9 km, which holds every day the buoy was anchored. Zoom out to see the two times it got away.
  • The dashed lines are the equator and the prime meridian, so 0°, 0° is where they cross.
  • The buoy's lines are see-through, so the places it spent the most time build up brighter.

Open it

Serve the folder with npx serve or python3 -m http.server, and open the address it prints. Opened straight from the file, the map stays blank, as Open the page explains. You should see a tangle of lines a few kilometers across, around where the dashed lines cross, shifting from blue to orange over the years, and two lines heading off to the northeast where the buoy got away.

PMEL has the same daily positions for each of the Global Tropical Moored Buoy Array's buoys in the Pacific, Atlantic, and Indian Oceans. Put another station's name, such as 0n23w, in place of 0n0e, and move the map's bounds to it.

Data