Search code examples
gpsibm-cloudnode-red

How to visualize GPS coordinates on a map using Node red?


I'm trying to track the location of an object/vehicle for this, I'm using a GY-GPS6MV2 module for getting GPS coordinates. I'm streaming those values to Bluemix - Internet of Things cloud platform and trying to visualize the data on maps from node red using the WorldMap node. But while doing so I couldn't map them on the OpenStreetMap.
I have gone through the documentation on WorldMap node. But couldn't get the insights which are useful for me. Can you please help in this context?

Link :WorldMap NodeRed

Part of my NodeRed flow

Output of Merge Node


Solution

  • From the worldmap node docs:

    Usage

    Plots "things" on a map. The map will be served from {httpRoot}/worldmap

    The minimum msg.payload must contain name, lat and lon properties, e.g.

    {name:"Joe", lat:51, lon:-1.05} 
    

    name must be a unique identifier across the whole map. Repeated location updates to the same name move the point.

    At the moment your msg.payload is a string with lat, then 2 new lines and then the lon value. You need to build a msg.payload that matches what's in the doc. This is probably best done directly from the output of the IBM IoT node as it looks to already be a JSON object which will make it easier to extract the correct values.