Hi!
What is the correct formatting of latitude and longitude in the feed for the map block in dashboards? :)
Thank you!
Map block formatting
Moderators: adafruit_support_bill, adafruit
Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
- mikeysklar
- Posts: 13824
- Joined: Mon Aug 01, 2016 8:10 pm
Re: Map block formatting
This bit might help the format:
https://cdn-learn.adafruit.com/download ... cs-gps.pdf
https://cdn-learn.adafruit.com/download ... cs-gps.pdf
The Adafruit IO MQTT CSV feed topic expects data published in the following format:
Code: Select all
sensor_value,latitude,longitude,elevation
So if we were sending speed in MPH as our sensor value, the data would look like
this:
Code: Select all
23,39.283277, -76.611818,10
- richardek
- Posts: 8
- Joined: Sun Mar 26, 2023 6:26 am
Re: Map block formatting
Thank you for your reply mikeysklar!
I tried that, but the map is still stuck over New York =/
I tried that, but the map is still stuck over New York =/
- mikeysklar
- Posts: 13824
- Joined: Mon Aug 01, 2016 8:10 pm
Re: Map block formatting
Can you post your code? Maybe something is off syntax wise?
- brubell
- Learn User Page
- Posts: 2010
- Joined: Fri Jul 17, 2015 10:33 pm
Re: Map block formatting
Please post your code
- richardek
- Posts: 8
- Joined: Sun Mar 26, 2023 6:26 am
Re: Map block formatting
Here is my feed. I have tried to add the value but the map widget is still showing New York.
- mikeysklar
- Posts: 13824
- Joined: Mon Aug 01, 2016 8:10 pm
Re: Map block formatting
We will still need to see the code to assist you. The values shown are in the feed match the mapping for NYC.
- richardek
- Posts: 8
- Joined: Sun Mar 26, 2023 6:26 am
Re: Map block formatting
Do I need to code anything for the map block to work? I'm just sending the coordinates from my microcontroller (Arduino C++)
- mikeysklar
- Posts: 13824
- Joined: Mon Aug 01, 2016 8:10 pm
Re: Map block formatting
The code on your microcontroller is what we want to see. There could be some sort of syntax issue or incorrect API usage.
- richardek
- Posts: 8
- Joined: Sun Mar 26, 2023 6:26 am
Re: Map block formatting
Thanks for you reply mikeysklar, here it is =)
Code: Select all
char position[] = "23,59.8050101,17.6260959,10";
// Publish the data as raw data to the MQTT server
mqtt.pubRaw(DEFAULT_LINK_ID, "my-account/feeds/position", position);
- mikeysklar
- Posts: 13824
- Joined: Mon Aug 01, 2016 8:10 pm
Re: Map block formatting
Looking at the docs for location publishing you might want to try publishing as CSV instead of pubraw.
https://io.adafruit.com/api/docs/mqtt.h ... ending-csv
https://io.adafruit.com/api/docs/mqtt.h ... ending-csv
Sending CSV
Alternatively, you can send location tagged data to /csv topics. In this example, that would be the topic mosfet/feeds/photocell-one/csv instead of mosfet/feeds/photocell-one. Both store data in the same feed. The format IO expects for location tagged CSV data is VALUE, LATITUDE, LONGITUDE, ELEVATION.
With the example data shown before, that means you could publish the string "22.587,38.1123,-91.2325,112" to mosfet/feeds/photocell-one/csv. to store the value "22.587" in the location latitude: 38.1123, longitude: -91.2325, elevation: 112.
- richardek
- Posts: 8
- Joined: Sun Mar 26, 2023 6:26 am
Re: Map block formatting
Oh that's a great point!! I'll try that.
Thank you mikeysklar! :D
Thank you mikeysklar! :D
- richardek
- Posts: 8
- Joined: Sun Mar 26, 2023 6:26 am
Re: Map block formatting
Yess!! That made it! 😃🙏
Thank you so much mikeysklar!
Thank you so much mikeysklar!
- mikeysklar
- Posts: 13824
- Joined: Mon Aug 01, 2016 8:10 pm
Re: Map block formatting
Cool, what syntax did you end up using? Can you paste it in for other that get hung up on this.
- richardek
- Posts: 8
- Joined: Sun Mar 26, 2023 6:26 am
Re: Map block formatting
Just added the /csv at the end of the topic address. =D
Code: Select all
char position[] = "23,59.8050101,17.6260959,10";
// Publish the data as raw data to the MQTT server
mqtt.pubRaw(DEFAULT_LINK_ID, "my-account/feeds/position/csv", position);
Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.