Swarmauri Tool Folium
Generates an interactive Folium map with optional markers and returns the HTML as a base64-encoded string. Designed for embedding maps in Swarmauri workflows or downstream UIs.
Features
- Accepts a map center
(lat, lon)plus an optional list of markers(lat, lon, popup). - Creates a Folium map (HTML) and returns
{"image_b64": <base64-html>}. - Easy to extend with additional Folium layers/tiles by subclassing.
Prerequisites
- Python 3.10 or newer.
folium(installed automatically).- Network access if Folium needs to load tiles from external providers at render time.
Installation
# pip
pip install swarmauri_tool_folium
# poetry
poetry add swarmauri_tool_folium
# uv (pyproject-based projects)
uv add swarmauri_tool_folium
Quickstart
import base64
from pathlib import Path
from swarmauri_tool_folium import FoliumTool
map_center = (40.7128, -74.0060)
markers = [(40.7128, -74.0060, "Marker 1"), (40.7328, -74.0010, "Marker 2")]
result = FoliumTool()(map_center, markers)
html_bytes = base64.b64decode(result["image_b64"])
Path("map.html").write_bytes(html_bytes)
Open map.html in a browser to interact with the generated map.
Tips
- Customize map appearance by subclassing and adjusting
folium.Mapparameters (tiles,zoom_start, etc.). - Add other Folium layers (heatmaps, choropleths) before saving to build richer visualizations.
- When serving maps via APIs, return the base64 string directly or write to a temporary HTML file and send its path.
Want to help?
If you want to contribute to swarmauri-sdk, read up on our guidelines for contributing that will help you get started.
Metadata
Release files for swarmauri_tool_folium 0.10.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| swarmauri_tool_folium-0.10.0.tar.gz | 7.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| swarmauri_tool_folium-0.10.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.2 kB
Release files / swarmauri_tool_folium-0.10.0.tar.gz
| Download URL | swarmauri_tool_folium-0.10.0.tar.gz |
|---|---|
| Size | 7.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5899e6a6017ab59883372e59b57193c23e6b6cbd00435320fc67234f049c685f
|
|
BLAKE2b-256 checksum How to use checksums |
b4e09b551bfd1b23dacbe10ebd7a9c93a23fc000f24850dc3ebd198f9b9b112c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / swarmauri_tool_folium-0.10.0-py3-none-any.whl
| Download URL | swarmauri_tool_folium-0.10.0-py3-none-any.whl |
|---|---|
| Size | 8.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f347c73c58aad7e2884c801a4639ddf88672669415c599d449c3e2c5294ed567
|
|
BLAKE2b-256 checksum How to use checksums |
18db55dbf8dbf73f4a11d6fb07af34c3c379012404ca423684f70560fc036a98
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|