[SOLVED] Maps with http rest api

What do you mean by MCU?
I am not parsing out of terminal on the blynk app.
I connect in the blynk app to the map by selecting pin V30 in the map widget

MCU stands for: Micro Controller Unit ex. ESP8266, ESP32, Arduino Uno etc

The MCU is the raspberry pi, that gets the coordinates from a GPS tracker and then submits the data with the curl command to be used by the blynk app:

@JFdB Ok let’s try to work out what you are doing and then the fix for your problem.

GPS device passes data to a Pi, Pi sends data to Blynk server via curl to a Terminal on V30 and this appears on your phone in the Terminal widget.
You want to see these details in the map widget.

Well I can say we have a similar system and I have previously posted Google Earth maps of the tracks we have created that appeared in the map widget on the phone.

Our system is similar but subtly different and more straightforward than yours. We have a GPS tracker that looks like it’s hooked up to one of our Pi’s but in actual fact it’s hooked up to a mighty WeMos that happens to reside in a Pi case.

So the WeMos does everything for us with a bit of C++ code to update the map widget as the WeMos is connected to Blynk’s server i.e. no API / curl involved.

Question: in your project which hardware device do you have as connected to the Blynk server? The one and only Pi that is connected to the GPS device, another Pi, an ESP8266, an Arduino, something else or “nothing”?

Short answer, nothing is connected to the blynk server. The pi is the only hardware. But I can use a python script on the pi to connect to the blynk server, Is there a simple phyton script to submit map data to the blynk server that I can call from a bash shell with the GPS coordinates?

I suspected the answer was going to be “nothing” and it’s a concept I find quite strange.
So Blynk has nothing to control.

Ignore my rambling it’s sleep deprivation and a different mindset I have about iOT.

That said have you considered hooking up a $3 MCU to Blynk and writing a few lines of C++?

Until such time as Blynk adds the map widget to the API then I think the line above is the only solution for you. It doesn’t have to be C++ and you can use the Pi that’s hooked up to the GPS device if you wanted and have the correct coding skillset.

Terminal shows what you sent - a single string value. The Map widget accepts multiple values.

Try the following:

curl -v -L --include \
     --request PUT \
     --header "Content-Type: application/json" \
     --data-binary "[
    \"1\", \"52.2949\", \"-4.8610\", \"Test\"
]" \
1 Like

Or - Blynk HTTP Api - Add and Write value to table row

Dear Eugene, absolutely brilliant!!!
This solved it, it works for me, I can see the indicator on the map.
So the problem was that I was sending a single string, what needed to be done is sending 4 separate values (strings).
Now I will try the solution proposed by Dmitriy

1 Like

Dmitriy, your method does also work.
curl -v http://blynk-cloud.com/auth-token/update/V30?"value=30&value=52.2949&value=4.8610&value=Test"

does also work (note the quotes around the values being send)
Now this truly can be considered
SOLVED MAPS with http rest api

After a few hours sleep I was going to suggest what @Dmitriy wrote and it’s nice to see the curl syntax from @Eugene

I think quotes are not necessary.

They are, I tried without, does not work

Hi @JFdB could you share your entire code, please

Dear Maha1,
here is the relevant part of my python code. Note that value0 can be changed to “1” for a second marker:

 payload = {'value': [value0 , value1, value2, value3]}
 r=requests.get('http://blynk-cloud.com/xxx/update/V30', params=payload)

@JFdB thank you very much
but how did you get lonDeg, latDeg and GPSdate ?
are you using a GPS module ?

LatDeg and LonDef are GPS coordinates, GPSdate is the date that I get from my GPS module.
The problem that was addressed in this post is how to get a marker on the MAP in Blynk when you have GPS coordinates. The GPSdate is not necessary, but it will display a banner with the date together with the marker on the blynk map

well i took coordinate from google and made a try but unfortunaty nothing appears on the map

import BlynkLib
import requests
from urllib2 import Request, urlopen

BLYNK_AUTH = ' ********* '

# initialize Blyn
blynk = BlynkLib.Blynk(BLYNK_AUTH)
lon= "5.400000"
pay = {'value': [v , lat, lon]}
r=requests.get('http://blynk-cloud.com/BLYNK_AUTH /update/V6',params=pay)

what am i doing wrong ?