Skip to content

Introduction to SmartMaps Weather

SmartMaps Weather is a simple and efficient library that allows you to interact with the SmartMaps Weather API. It provides convenient methods to retrieve weather data and forecasts for specific locations across Europe, enabling you to enhance your applications with accurate and reliable weather information. The data is provided by "Deutscher Wetterdienst".

Key Features

  • Diverse Data Models: The library utilizes various data models to structure the weather data, including:

    • Address: Represents an address with properties such as country, district, ZIP code, city, street, and house number.
    • Coordinates: Represents geographic coordinates with latitude and longitude.
    • Feature and FeatureCollection: Represent GeoJSON Feature and FeatureCollection objects for structured weather data.
    • HourlySummaryModel: Provides hourly summary weather data, including weather description, temperature, wind, humidity, rain, and cloud cover.
    • WeatherPredictionWithWeatherDetailsModel: Offers detailed weather prediction data for specific timestamps.
    • WeatherResponse: Represents the overall weather response, including copyright information, address, coordinates, current weather, hourly weather, hourly summary, and timezone.
  • Flexible Endpoints: The library supports various endpoints to accommodate different use cases:

    • Get weather data for a specific geographic point using latitude and longitude.
    • Retrieve weather data for a specific address using detailed address parameters.
    • Access weather data for a specific location using a location identifier.
    • Obtain weather data within a specified rectangular area.
    • Retrieve weather data along a defined polyline, useful for route-based weather insights.
  • Customizable Query Parameters: Tailor your weather data requests with a range of query parameters:

    • Specify the time range for weather data using DateTimeFrom and DateTimeUntil.
    • Adjust the level of detail in the weather data using the Details parameter.
  • GeoJSON Responses: The library returns weather data in the standardized GeoJSON format, making it easy to integrate with mapping libraries and geographic information systems.

Getting Started

To start using SmartMaps Weather:

  1. Install the library via npm:

    npm install @smartmaps/weather
    

  2. Import the Weather class from the package:

    import { Weather } from '@smartmaps/weather';
    

  3. Create a new Weather instance with your API key:

    const weather = new Weather('YOUR_API_KEY');
    

  4. Use the available methods to retrieve weather data:

    const weatherPointRequest = {
      latitude: 49.02,
      longitude: 8.44,
      // Additional parameters...
    };
    
    const currentWeather = await weather.point(weatherPointRequest);
    

Weather API Reference

The SmartMaps Weather API offers a comprehensive set of endpoints for retrieving weather data. Here are the main endpoints:

  • Get Weather at a Point: Retrieves weather data for a specific geographic point using a GET request.

  • Get Weather by Address: Retrieves weather data for a specific address using a GET request.

  • Get Weather by Location: Retrieves weather data for a specific location using a GET request.

  • Get Weather in a Rectangle: Retrieves weather data within a rectangular area using a GET request.

  • Get Weather along a Polyline: Retrieves weather data along a polyline using a POST request.

With SmartMaps Weather, you can effortlessly integrate weather data into your Node.js applications, providing your users with accurate and up-to-date weather information for locations across Europe.