[go: up one dir, main page]

Skip to content

Fetch buoy and tide information from government NDBC data using JavaScript.

License

Notifications You must be signed in to change notification settings

derekdowling/buoy-kit

Repository files navigation

Buoy Kit 🌊 🏄 🤙

Fetch data about buoys in the ocean with JavaScript (or TypeScript) using NOAA data sources.

yarn add buoy-kit

Usage

fetchBuoyRealTimeData fetches, parses, and returns realtime2 station data (.txt extension):

import { fetchBuoyRealTimeData, BuoyData } from 'buoy-kit';

export async function getBuoy(buoyID: string): Promise<BuoyData> {
  let buoyData: BuoyData;
  
  try {
    buoyData = await fetchBuoyRealTimeData(buoyID: string);
  } catch (e) {
    console.log(e);
  }
  
  return buoyData;
}

Finding A Buoy

There are plans to make it easy to find the closest buoy(s) to a nearby location. In the mean time, you can explore the world-wide buoy map on the NDBC site and clicking on one of the squares. The number of the "Station" is the Buoy ID you would use.

On The Server (Node.js)

This library uses the Fetch API to manage HTTP requests. You'll want to import isomorphic-fetch if you're using this library in a Node environment.

yarn add isomorphic-fetch

Then in your server's initialization file, polyfill Fetch via:

require('isomorphic-fetch');

About

Fetch buoy and tide information from government NDBC data using JavaScript.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published