Blynk 2.0 Map Advice

For updating maps (both mobile and web), which method should we use? i.e

Blynk.virtualWrite(V1, LNG, LAT);

or

WidgetMap myMap(V1);
myMap.location(1, LAT, LNG, "Beehive1");

How do we update the “IP LAT/LON” on the Device Info page? For me it shows an incorrect location on the web dashboard and “No Value” on the Android app.

Both work, but as I understand it, the…

method is for legacy compatibility, although it does have more functionality than the new method.

I think those coordinates come from doing an IP location lookup, and will be based on data from your ISP - which will often be the location of their regional office …

Try pasting your public IP address into a service like this:

and you’ll see what I mean.

Pete.

Date from maps in MAPBOX is not always good. In Thailand some have 3 years.

I have no idea what this means, or how it relates to the subject being discussed.

Pete.

12.840704767517373, 100.92318259022902

We can’t do much here at the moment. We have in the plans to provide an alternative. But that’s not gonna happen soon

Thanks for replying Pete.

I have a few beehives sending data to a WiFi connected esp32 running blynk, which then sends values up from each hive that’s transmitting via LoRa.

I want to show the location of each hive on the map, my original plan was a map per tab/hive but I see only a single map is allowed. Is it possible to add labels or custom location marker icons in an update to allow and differentiate multiple GPS coordinates on a single map?

Go to Settings > Locations and add a number of different locations. You can fine-tune the exact spot by dragging the pointer on the map.

Go to your Template, Metadata tab and Edit. You should have an entry of type “Location”, edit this to enable location and type something in the location field - I’d recommend simply “Location”, as this doesn’t seem to do anything as far as the rest of the process is concerned. Then turn on the “Editable by End Users” option and save/apply the changes

The go to Devices (the spyglass icon) select your device then go to the Metadata tab. You should see a “Location” entry. Hover over this and you’ll see an Edit icon. This then pops-up a Choose Location drop-down menu where you can pick the previously created location.
There’s also a “Create New Location” button, which you could use instead of the Settings > Locations option.

When you’re in the Device (Spyglass) view you have this globe icon…

image

and that will show your devices on the map…

Pete.

Hi Pete,

The problem I have is there’s only one device in Blynk, as all of the beehives connect back to a single device running blynk.

I was hoping that the myMap wrapper would allow multiple GPS points to be added to a single map in the app, i.e:

myMap.location(1, LAT1, LNG1, "Beehive1");
myMap.location(2, LAT2, LNG2, "Beehive2");

The end result for users being something like this:

And have you tried that approach?

Pete.

Hi Pete,

I just tested, it only shows the first myMap.location, all others are ignored.

I’ve setup the legacy blynk to see if it works and it does:

void setup()
{
  Serial.begin(115200);
  Blynk.begin(auth, ssid, pass);

  myMap.clear();

  int index = 0;
  float lat = 52.698728;
  float lon = -0.308142;
  myMap.location(index, lat, lon, "Beehive 1");

  int index2 = 1;
  float lat2 = 52.790176;
  float lon2 = -0.654443;
  myMap.location(index2, lat2, lon2, "beehive 2");
}

If you are OK with a static map, you can use an image button pointing to a google map api URL.
You can add location markers, etc.
link
You could also dynamically create the URL using:
Blynk.setProperty(V1, "url", 1, "https://.....");

You would need to sign up and get an API key though. A certain number of API calls are apparently free.

Good idea but it looks like they don’t offer any free\development plans for the static maps.

@Dmitriy, are we able to add back in the legacy WidgetMap and also show the location labels as before?

Hi @chinswain, my app is using Map and labels successfully like this. I can also dynamically change the color of the marker using a var for the last argument in the call.

sprintf(pmLabel, "PM2.5:%4dug/m3\n", dustvalues1.PM2_5Val_atm); // use PM2.5 value for marker label

 Blynk.virtualWrite(V5, markerNum, latID, lonID, pmLabel, newColor); // update marker position=GPS, color=PMAQI (marker color hack for iOS)

Are you using WidgetMap?

This only shows a single location as before:

  float lat = 51.879699;
  float lon = -0.187968;
  Blynk.virtualWrite(V4, 0, lat, lon, 1234, "test1");

  float lat2 = 52.879699;
  float lon2 = -0.187968;
  Blynk.virtualWrite(V4, 1, lat2, lon2, 4321, "test2");

@Dmitriy, Could you add multiple location (With label) functionality similar to legacy Blynk?

@Dmitriy I would like to second this request. I am migrating from Blynk legacy to Blynk 2.0 and I have the same problem. Could you add multiple location (With label) functionality similar to legacy Blynk to Blynk 2.0?