Adding local icons to dash_leaflet.Marker

Hi, I made a nice little tool using dash_leaflet using various custom icons.
Currently, I’m hosting these icons on the web because I can’t seem to find any info on local hosting of these files. Does anyone know if this is possible?

Currently I make my markers using the following line of code:

dl.Marker(position=[lat, lon], icon={"iconUrl": iconUrl, "iconSize": icon_size, 'iconAnchor':iconAnchor}, title = obj_name)

Kind regards,

If you place the icons in the assets folder of your app, you should be able to use them as marker icons,

1 Like

Hello @ian2

Take a look the new changes for app.get_asset_url in Dash 2.2.0 Released.

1 Like

Thank you for message. I couldn’t make this work before. But, this was because I was importing the module I was working on, which is why it was expecting the assets map to be in my original working directory together with an Luckily you can define a new location for the assets folder when creating the app variable. So I got it working now.

Ah very nice they made it it a core function and not an attribute of the app object anymore.

1 Like