Skip to content

Build a Node-RED Dashboard which overlays TWC weather maps on a HERE truck routing map

License

Notifications You must be signed in to change notification settings

johnwalicki/Node-RED-Weather-Routing-Logistics

Repository files navigation

Node-RED Weather Routing Logistics Dashboard

Build a Node-RED Dashboard which overlays TWC weather maps on a HERE truck routing map

This example might be useful for a package logistics company who wants to build logistics applications using TWC APIs that can help improve route planning, driver safety and equipment safety.  Using The Weather Company APIs to alert drivers of storm warnings and forecasts, wind advisories, winter conditions, and real time driving updates can improve package delivery times and protect drivers.

It uses The Weather Company APIs to display a near real-time North America Satellite / Radar Weather map on a Node-RED Dashboard. It could be extended to display TWC forecast map tiles of winter advisories, hail alerts, wind conditions, etc.

This Node-RED flow retrieves map tiles from the TWC Current Conditions package and, specifically, the Current Conditions Gridded Tiler APIs. There are many TWC weather map tile layers available. One of the APIs returns satellite and weather radar tiles. See the Node-RED-TWC-Weather-Radar-Map repository for additional examples.

It also uses the HERE.com Routing APIs to build a map navigation dashboard and plots the truck route on a Node-RED Dashboard.

To assist the driver during hazardous driving conditions, it uses the Watson Text to Speech service to narrate the route.

This example flow and Node-RED Dashboard might be useful as part of a Call for Code solution that uses TWC and HERE Technologies APIs. Natural disaster applications could guide someone to safety.

Prerequistes

API Keys

Set your TWC API, HERE API and Watson Text to Speech keys as environment variables before starting Node-RED

export TWCAPIKEY=<TWC API KEY>
export HEREAPIKEY=<HERE API KEY>
export WATSON_TTS=<Watson Text to Speech API KEY>

Node-RED flow in this repository:


A flow that displays a Weather Map and Navigation Route

Weather Routing Logistics Navigation Dashboard

Get the Code: Node-RED flow for Weather Logistics Routing / Navigation

Weather Routing Logistics flow

This flow has four sections:

  1. The Starting and Destination Locations / Geocode section displays a Node-RED Dashboard form which prompts the navigator to enter their starting location and ending destination. The flow then calls the HERE Geocode Search API to determine the latitude and longitude of the two waypoints.
  2. The Request Driving Navigation Instructions section calls the HERE Routing API to calculate the route between the two locations. It builds a table of these driving instructions and displays a summary of the route distance and driving duration.
  3. The Draw Map and Route section moves the truck on the node-red-contrib-web-worldmap as the navigator clicks on the Navigation Preview button. It loads the TWC Weather Satellite Radar tile overlays onto the worldmap to warn the driver of impending weather conditions.
  4. The Read the Driving Instructions section determines if the mute slider is on / off and uses the Watson Text to Speech service to read the driving instructions aloud. Paste your Watson Text to Speech credentials into the node.

Containerization

You might want to deploy this Node-RED flow to IBM Cloud Code Engine. The first step is to build a container. This repository includes a Makefile and a Dockerfile to assist in building a container.

  • Log into your Docker Hub account so the container can be hosted for Cloud deployment.

    docker login
  • Edit the variable at the top of the Makefile, if necessary. If you plan to push it to a Docker registry, make sure you enter your docker ID.

    • Change the following Makefile line:

      DOCKERHUB_ID:=<your docker registry account>
  • Enter the TWC, HERE, Watson TTS API Keys in the .env file (see .env.example for formatting)

  • Build the container, run the container, test the Node-RED Dashboard in the container, push the container to the Docker registry.

    make build
    make run
    make test
    make ui
    make push

Authors


Enjoy! Give us feedback if you have suggestions on how to improve this tutorial.

License

This tutorial is licensed under the Apache Software License, Version 2. Separate third party code objects invoked within this code pattern are licensed by their respective providers pursuant to their own separate licenses. Contributions are subject to the Developer Certificate of Origin, Version 1.1 (DCO) and the Apache Software License, Version 2.

About

Build a Node-RED Dashboard which overlays TWC weather maps on a HERE truck routing map

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published