Skip to content

ipinlnd/metoffice-fetch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Met Office Fetch

A simple package to fetch data from the uk met office API library.

installation

Just do

npm install metoffice-fetch

or

yarn add metoffice-fetch

Example

import { FetchDailyData } from "metoffice-fetch";

const fetchData = async (latitude: number, longitude: number) => {
  try {
    const result = await FetchDailyData(
      {
        excludeParameterMetadata: true,
        includeLocationName: false,
        latitude,
        longitude,
      },
      {
        clientId: CLIENT_ID,
        clientSecret: CLIENT_SECRET,
      },
    );
    console.log(result.features[0].properties.timeSeries);
  } catch (error) {
    console.err(error);
  }
};

References

Function Return Type Description
FetchHourlyData(params, headers) Promise<MetOfficeResponse> Fetches the hourly data
FetchThreeHourlyData(params, headers) Promise<MetOfficeResponse> Fetches the Three Hourly data
FetchDailyData(params, headers) Promise<MetOfficeResponse> Fetches the Daily Data

The inputs param for all these functions are the same:

params: {
    excludeParameterMetadata?: boolean;
    includeLocationName?: boolean;
    latitude: number;
    longitude: number;
  },
headers: {
  clientId: string;
  clientSecret: string;
}

Authors

Ali Rezaee nlndipi@hotmail.com

About

A node module to fetch from the met office's 3 APIs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published