SetProperty for Map Widget

Hi, I need help using the Map widget to accomplish a couple of things:

  1. using Blynk.setProperty(V1, “color”, “#23C48E”); // GREEN to set the color of the marker showing the GPS position on the Map widget
  2. displaying more than a few characters in the small popup window that appears when the marker is touched

• HW: ESP8266 with WiFi
• iOS 13.3.1 App is 2.26.2
• Blynk server
• Blynk Library version 0.61

When I run the 3 examples (below) I get results as follows:

Example 1: A standard black marker is displayed at the correct GPS position. The setProperty call seems to have no effect on the color of the text or marker icon. Expected (hoped) to see a GREEN marker.

Example 2: When marker is touched the displayed text is truncated with the first item. I was expecting the complete string to be displayed, and hoping the newline ("\n") would force a second line of text. I’d like to display several short lines of data in the popup.

Example 3: no GPS marker is displayed. Not sure why this is.

Here is my example code, simplified to show the function I am working on:

//Output any data on Map widget!
//
//  App project setup:
 //   Map widget on V1
// *************************************************************/

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "xxxxxxxxxxxxxxxxxxxxx";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "xxxxxxxxxxxxx";
char pass[] = "xxxxxxxxxxxxx";

WidgetMap myMap(V1);

void setup()
{
  // Debug console
  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass);
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);

  // If you want to remove all points:
  myMap.clear();
  
  int airQualityIndex = 40;

  // Example 1
  
  char pmLabel [20];
  sprintf(pmLabel, "AQI:%3d\n", airQualityIndex);
  int index = 0;
  float lat = 37.9210;
  float lon = -122.5544;
  
  Blynk.setProperty(V1, "color", "#23C48E"); // GREEN
  myMap.location(index, lat, lon, pmLabel); // display GPS position with PM AQI label 

  // Example 2
  
  String pmLabel1;
  pmLabel1 += "Term 1";
  pmLabel1 += "\n";
  pmLabel1 += "Term 2";
  index = 1;
  lat = 37.9215;
  lon = -122.5549;
  myMap.location(index, lat, lon, pmLabel1); // display GPS position with PM AQI label 

  // Example 3
  
  pmLabel1 = " ";
  pmLabel1 += "Term 1";
  pmLabel1 += ",";
  pmLabel1 += "Term 2";
  index = 102;
  lat = 37.9218;
  lon = -122.5553;
  myMap.location(index, lat, lon, pmLabel1); // display GPS position with PM AQI label 
  
}

void loop()
{
  Blynk.run();
}

Any help appreciated!

This might help you with your label text:

And this might answer your other questions:

Using the forum’s search facility is always a good idea.

Pete.

setProperty won’t have effect. But there is a little hack on iOS which makes you be able to set the color for individual pin. To do so, use ordinary Blynk.virtualWrite(…) instead of map.location(index, lat, lon, label) and append your color string as last parameter.

Thanks Eugene! I have tried a couple of experiments below but with no luck:

 ...
  String HEXstring = String("#23C48E"); 
  Blynk.virtualWrite(V1, index, lat, lon, "label"+"#23C48E"); // V1 is Map pin
  Blynk.virtualWrite(V1, index, lat, lon, "label"+HEXstring); 
  Blynk.virtualWrite(V1, index, lat, lon, HEXstring);

Is there something else I need to do to append the color as you suggest? Thanks!

Drew

@drewc228 try

Blynk.virtualWrite(V1, index, lat, lon, "label", "#23C48E"); // V1 is Map pin

Thanks much, the colors changing as expected. Now, if I can just find a way to do multiple lines of text in the info box. Currently, I can get one line of text, about 20 characters or so. What I’d like to do is get something like this:
I have tried using the carriage return ("/r") and newline (/n") embedded in the text but so far no joy. Any thoughts or is it a current limitation of the Blynk Map widget? Thanks!

Apparently you can’t do multiple lines. At the moment a standard system callout bubble is shown with a specified text as a title.