Image of current location for notification?

Hi everybody,

is there a (somewhat simple) way to create an image (png/jpeg) of ones current position? When running, I have a shortcut on my phone that will send a notification home when triggered; the notification includes my current estimated address, distance to home, and estimated time I should arrive home.

While this is not really important, I thought it’d be nice to include an image of a map that shows my position. I know that this position can be shown in Home Assistant (and it is), but I would like to include it directly in the notification message, so that even people that don’t use Home Assistant (but might be notified via Signal or similar) would be able to see it.

Thank you for your ideas :slight_smile:

It is possible with Yandex Maps, not sure if it is suitable for your area.
I can compose a web link to a map based on given latitude, longitude and zoom.
And also I can compose a small jpg.

Thank you.

This seems to require an API key, so I will sign up for it and see what I can do. I live in Germany, and yandex maps displays my location just fine :slight_smile:

Could you please tell me how you compose the jpg file? I understand that you can use lang/lat etc. to generate a link that will display the map. But how do I get this map (which is a website / data) to become an image?

I am far away from a PC, will try to help you in a few days I hope.

Seems that this is a current link to Docs:

I am using this macro:

{% macro macro_map_COMPOSE_YM_STATIC_MAP(input_LATITUDE,input_LONGITUDE,
                                          input_LATITUDE_2,input_LONGITUDE_2) -%}
  {%- set LINK = 'https://static-maps.yandex.ru/1.x/?' +
                  'pl=' +
                  input_LONGITUDE|string + ',' + input_LATITUDE|string +
                  ',' +
                  input_LONGITUDE_2|string + ',' + input_LATITUDE_2|string +
                  '&pt=' +
                  input_LONGITUDE|string + ',' + input_LATITUDE|string +
                  ',' +
                  'pmwtm2' +
                  '~' +
                  input_LONGITUDE_2|string + ',' + input_LATITUDE_2|string +
                  ',' +
                  'pmwtm1' +
                  '&l=map' -%}
  {{ LINK }}
{%- endmacro %}

to get an image like this:
Untitled

This is a result generated by this demo example (just adapted my macro for playing):

{% set input_LATITUDE = 22.22 %}
{% set input_LONGITUDE = 33.33 %}
{% set input_LATITUDE_2 = 23.23 %}
{% set input_LONGITUDE_2 = 34.34 %}
  {%- set LINK = 'https://static-maps.yandex.ru/1.x/?' +
                  'pl=' +
                  input_LONGITUDE|string + ',' + input_LATITUDE|string +
                  ',' +
                  input_LONGITUDE_2|string + ',' + input_LATITUDE_2|string +
                  '&pt=' +
                  input_LONGITUDE|string + ',' + input_LATITUDE|string +
                  ',' +
                  'pmwtm2' +
                  '~' +
                  input_LONGITUDE_2|string + ',' + input_LATITUDE_2|string +
                  ',' +
                  'pmwtm1' +
                  '&l=map' -%}
  {{ LINK }}

Never tried to generate other types of images, I needed a way to see the latest route in Telegram for a person or device_tracker entity.

(Note that using Yandex Maps may cause issues like “why American gulf is still Mexican gulf”, “Why Ukrainian territories are marked as Russian” etc etc etc)