Gps dashboard for live location


i have placed gps in the right place.and it is showing the correct coordinates now on mobile app.Now it will not be a problem for us.

OK - I can understand the 0,0 if you have no signal (eg indoors) - but the 1.5 e+28 makes no sense.
Those latest ones are even worse -
image
Again they will never appear on a map.

So yes -- I think the change node is probably now ok - (if you now move the debug to after the change node to check) and we should have a payload with a lat lon and name... - but until the decoder sends out sensible values they will never plot ok.

@dceejay i have placed gps on terrace and checked the coordinates it show correct.


but these are latest values in node red which do not match
lon--2.5547601597923975e-24
lat--2.3314581873174617e-17

indeed - so the buffer parser is wrong. Was it ever working ?
I thought that was your other thread ?

i don't understand about other thread?so you are saying buffer parser is not working properly but all others including you said to use it.do u have some fix?

The buffer parser "was" setup and working as follows...

According to the PDF with sample data you could so this...

which matches this...
image

using buffer parser set as per the info you provided...

Link to thread

however

The values still need some math as per the PDF
For example, you can clearly see from the screenshots above, we correctly make the values
lat: 5007.4965 and lon:838.1157 just like in the screenshot of your documentation
NOTE however that is not the end of the work - you need to apply the maths it states to turn those into usable coordinates.

So, to progress this, you could add a function node AFTER the buffer-parser and perform the necessary maths on msg.payload.lat and msg.payload.lon to make usable coordinates.

the buffer parser is a good node - but has to be configured correctly to decode your binary data - from your other thread- - Creation of Function Node

(edit) _ Ah Steve arrived... thanks... -- ^^^

PS - maybe don't need a function... just use your new scaling capability to / 100 ?

1 Like

Dont know if its that simple dave - its a strange format.

@steve i agree with your statement that math has to be applied onto the functional node.could u pls send us ur complete flow with maths function on it so that it will be easy for me to see the coordinates on map.Or modify the flow that i am sending so it gives the desired output.flows.json (5.1 KB)

The info was all there in your PDF - simple maths!

//example data  {lat: 5007.4965 , lon:838.1157 }

function floatToGPScoord(num) {
    var d = parseInt (num / 100)
    var m = parseInt(num) - (d*100)
    var s = num -  parseInt(num)
    var coord = d+((m+s)/60)
    return coord
}
msg.origPayload = {
    lat: msg.payload.lat,
    lon: msg.payload.lon
}
msg.payload.lat = floatToGPScoord(msg.payload.lat);
msg.payload.lon = floatToGPScoord(msg.payload.lon);
return msg;

test flow...

[{"id":"530d0a36.40cd24","type":"function","z":"6ca7c67d.98d848","name":"floatToGPScoord","func":"//example data  {lat: 5007.4965 , lon:838.1157 }\n\nfunction floatToGPScoord(num) {\n    var d = parseInt (num / 100)\n    var m = parseInt(num) - (d*100)\n    var s = num -  parseInt(num)\n    var coord = d+((m+s)/60)\n    return coord\n}\nmsg.origPayload = {\n    lat: msg.payload.lat,\n    lon: msg.payload.lon\n}\nmsg.payload.lat = floatToGPScoord(msg.payload.lat);\nmsg.payload.lon = floatToGPScoord(msg.payload.lon);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1270,"y":140,"wires":[["84cf7119.e970e"]]},{"id":"99b86a91.cc8f18","type":"inject","z":"6ca7c67d.98d848","name":"test data AgH5e5xFaIdRRA==","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"data\":\"AgH5e5xFaIdRRA==\"}","payloadType":"json","x":720,"y":80,"wires":[["88fc873f.c086c8"]]},{"id":"2bb51028.cbdab","type":"buffer-parser","z":"6ca7c67d.98d848","name":"","data":"payload.data","dataType":"msg","specification":"spec","specificationType":"ui","items":[{"type":"floatle","name":"lat","offset":2,"length":1,"offsetbit":0,"scale":1,"mask":""},{"type":"floatle","name":"lon","offset":6,"length":1,"offsetbit":0,"scale":1,"mask":""}],"swap1":"","swap2":"","swap3":"","swap1Type":"swap","swap2Type":"swap","swap3Type":"swap","msgProperty":"payload","msgPropertyType":"str","resultType":"keyvalue","resultTypeType":"output","multipleResult":false,"setTopic":true,"x":1070,"y":140,"wires":[["530d0a36.40cd24","ed6ed918.3daa58"]]},{"id":"2057e639.f3a49a","type":"debug","z":"6ca7c67d.98d848","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1250,"y":200,"wires":[]},{"id":"363f26cc.7e8fda","type":"inject","z":"6ca7c67d.98d848","name":"click me","props":[{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":660,"y":140,"wires":[["2b6a66d1.86484a"]]},{"id":"2b6a66d1.86484a","type":"function","z":"6ca7c67d.98d848","name":"test data 02 01 F9 7B 9C 45 68 87 51 44","func":"msg.payload = { data: Buffer.from(\"0201F97B9C4568875144\", \"hex\") }\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":760,"y":200,"wires":[["2bb51028.cbdab","29572a95.8942b6"]]},{"id":"88fc873f.c086c8","type":"base64","z":"6ca7c67d.98d848","name":"","action":"","property":"payload.data","x":940,"y":80,"wires":[["2bb51028.cbdab"]]},{"id":"29572a95.8942b6","type":"debug","z":"6ca7c67d.98d848","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":890,"y":240,"wires":[]},{"id":"84cf7119.e970e","type":"change","z":"6ca7c67d.98d848","name":"set name","rules":[{"t":"set","p":"payload.name","pt":"msg","to":"apple","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1080,"y":200,"wires":[["2057e639.f3a49a"]]},{"id":"ed6ed918.3daa58","type":"debug","z":"6ca7c67d.98d848","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":1250,"y":80,"wires":[]}]
2 Likes

Thanks Steve I am receiving this output but final step to plot them on world map.For which i added the world map node but it is not plotting the coordinates received in real time.Also would like to add some information this sensor is sending data every 3 minutes,also it is sending two packets of data as u can see in the sidebar or debug window.



I dont know much about this node - cant help.

Again, I dont know much about this node - cant help.

put a debug on the output of the MQTT node - are 2 MQTT payloads being sent (that will be the reason for 2 outputs) i.e. it is probably NOT a problem with this flow (i.e. the 2 message problem lies external to this flow)

1 Like

Anyways Thanks Steve :blush:

The values you show should now plot on the map
image
(though the second is a bit strange...)
The map needs to be connected (Yes - I can see the green dot so that's ok) - you may need to zoom/scroll the map to find it... or maybe set the map to auto-pan to the marker.

@dceejay Yes it is near my location now.but how can i add a marker to repsent it?

If I set the auto pan enabled
image
and zoom to 10
and then send in the data you had above (manually as I don't have your flow)

Then I get a map like

can u share ur flow please?

It's your flow ! I just added one inject as I don't have live data

[{"id":"36242835.3b7ff8","type":"inject","z":"e9b4dddd.70115","name":"{\"lat\":28.3196,\"lon\":76.96}","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"lat\":28.3196,\"lon\":76.96}","payloadType":"json","x":530,"y":920,"wires":[["84cf7119.e970e"]]}]
1 Like

Thank you dceejay.i had use case that i want to build regarding worldmap
1)If I want to track the path of a moving truck or forklifter as well as show its all history of data(latitude and longitude) along with other information(such as speed,fuel etc) from one particurlar date to another on a using table.wanted to know that what are other features that world map provides that one can use in his or her application on Node Red.

could u share your complete flow not just inject node ?as i wanted to see how it works