Display attribute value on map?

gps-history-block
#1

Is it possible to display a number associated with a device in the gps map (without having the click)? We’d like the ability to display temperatures for each device in a map at a quick glance.

#2

Good Morning @paul_wareham

Yes, you can do this with images. I do like the idea of just displaying text values as the “icon”. I’ll toss that to the Engineering Team to see what they think.

But for now, the GPS History block supports come nice pin style config:

Because this is just Markdown behind the scenes (Markdown is sprinkled in a bunch of places in the platform), you can use images here.

Now, where things get tricky is making things work for every temperature value without having to generate hundreds of images. I have an idea there, I’m going to build an example for you.

#3

Excellent. Thank you!

#4

I was able to get something working. There are web services that allow you to generate random placeholder images. Instead of generating a ton of images, we could make use of one of them. In this case, I’m using fakeimg.pl, but there are many similar services out there.

Using it, we can generate an image, with just a number, and a transparent background.

https://fakeimg.pl/100/ffffff,0/fff/?text=79

All the options you can configure are here: https://github.com/Rydgel/Fake-images-please

Now that we can make images on the fly, we can add that to Losant. I have the following in my icon template:

https://fakeimg.pl/100/ffffff,0/fff/?text={{data.temp}}

In my case, {{data.temp}} reflects the temp value for that data point (your’s may be different). But now, you’ll get this:

I hope this helps! I did add that feature request to our ticketing system.

1 Like