npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

rws-waterinfo-api

v1.0.2

Published

Nodejs wrapper for the RWS waterinfo api

Downloads

5

Readme

RWS Waterinfo Api Node

Node.js wrapper for the RWS waterinfo api.

Docs about the API can be found here. Docs are in english, but the API itself is mostly Dutch. This wrapper is mostly in English, aside from a couple variable names.

Table of contents

Installation

npm install rws-waterinfo-api

Usage

import * as rws from 'rws-waterinfo-api'

rws.getLocations()
   .then(locations => console.log(locations))
   .catch(err => console.error(err))

// Or import a single function
import { getLocations } from 'rws-waterinfo-api'

getLocations()
   .then(locations => console.log(locations))
   .catch(err => console.error(err))

Methods

getLocations

getLocations(): Promise<StationLocation[]>
getLocations(rawData: true): Promise<MetadataResponse>

Get all available stations for use in getObservations and getLatestObservations.
Returns StationLocation[] by default. Pass in true to get the raw data.

getMetadata

getMetadata(): Promise<MetadataParsed[]>
getMetadata(rawData: true): Promise<MetadataResponse>

Get all available variables for use in getObservations and getLatestObservations.
Returns MetadataParsed[] by default. Pass in true to get the raw data.

getObservations

getObservations(requestData: ObservationRequestData): Promise<Observations>
getObservations(requestData: ObservationRequestData, rawData: true): Promise<ObservationsResponse>

Get RWS observations data for the given variables, at the given station location, within the specified timeframe.
Returns Observations by default. Pass in true after the requestData object to get the raw data.

requestData (ObservationRequestData)

Object in the following format:

{
   variables: {
      grootheid?: string;
      eenheid?: string;
      compartiment?: string;
      hoedanigheid?: string;
      meetapparaat?: string;
      parameter?: string;
   };
   location: {
      coordinates: {
         x: number;
         y: number
      };
      code: string;
   };
   period: {
      start: string;
      end: string;
   };
}

Available variables can be fetched using the getMetadata method. Variables are in Dutch because the data the description they contain are also in Dutch, and I'm not sure how to translate each of them. Feel free to make a PR to correct this.
Main variables you'll likely want to use are grootheid, which is used to get a single data type (e.g. windspeed with code WINDSHD), and compartiment, which is used to get a group of pre-defined data types (e.g. air with code LT to get all data related to the air (wind speed, direction e.t.c.)).

Available locations can be fetched using the getLocations method.

Period is an object consisting of a start and end date. The strings need to be in ISO format. For example: 2022-04-26T20:30:00.000+01:00.

getLatestObservations

getLatestObservations(requestData: LatestObservationRequestData): Promise<Observations[]>
getLatestObservations(requestData: LatestObservationRequestData, rawData: true): Promise<LatestObservationResponse>

Get latest RWS observation data for the given variables at the given station location(s). Returns Observations[] by default. Pass in true after the requestData object to get the raw data.

This method differs from getObservations in the following ways:

  • Only gets a single observation per location
  • Accepts multiple locations
  • Accepts multiple variables

requestData (LatestObservationRequestData)

// Both variables and locations can also be an array of objects, if fetching multiple.
{
   variables: {
      grootheid?: string;
      eenheid?: string;
      compartiment?: string;
   };
   locations: {
      coordinates: {
         x: number;
         y: number
      };
      code: string;
   };
}

Available variables can be fetched using the getMetadata method.
Available locations can be fetched using the getLocations method.