Skip to content

Add interactive mapping example and update README with example link #2156

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,24 @@ and we'd love to have you hang out in our community.

See `our complete contributor's guide <https://github.com/python-visualization/folium/blob/main/.github/CONTRIBUTING.md>`_ for more info.

Examples
--------

Explore some use cases and working examples in the ``examples/`` directory:

- `Interactive Map Example <https://github.com/python-visualization/folium/blob/main/examples/interactive_map_example.py>`_: A simple example showing how to create a map with markers and popups using Python.
- Launch examples in a live environment via |binder|.
This example shows how to create an interactive map using `folium` with a marker and popup.
To run this example, navigate to the folium repo root and run:

.. code:: bash

python examples/interactive_map_example.py

This will create an HTML file called `interactive_map_example.html` that can be opened in any web browser.
The resulting map is centered on San Francisco and includes a popup marker labeled "San Francisco".



Changelog
---------
Expand Down
10 changes: 10 additions & 0 deletions examples/interactive_map_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import folium

# Create a basic map
m = folium.Map(location=[37.7749, -122.4194], zoom_start=12)

# Add a marker
folium.Marker([37.7749, -122.4194], popup="San Francisco").add_to(m)

# Save to HTML
m.save("interactive_map_example.html")