Trying to update GPS Location in a Thingspeak Channel, using a json Webhook from Particle

HI,

Using the Particle Asset Tracker, Particle Web hooks and Thingspeak. I am trying to get my device to show it’s GPS location in the Thingspeak Channel, (along with a plot of historical location).

My Web Hook looks as follows;

{
  "api_key": "{{k}}",
  "field1": "{{X}}",
  "field2": "{{Y}}",
  "field3": "{{Z}}",
  "field4": "{{vcell}}",
  "field5": "{{vsoc}}",
  "field6": "{{rssi}}",
  "field7": "{{qual}}",
  "field8": "{{loctype}}",
  "Latitude": "{{Latitude}}",
  "Longitude": "{{Longitude}}",
  "Elevation": "{{Elevation}}",
  "Status": "{{s}}"
}

Data is being passed successfully to Thingspeak, via Particle, from my Device;
From Event Viewer:

{
"X":2992
"Y":-3168
"Z":21712
"vcell":4.04
"vsoc":82.543
"rssi":-81
"qual":43
"loctype":1
"Latitude":26.00000
"Longitude":28.00000
"Elevation":1589
"k":"XXXXXXXXXXXXXXXXXX"
}

However the GPS location on the Thingspeak Map doesn’t change.

On the Thingspeak Channel Config, Show Channel Location is ticked.

Can anyone give me some direction?
Am I correct in thinking that if the device is mobile, i should be able to get a plot of the device location on a Thingspeak map?

Much appreciated!

I thought you found your problem in the other thread

That was mapping fields 1 through 8…
Now I’m trying to use the channel lat and long to show the device’s current position and history, without ‘wasting’ 2 of the 8 fields available.
My understanding is this is possible, (including elevation).

I have a suspicion my json string may need to include an ‘update’ directive…?

Once i have that right, i then need to start using the device locator through Google, should i not be able to acquire GPS position. … (which is the other problem I’m busy with)

There are two types of locations in ThingSpeak. One is your channel location, which is set in the channel settings page or with the channel settings API. The other is the feed location, which is a location for each measurement in a channel feed. This is the one you probably might want to use to track a device location. But, there is not a built in map (like for the channel location) for that one. You can add a MATLAB visualization as follows:
data=thingSpeakRead(channelNo,‘location’,true,‘readkey’,ReadAPIKey…
,‘outputformat’,‘timetable’)
geoscatter(data.Latitude,data.Longitude,‘r*’);
ax=gca;
ax.ZoomLevel=4;

You can also do this with multiple points. (set ‘numPoints’, x) to do x points.

You can also take a look at https://www.mathworks.com/help/thingspeak/visualize-path-traversed-using-vector-maps.html although much of this does not need the mapping toolbox anymore, its in base MATLAB now, some of it might.

1 Like