필터 지우기
필터 지우기

How should I present multiple point on the map in ThingSpeak Visualization code?

조회 수: 7 (최근 30일)
I am working on showing the coordinate on the map in my ThingSpeak channel. However, it only allow to show 1 coordinate on my created map. How should I hold the previous coordinate, then adding multiple coordinate continuously without refreshing the webpage? (Paid license account)
Hopefully someone can provide your suggestion to me. Thanks in advance.

채택된 답변

Christopher Stapels
Christopher Stapels 2022년 5월 31일
편집: Christopher Stapels 2023년 8월 7일
I recommend writing the position data to your channel feed in the latitude and longitude fields.
https://api.thingspeak.com/update.json?api_key=xxxxxxxxxxxxxxxx&lat=22.3&long=34.5
Then in your MATLAB visualization, use thingSpeakRead, and set the name-value pair 'location' to true.
myData=thingSpeakRead(876466,'Location',true,'outputformat','timetable','numPoints',10);
now you can use geoscatter or any of the other great mapping functions to plot your data.
geoscatter(myData.Latitude,myData.Longitude)

추가 답변 (1개)

Fabio Battagion
Fabio Battagion 2023년 8월 7일
Chris,
if I set the LAT and LON values in the Channel Setting (from the channel definition interface), I see that the location information (lat & lon) are not available for geoscatter() function. So, i should write all the time, in addition to the fileds loaded in the channel, also the LAT & LON values. Is it true?
Thanks
Fabio
  댓글 수: 1
Christopher Stapels
Christopher Stapels 2023년 8월 7일
LAT and LON values in the Channel Setting are for the channel location which is intended to be static. In the data feed, lattitue and longitude are for the device location. You can set the device location using the write data api or with thingSpeakWrite. The channel location is like the base station, and the device location is intended to be where the measurements are coming from.
That said, you can read the channel information with the Read Settings API, but I would not use this for your use case. Be careful if you do use that one, it needs the user API, not the channel API (for the above you use the channel API).

댓글을 달려면 로그인하십시오.

커뮤니티

더 많은 답변 보기:  ThingSpeak 커뮤니티

카테고리

Help CenterFile Exchange에서 REST API에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by