A Python library for creating interactive web maps, optimized for LLM-assisted development.
Project description
LLMaps
A Python library for creating interactive web maps, optimized for LLM-assisted development.
Encapsulates best practices for interactive web map development behind a predictable, composable API — so both you and your LLM produce correct code on the first try. Outputs a single HTML file powered by MapLibre GL JS.
Table of Contents
Features
- Declarative API — composable
Map+ layers + sources + components. Describe what the map should show; the library handles how. - Single HTML output — standalone file with MapLibre GL JS; works via
file://when data is embedded. - Embedded mode — inline GeoJSON (optionally Geobuf + Gzip) so you can share one file.
- Comparison mode — before/after slider using the MapLibre compare plugin.
- Feature-state expressions — GPU-efficient dynamic styling (
fill_color,opacity) viasetFeatureState. - Extensible — custom JS/CSS/HTML injection,
embed_data()for arbitrary JSON. - Built-in attribution — automatic LLMaps branding with GitHub link (customizable or removable).
- LLM-friendly — predictable names, stable contracts; use
get_llm_context()for a compact reference in chat.
Available building blocks:
| Category | Classes |
|---|---|
| Layers | CircleLayer, FillLayer, H3Layer, VectorTileLayer |
| Sources | FileSource, ApiSource, VectorTileSource |
| Components | Legend, Popup, Sidebar, Search, FeatureSearch, Controls, BasemapSwitcher, Storytelling |
Installation
pip install llmaps
Cursor / Claude Code — both support the Agent Skills standard. Copy the repo's cursor-skill folder so the AI has full context when generating map code:
| Tool | Skills path |
|---|---|
| Cursor | ~/.cursor/skills/llmaps/SKILL.md |
| Claude Code | ~/.claude/skills/llmaps/SKILL.md |
On Windows use %USERPROFILE%\ instead of ~/. Create the folders if needed. The skill is picked up automatically on next launch. If you use either tool with this skill, you can skip the step below.
Context for other LLM chats: Run once in your project directory, then attach llmaps_context.md to the chat (e.g. @llmaps_context.md in Cursor):
python -c "import llmaps; open('llmaps_context.md','w').write(llmaps.get_llm_context())"
Quick Start
from llmaps import Map
from llmaps.layers import CircleLayer
from llmaps.sources import FileSource
from llmaps.components import Legend, Popup, Controls
source = FileSource(id="points", path="data/points.geojson")
layer = CircleLayer(
id="points-layer",
source=source,
radius=6,
color="#3182bd",
opacity=0.8,
)
m = Map(center=[10.0, 50.0], zoom=4, title="My Map", tiles="osm")
m.add_layer(layer)
m.add_component(Legend(layer_labels={"points-layer": "Points"}))
m.add_component(Popup(fields=["name", "value"], field_labels={"name": "Name", "value": "Value"}))
m.add_component(Controls(zoom=True, scale=True))
m.auto_extent()
m.save("my_map.html")
Examples
Explore interactive maps showcasing key features and capabilities: LLMaps Examples Gallery
Real-world examples with source code:
| Example | Features | Data |
|---|---|---|
| Paris Cafes & Restaurants | CircleLayer, Search, FeatureSearch, BasemapSwitcher, Popup, Sidebar | OpenStreetMap Overpass |
| World Population | FillLayer, feature-state styling, Jenks classification, color ramps | Natural Earth |
| Earthquakes | H3Layer, animated H3 heatmap, temporal filtering | USGS Earthquake API |
Built With
- MapLibre GL JS — frontend map rendering
- Jinja2 — HTML template engine
- Optional: H3, GeoPandas, Geobuf
Comparison with Alternatives
| Criterion | Kepler.gl | Folium / ipyleaflet | Custom MapLibre/Leaflet | LLMaps |
|---|---|---|---|---|
| Ready-made components | ⚠️ Limited by UI | ⚠️ Few primitives | ❌ | ✅ Full set: layers, legend, popup, sidebar, search, controls |
| LLM-friendly | ❌ | ⚠️ Partial | ⚠️ Depends on code | ✅ Clear API, stable contracts |
| H3 / aggregation | ✅ | ❌ | ⚠️ Manual | ✅ H3Layer |
| Embedded (file://) | ❌ | ⚠️ Often needs server | ⚠️ Manual | ✅ embedded=True |
| Comparison (before/after) | ❌ | ❌ | ⚠️ Manual | ✅ enable_comparison |
| Single HTML output | ❌ | ✅ Possible | ⚠️ Manual | ✅ save / to_html |
| Customization | ⚠️ Limited | ✅ Good | ✅ Full | ✅ Full (config + templates + custom JS/CSS) |
| Extensibility | ⚠️ Limited by UI | ✅ Good (plugins, custom HTML/JS) | ✅ Full | ✅ Full (custom JS/CSS/HTML, embed_data(), templates) |
| No backend | ❌ | ✅ Often | ⚠️ Possible | ✅ Embedded mode |
When to use LLMaps: You want a single Python API to produce a standalone interactive map (especially with embedded data), with minimal boilerplate and good support for LLM-generated code.
When to choose something else: You need a full GIS UI (Kepler.gl), tight Jupyter-only integration (Folium/ipyleaflet), or a fully custom frontend stack (raw MapLibre/Leaflet with your own backend).
Architecture
Python API → Config (to_dict()) → HTML (Jinja2) → Frontend (MapLibre GL JS + plugins)
Everything reduces to a serializable dict — no framework magic. The generator turns that config into one HTML file with inline or linked JS/CSS. See PHILOSOPHY.md for design principles and rationale.
Documentation
- LLM context — run
python -c "import llmaps; open('llmaps_context.md','w').write(llmaps.get_llm_context())"and use @llmaps_context.md in chat for a compact API reference. - PHILOSOPHY.md — Concept, design principles, comparison with alternatives.
- docs/api/ — Map, layers, sources, components (parameters and examples).
- docs/recipes/ — Heatmap, comparison, embedded map, feature-state highlighting.
Tile Providers
Use the tiles argument when creating the map:
| Key | Provider | Attribution |
|---|---|---|
"osm" |
OpenStreetMap (default) | © OpenStreetMap contributors |
"carto-light" |
Carto Light | © OpenStreetMap contributors, © CARTO |
"carto-dark" |
Carto Dark | © OpenStreetMap contributors, © CARTO |
"yandex" |
Yandex Maps | © Yandex Maps |
"2gis" |
2GIS | © 2GIS |
License
MIT. See LICENSE.
Contact
Sergey Abramov
Contributing
See CONTRIBUTING.md.
Project details
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 llmaps-1.0.1.tar.gz.
File metadata
- Download URL: llmaps-1.0.1.tar.gz
- Upload date:
- Size: 7.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c9ddb83b6818da820b25b3bec4d7da2bb26f9e30cddbccea1ed814aca653d39
|
|
| MD5 |
969db088bfc7b6a7bde93f0e9cb30b05
|
|
| BLAKE2b-256 |
4c370138b36b9cb483b9835a8e764b0e558d8cb5751943ede71eb5a6aac088da
|
File details
Details for the file llmaps-1.0.1-py3-none-any.whl.
File metadata
- Download URL: llmaps-1.0.1-py3-none-any.whl
- Upload date:
- Size: 80.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fcdd2e6b1bfff08dfa92d9acad9d82955c96c8785195f5fb344e5c2f383578e9
|
|
| MD5 |
cf921b7f557e826cc8ec0f5bb347fe38
|
|
| BLAKE2b-256 |
fb1ace81db73c6819dd46e4522ae7896cf4823658f35020c36c0af00d4f57e22
|