python-visualization / python-visualization/folium

How to add a fixed position (in screen) static custom Text (html) like Legend

Open
#1,718 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
7.4k
Forks
2.3k
Avg merge
17h 22m
Merged PRs (30d)
11

Description

Is your feature request related to a problem? Please describe.
Is there a way to just insert some overlay into the map with custom html code? Like legend but with descriptions or titles and such?

Describe the solution you'd like
There are clearly the elements like Layer control, Minimaps and such that are overlaid in the map, so I feel like there should be a way to put some boxes there with some custom contents. The contents can be static (generated from python string)

I'd prefer to do it with just a python string passed to some python function, without the need to write js or css ourselves if possible.

Describe alternatives you've considered

  • I've tried to make a jinja template and put the html file contents in a template, but didn't work with the html made from the map being something that needs to be inside iframe.
  • I tried to edit the html myself, but the map is generated from javacript.
  • I tried to add the element in the map.get_root() but it puts that on top, and if I use css to make it a overlay (I'm not good with it), then it somehow ends up below the map and invisible.

Additional context
I went through some issues thinking it should be there but didn't find anywhere.

https://github.com/python-visualization/folium/issues/86 says there used to be a custom map template you could make but it's gone now.
https://github.com/transport-nantes/tn_web/issues/135
https://github.com/python-visualization/folium/issues/781

Implementation
I'm not good with css or js, but I can do some python dev. If there is a easy way to just copy some parts from the LayerControl or such and add it, then I can help.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the existing LayerControl implementation and the map.get_root() entry point mentioned in the issue, along with the linked prior issues. Determine how a Python-provided static HTML overlay should be positioned above the map without requiring custom JavaScript or CSS. Done means the feature works in generated map output and supports the requested fixed-position content.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, html, javascript, python
Domain
data-visualization, frontend, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.