Reading GPS data from MySQL to plot on World map

Hey everyone,

I have the following flow:

GPS Tracker provides data, change node changes keys into Worldmap format, Insert that data into a Mysql db and plot on Worldmap. Works no problem.

I want to read the db records in descending order from the DB based on time and plot the data on Worldmap.

I have set up an inject node to inject every 5 seconds and Query the DB for the latest record.

My SELECT QUERY is:

msg.topic = "SELECT time, lat, lon, speed, direction FROM TrackDB ORDER by time DESC LIMIT 1";
return msg;

I receive this object:

30%20PM

The next trigger produces the same record, not the next one in sequence.

I've read the forum over and over to find out what I'm doing wrong, to no avail.

Any help is greatly appreciated.

Thanks

How often is the data in the database updated? That sql statement will only ever return 1 row so if no daa is updated or added, it will return the same row every time it is run

The data input can be much quicker than the inject node.

There is always data recorded.

I cannot figure out how to iterate through the records that a currently in the db.

Put a debug node showing the output of the inserting db node and capture a successful insert followed by the result of the inject where it does not show the latest sample. Post it here so we can see.

and take out your limit statement and see if more are returned

Slight distraction I know, but if you included the name in the query and it was in the result array you could just send the array to the map as received.