This repository includes an example of a First Class Swarmauri Example.
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file swarmauri_tool_folium-0.10.0.dev7.tar.gz.
File metadata
- Download URL: swarmauri_tool_folium-0.10.0.dev7.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d3dff629035a05832ea4e8638f9f582fd8087a7a701c50485e46a61533e1294
|
|
| MD5 |
eb5539f078cf57c1133c04e180ea62ab
|
|
| BLAKE2b-256 |
e73aa9cf54788c8c8d2165d6549096d857d9e377a0e3ade73d3129968ef02923
|
File details
Details for the file swarmauri_tool_folium-0.10.0.dev7-py3-none-any.whl.
File metadata
- Download URL: swarmauri_tool_folium-0.10.0.dev7-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1b3c25207400a05c8140f2b7d6c33ad653c95fd4c2b382e78a05aaaffa95b38
|
|
| MD5 |
6fdc5310594660e652f3c7372aead7bf
|
|
| BLAKE2b-256 |
0b2b41713a02289b9beb6918d0058af60556382d6580fa50d4c393805616b9d0
|