Skip to main content

This repository includes an example of a First Class Swarmauri Example.

Project description

Swarmauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_tool_folium

---

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.Map parameters (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

swarmauri_tool_folium-0.10.1.dev2.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

swarmauri_tool_folium-0.10.1.dev2-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file swarmauri_tool_folium-0.10.1.dev2.tar.gz.

File metadata

  • Download URL: swarmauri_tool_folium-0.10.1.dev2.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","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

Hashes for swarmauri_tool_folium-0.10.1.dev2.tar.gz
Algorithm Hash digest
SHA256 728195ed9c5f3c32e4c00995f4f2f9912226c1a78ec5d39e3d3c327f1c05ac8d
MD5 73e934a7f8bb564813455b45a3a8b359
BLAKE2b-256 f51131d643d9af789677157c4a5f63e612d35cc43b7b7acc6749dafce6871985

See more details on using hashes here.

File details

Details for the file swarmauri_tool_folium-0.10.1.dev2-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_tool_folium-0.10.1.dev2-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","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

Hashes for swarmauri_tool_folium-0.10.1.dev2-py3-none-any.whl
Algorithm Hash digest
SHA256 b56b246851ce905ee56c533f7dadf8fe0333cc78105faab2c7f52cb0f3a0411e
MD5 328c501847f005ef5f4f39da045bdddd
BLAKE2b-256 6351f4ebd7c6b6955d80441380a2bf3d4577f9d85e71fd2d052685ea5bbd2ab5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page