Skip to main content
Loss of provenance

A previous release had provenance metadata, but this release does not. View details.

multilayer-sdk Logo

multilayer-sdk

PyPI Version DOI Python Versions License: MIT

Documentation

Synchronized side-by-side and swipe maps for Jupyter and standalone HTML: compare 2–8 linked map panels without a JavaScript build.

📖 Open Interactive Web Manual • 📦 PyPI Package • 🦊 GitLab • 🐛 Issue Tracker


📦 Installation

pip install multilayer-sdk                # core: no third-party dependencies
pip install "multilayer-sdk[geo]"         # + Shapely and GeoPandas (GeoDataFrame interop)
pip install "multilayer-sdk[notebook]"    # + IPython for inline display in Jupyter

Requires Python 3.9+.

⚡ Quickstart

import multilayer as ml

def square(x, y, value):
    ring = [[x, y], [x + 0.01, y], [x + 0.01, y + 0.01], [x, y + 0.01], [x, y]]
    return {"type": "Feature", "properties": {"value": value},
            "geometry": {"type": "Polygon", "coordinates": [ring]}}

before = {"type": "FeatureCollection", "features": [square(28.97, 41.00, 10)]}
after = {"type": "FeatureCollection", "features": [square(28.97, 41.00, 25)]}

mm = ml.MultiMap(grid="1x2", title="Before / After")  # 1x2, 2x1, 1x3, 2x2, 2x3 or 2x4
mm.panel(0).add_layer(before)
mm.panel(1).add_layer(after)
mm.to_html("compare.html")  # one self-contained HTML file; mm.show() in Jupyter

ml.SwipeMap(left_layer=before, right_layer=after).to_html("swipe.html")
print("wrote compare.html and swipe.html")
# wrote compare.html and swipe.html

Open compare.html in a browser: panning or zooming one panel moves the other. GeoJSON file paths work in place of the dicts.


🌐 Live Interactive Studio & Documentation

Explore the interactive multi-panel map simulator and comprehensive reference manual:

👉 https://geophilo.com/multilayer-sdk/

Try out real-time neon laser crosshair tracking, split-screen curtain swipe comparisons, and live choropleth classifiers directly in your browser.


🌟 Overview

multilayer-sdk (the headless Python core behind 02Multimap) allows urban planners, spatial data scientists, and researchers to visualize, cross-analyze, and compare multiple spatial datasets side-by-side with millisecond synchronization.

Instead of toggling layers on and off in a single map, multilayer coordinates up to 8 synchronized map viewports in dynamic grids (1x2, 2x1, 1x3, 2x2, 2x3, 2x4) and exports a single self-contained HTML file for each visualization.

✨ Features

  • Synchronized multi-panel grids — 2, 3, 4, 6, or 8 coordinated Leaflet viewports.
  • Bi-directional pan & zoom broadcasting — drag or zoom any panel to move all others.
  • Neon laser crosshair tracking — project the cursor's geographic coordinate across every panel.
  • Thematic choropleths — quantiles, equal interval, natural breaks, standard deviation, and categorical classification.
  • Scientific color ramps — viridis, magma, plasma, inferno, turbo, cividis, blues, reds, greens, spectral, rdylbu, ylorrd, and pubu.
  • Before/after comparison tools — draggable curtain swipe, roller curtain, spyglass magnifier, diff map, and 2x2 quad sync.
  • Temporal storytelling — animated timeline player, range-slider time series, and scroll-driven story maps.
  • Interactive dashboards — cross-filtering sidebar widgets and live KPI metric cards.
  • Advanced spatial visualizers — 3D globe/terrain, 3D extruded prisms, bivariate choropleths, hexbin aggregation, curved flow arcs, particle/wind fields, isochrones, hypsometric relief, proximity heatmaps, and radar POI beacons.
  • Layer & basemap subsystem — GeoJSON, GeoDataFrame, dict, raster overlays, built-in tile providers, and custom XYZ templates.
  • Shareable views — MultiMap(url_hash=True) keeps #zoom/lat/lon in the page URL, so a copied link reopens every panel at the same place.
  • Safe with untrusted labels — titles, panel names and GeoJSON property values are escaped in the generated HTML and JavaScript.
  • Zero-JavaScript build step — every map compiles to a single HTML file (Leaflet loads from the unpkg CDN and tiles from the chosen provider, so viewing needs a network connection).
  • Jupyter & Google Colab ready — rich inline widget display via mm.show() / _repr_html_().
  • Command line interface — build, compare, inspect, and tiles subcommands.
  • Fully typed — ships a py.typed marker and modern X | None annotations.

🚀 Development Install

Install the package in editable mode together with the test, lint, and packaging toolchain:

git clone https://gitlab.com/geophilo1/multilayer-sdk.git
cd multilayer-sdk
python -m pip install -e ".[dev]"

The dev extra installs pytest, pytest-cov, ruff, mypy, build, and twine.

Verify the installation

python -c "import multilayer as ml; print(ml.__version__)"

🗺️ Usage Examples

1. Build a 4-Panel Synchronized Workspace

import multilayer as ml

# 1. Initialize a 4-panel (2x2) synchronized map grid
mm = ml.MultiMap(grid="2x2", title="Urban Vulnerability & Land Use Assessment", basemap="esri-dark-gray")

# 2. Panel 1: High-resolution satellite imagery with study area boundary
mm.panel(0).title = "1. Satellite Context"
mm.panel(0).set_basemap("satellite")
mm.panel(0).add_layer("study_area.geojson", stroke_color="#38bdf8", fill_opacity=0.2)

# 3. Panel 2: Thematic choropleth of population density
vlayer = ml.VectorLayer.from_geojson("demographics.geojson")
pop_choro = ml.Choropleth.classify(vlayer, property_name="density_km2", method="quantiles", color_ramp="viridis")
mm.panel(1).title = "2. Population Density"
mm.panel(1).add_layer(pop_choro)

# 4. Panel 3: Flood hazard exposure score
risk_choro = ml.Choropleth.classify(vlayer, property_name="flood_risk_score", method="equal_interval", color_ramp="magma")
mm.panel(2).title = "3. Flood Hazard Exposure"
mm.panel(2).add_layer(risk_choro)

# 5. Panel 4: Future 2030 Master Zoning Plan
mm.panel(3).title = "4. Future Master Plan 2030"
mm.panel(3).add_layer("zoning_plan.geojson", fill_color="#10b981", fill_opacity=0.6)

# 6. Save as standalone interactive HTML dashboard
mm.to_html("urban_assessment_dashboard.html")

# 7. Render inline in Jupyter Notebook / Google Colab
mm.show()

By default the panels open zoomed to the extent of all layers. Pass initial_center=(lat, lon) and/or initial_zoom to start somewhere else, and url_hash=True to make the view part of the URL:

mm = ml.MultiMap(grid="1x2", title="Before / After", url_hash=True)
mm.to_html("compare.html")
# Panning updates the address bar to e.g. compare.html#14/38.42370/27.14280.
# Opening that link restores the same center and zoom in every panel.

Set mm.panel(i).sync_nav = False to keep one panel out of the synchronized navigation, and popup_properties=[...] on a layer to show attributes on click.

2. Draggable Split-Screen Curtain Swipe Comparison

import multilayer as ml

swipe = ml.SwipeMap(
    left_layer="landcover_2010.geojson",
    right_layer="landcover_2026.geojson",
    left_title="Historical (2010)",
    right_title="Current (2026)",
    basemap="satellite",
)

swipe.to_html("deforestation_swipe.html")

3. Thematic Choropleth from an In-Memory FeatureCollection

import multilayer as ml

zones = {
    "type": "FeatureCollection",
    "features": [
        {
            "type": "Feature",
            "geometry": {"type": "Point", "coordinates": [28.9784, 41.0082]},
            "properties": {"name": "Historic Peninsula", "density_km2": 12500},
        }
    ],
}

layer = ml.VectorLayer.from_geojson(zones, name="Districts")
choro = ml.Choropleth.classify(
    layer,
    property_name="density_km2",
    method=ml.ClassificationMethod.QUANTILES,
    num_classes=5,
    color_ramp=ml.ColorRamp.VIRIDIS,
)
choro.to_dict()  # JSON-serializable layer payload

4. Animated Time-Series Timeline

import multilayer as ml

timeline = ml.TimelineMap(grid="1x2", title="Flood Progression", fps=1.5)
timeline.set_panel_title(0, "Observed")
timeline.set_panel_title(1, "Modelled")

frame = timeline.create_frame(label="T+0h", timestamp="2026-08-30 12:00")
frame.add_layer(0, ml.VectorLayer.from_geojson("observed.geojson"))
frame.add_layer(1, ml.VectorLayer.from_geojson("modelled.geojson"))

timeline.to_html("flood_timeline.html")

5. Cross-Filtering KPI Dashboard

import multilayer as ml

dash = ml.InteractiveDashboard(grid="1x2", title="Resilience Dashboard", basemap="esri-dark-gray")
dash.add_layer(0, ml.VectorLayer.from_geojson("districts.geojson"))
dash.add_layer(1, ml.VectorLayer.from_geojson("districts.geojson"))

dash.add_metric_card(
    title="Total Population",
    property_key="population",
    aggregation="sum",
    unit="people",
    icon="👥",
)
dash.add_filter(property_key="population", label="Minimum population", filter_type="range")

dash.to_html("resilience_dashboard.html")

6. Hexagonal Point Aggregation

import multilayer as ml

points = [(41.008, 28.978), (41.009, 28.979), (41.050, 29.020)]
values = [12.0, 8.0, 25.0]

hex_layer = ml.aggregate_points_to_hexbins(
    points,
    point_values=values,
    hex_radius_m=750.0,
    statistic="MEAN",  # COUNT, MEAN, SUM, or MAX
)
hex_geojson = hex_layer.to_geojson()

7. 3D Extruded Prism Map

import multilayer as ml

prisms = ml.Choropleth3DMap(title="Urban Density Prisms", metric_name="Density (hab/ha)")
prisms.add_prism(
    "Kadikoy",
    [(40.99, 29.02), (41.00, 29.02), (41.00, 29.04), (40.99, 29.04)],
    metric_value=450.0,
    height_scale=0.5,
)
prisms.save_html("density_prisms_3d.html")

8. Scroll-Driven Story Map

import multilayer as ml

story = ml.StoryMapScroller(story_title="Istanbul 2030", subtitle="A spatial journey")
story.add_chapter("ch1", "Historic Core", "The historic peninsula.", 41.008, 28.978, zoom=15)
story.add_chapter("ch2", "Financial District", "Rapid corridor growth.", 41.080, 29.010, zoom=14)
story.save_html("storymap.html")

9. Basemaps and Custom XYZ Tile Providers

Every engine takes its tile URLs, attributions and zoom limits from one table in multilayer.layers (ml.BASEMAPS for raster tiles, ml.VECTOR_STYLES for the MapLibre GL engines). All built-in basemaps work without an API key:

Name (aliases) Provider Native max zoom Attribution shown
osm (openstreetmap, voyager, carto-voyager) OpenStreetMap standard tiles 19 © OpenStreetMap contributors
esri-light-gray (light-gray, light, carto, carto-light, carto-positron) Esri World Light Gray Canvas 16 Tiles © Esri — Esri, HERE, Garmin, © OpenStreetMap contributors
esri-dark-gray (dark-gray, dark, carto-dark, carto-dark-matter) Esri World Dark Gray Canvas 16 Tiles © Esri — Esri, HERE, Garmin, © OpenStreetMap contributors
satellite (esri-satellite, aerial) Esri World Imagery 19 Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, …
topo (esri-topo) Esri World Topographic 19 Tiles © Esri — Sources: GEBCO, NOAA, …
opentopomap (opentopo) OpenTopoMap 17 © OpenStreetMap contributors, © OpenTopoMap (CC-BY-SA)
cyclosm CyclOSM 20 © OpenStreetMap contributors © CyclOSM
none no basemap – –

Esri tile services use {z}/{y}/{x} order; the table already accounts for it. Past a provider's native max zoom, Leaflet upscales the last tiles instead of showing blank squares. MultiMap, SwipeMap, InteractiveDashboard and TimelineMap default to esri-dark-gray; the single-page engines use osm, esri-light-gray or esri-dark-gray. CurvedFlowMap and Choropleth3DMap use the keyless OpenFreeMap styles (basemap_style="dark" or "positron", or any MapLibre style URL).

CARTO basemaps now require an API key. Every anonymous request to basemaps.cartocdn.com now returns a grey "API KEY REQUIRED" tile. The CARTO names and the TileProvider.CARTO_LIGHT / CARTO_DARK / CARTO_VOYAGER enum members still work, but resolve to the keyless providers in the table above. To use CARTO itself, pass your own key (from https://carto.com/basemaps/apikey; it is written into the HTML, so restrict it to your domains):

import multilayer as ml

carto_dark = ml.carto_tile_layer("dark", api_key="YOUR_KEY")  # "light", "dark", "voyager"
mm = ml.MultiMap(grid="1x2", basemap=carto_dark)
# or: ml.get_tile_provider("carto-voyager", carto_api_key="YOUR_KEY")

# Any other XYZ template works too; give the attribution its provider requires.
custom = ml.TileLayer(
    name="Example Tiles",
    url_template="https://tiles.example.com/{z}/{x}/{y}.png",
    attribution="© Example",
)
mm.set_basemap(custom, panel_index=1)

💻 Command Line Interface (CLI)

# 1. Build a 2x2 synchronized dashboard from 4 GeoJSON files
multilayer build --layers bldgs.geojson,roads.geojson,hazard.geojson,zoning.geojson --grid 2x2 --out city_dashboard.html --open

# 2. Build a 2-panel before/after split-screen swipe comparison
multilayer compare flood_2020.geojson flood_2026.geojson --left-title "2020 Flood" --right-title "2026 Flood" --out flood_swipe.html

# 3. Inspect GeoJSON feature count, properties, and bounding box
multilayer inspect study_area.geojson

# 4. List all built-in web map tile basemaps
multilayer tiles

# 5. Show the installed version
multilayer --version

⚙️ Supported Grid Matrices

Grid Preset Layout Dimensions Panel Count Primary Cartographic Use Case
1x2 1 Row × 2 Columns 2 Panels Before/After comparisons, Suitability vs Actual zoning
2x1 2 Rows × 1 Column 2 Panels Vertical elevation profiles, transport corridors
1x3 1 Row × 3 Columns 3 Panels Past → Present → Future temporal timelines
2x2 2 Rows × 2 Columns 4 Panels 4-way evaluation (Base, Demographics, Hazards, Policy)
2x3 2 Rows × 3 Columns 6 Panels Multi-criteria evaluation (MCDA factor grids)
2x4 2 Rows × 4 Columns 8 Panels High-density multi-scenario sensitivity snapshots

Custom grids can also be supplied as any "RxC" string or via GridLayout(custom_rows=..., custom_cols=...).


📚 Public API Reference

All symbols below are importable directly from multilayer.

Core containers

Symbol Kind Purpose
MultiMap class Synchronized multi-panel workspace; configure panels, layers, basemaps, and export HTML.
Panel class A single viewport inside a MultiMap grid.
SwipeMap class Split-screen curtain swipe comparison of two layers.
create_multimap function Convenience factory that creates a MultiMap and assigns layers to panels.
GridLayout / GridPreset class / enum Grid geometry parsing, presets, and CSS generation.

Layers & basemaps

Symbol Kind Purpose
Layer abstract class Base spatial layer contract (to_dict, get_bounds).
VectorLayer class GeoJSON / dict / GeoDataFrame vector layer with styling and tooltips.
RasterLayer class Georeferenced raster image overlay.
TileLayer class Web-map raster tile basemap.
TileProvider enum Built-in providers (OSM, Esri canvas/imagery/topo, OpenTopoMap, CyclOSM; legacy CARTO names map to keyless providers).
get_tile_provider function Resolve a provider alias or custom XYZ URL to a TileLayer (carto_api_key= for real CARTO tiles).
carto_tile_layer function CARTO light/dark/voyager tiles authenticated with your own API key.
BASEMAPS / BasemapSpec dict / class The shared raster basemap table: URL, attribution, native max zoom.
VECTOR_STYLES / VectorStyleSpec dict / class Keyless MapLibre GL styles (OpenFreeMap dark, positron).

Thematic symbology

Symbol Kind Purpose
Choropleth class Classify vector features and produce a themed VectorLayer.
ClassificationMethod enum QUANTILES, EQUAL_INTERVAL, NATURAL_BREAKS, STANDARD_DEVIATION, CATEGORICAL.
ColorRamp enum Scientific and cartographic color palettes.
StyleRule / GraduatedStyle / CategoricalStyle dataclasses Declarative styling rules and graduation configuration.
BivariateChoroplethMap / BivariateMatrixColorRamp class / dataclass 3x3 bivariate correlation choropleth.

Temporal & dashboard

Symbol Kind Purpose
TimelineMap / TimeFrame class / dataclass Multi-panel time-series animator and scenario player.
TemporalRangeSliderMap / TimeSliderFrame class / dataclass Range-slider time-series playback map.
export_time_slider_html function Build and save a TemporalRangeSliderMap from (label, geojson) pairs.
InteractiveDashboard / MetricCard / FilterWidget classes Cross-filtering dashboard with KPI cards.

Comparison & 3D

Symbol Kind Purpose
DiffMap / SpatialDiffResult class / dataclass Side-by-side geometric difference visualizer.
CurtainMap class Split-slider curtain reveal comparer.
RollerCurtainMap / RollerAngleMode / render_roller_map_html class / enum / function Angle-adjustable roller curtain comparer.
SpyglassCompareMap / LensConfig class / dataclass Circular magnifying-lens comparer.
QuadSyncMap / QuadPanelConfig class / dataclass 4-panel synchronized 2x2 map grid.
Globe3DMap / TerrainPanel3D class / dataclass Multi-panel 3D globe and terrain viewer.
Choropleth3DMap / PrismPolygon3D class / dataclass 3D extruded prism choropleth.
CurvedFlowMap / FlowArc3D class / dataclass Curved animated origin-destination flow arcs.

Advanced spatial visualizers

Symbol Kind Purpose
HexbinHeatmapLayer / HexagonCell / aggregate_points_to_hexbins classes / function Hexagonal point aggregation with COUNT/MEAN/SUM/MAX.
ParticleFlowMap / FlowParticleConfig class / dataclass Canvas/WebGL particle flow animation.
WindParticleFieldMap / WindParticleParams class / dataclass Vector wind/current streamline field.
TravelIsochroneBubbleMap / IsochroneBandParams class / dataclass Multi-modal travel-time reachability rings.
HypsoTintedReliefMap / ContourIntervalConfig class / dataclass Hypsometric relief with contour lines.
ProximityMatrixHeatmapMap / ProximityZoneParams class / dataclass Facility distance proximity grid and heatmap.
PulseRadarPoiMap / RadarPulseConfig class / dataclass Animated radar pulse and ripple POI beacons.
StoryMapScroller / StoryChapter class / dataclass Scroll-driven narrative map.
MultiPageAtlas / AtlasGridSheet class / dataclass Printable multi-page atlas grid index.
RadialSearchMap class Interactive point-and-click radial buffer query.

🧪 Development & Testing

# Run the test suite
python -m pytest -q

# Run tests with coverage (configured in pyproject.toml)
python -m pytest --cov=multilayer --cov-report=term-missing

# Lint and format
python -m ruff check .
python -m ruff format src tests

The project targets Python 3.9+ and is linted with Ruff (E, F, W, I, B, C4) at a 100-character line length. Tests live in tests/ and run against src/ via the pythonpath setting in pyproject.toml.


📄 Academic Citation

If you use multilayer-sdk in scientific publications, planning projects, or research, please cite:

@software{eminoglu2026multilayer,
  author    = {Emino{\u{g}}lu, Yusuf},
  title     = {{multilayer-sdk: Pure-Python Synchronized Multi-Panel Map Visualization, Spatial Comparison Engine, and Interactive Dashboard Builder}},
  year      = {2026},
  publisher = {Zenodo},
  version   = {0.13.3},
  doi       = {10.5281/zenodo.23677246},
  url       = {https://gitlab.com/geophilo1/multilayer-sdk}
}

📜 License

Distributed under the MIT License. Copyright (c) 2026 Yusuf Eminoğlu.

Metadata

Release files for multilayer-sdk 0.13.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Loss of provenance

These files do not have provenance metadata, despite files in a prior release including this data.

We recommend further investigation before installing these files. View details.

Source distribution (sdist)

Source distribution for multilayer-sdk 0.13.3
File Size Uploaded Provenance Actions
multilayer_sdk-0.13.3.tar.gz 94.4 kB Without provenance Details for multilayer_sdk-0.13.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for multilayer-sdk 0.13.3
File Interpreter ABI Platform Actions
multilayer_sdk-0.13.3-py3-none-any.whl Python 3 none any Details for multilayer_sdk-0.13.3-py3-none-any.whl

Total release size: 183.9 kB

Release files / multilayer_sdk-0.13.3.tar.gz

Loss of provenance

This file belongs to a release without provenance metadata, despite a prior release including this data.

We recommend further investigation before installing this file. View details.

Download URL multilayer_sdk-0.13.3.tar.gz
Size 94.4 kB
Tags Source
SHA-256 checksum
How to use checksums
1810a8409d27ecb92427c96b40ec96f069048c852c101155a5e7ad7565cf3da1
BLAKE2b-256 checksum
How to use checksums
3fc8ab6dfeb05587ca4ffab0920b9d70756390c6d216576dd6107a8055560239
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.18

Release files / multilayer_sdk-0.13.3-py3-none-any.whl

Loss of provenance

This file belongs to a release without provenance metadata, despite a prior release including this data.

We recommend further investigation before installing this file. View details.

Download URL multilayer_sdk-0.13.3-py3-none-any.whl
Size 89.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
200981e0ff71dcd5d3ec1880ece04b0aebc59216250c896d875dff1fb896e028
BLAKE2b-256 checksum
How to use checksums
4a109dd75a4500896e877aac6e1fa2f845c7287bd69bf841dd954cebc8181bc4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.18

Security for multilayer-sdk 0.13.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Loss of provenance

A previous release of these files had provenance metadata, but this release does not.

While this could reflect a routine change by the project maintainers, it may also indicate that the release files have been compromised.

Release comparison

  • Removed 0.13.2 2 files With provenance
  • Added 0.13.3 2 files Without provenance

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page