You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A Python package for creating interactive maps with anywidget using TypeScript. Supports multiple mapping libraries including MapLibre GL JS, Mapbox GL JS, Leaflet, OpenLayers, DeckGL, Cesium, KeplerGL, and Potree.
Supported Libraries
Library
Description
Use Case
MapLibre GL JS
Open-source vector maps
Default, general-purpose mapping
Mapbox GL JS
Commercial vector maps
Advanced styling, 3D terrain
Leaflet
Lightweight, mobile-friendly
Simple maps, broad compatibility
OpenLayers
Feature-rich, enterprise
WMS/WMTS, projections
DeckGL
GPU-accelerated
Large-scale data visualization
Cesium
3D globe
3D Tiles, terrain, global views
KeplerGL
Data exploration
Interactive data analysis
Potree
Point clouds
LiDAR visualization
Features
Interactive maps in Jupyter notebooks
Bidirectional Python-JavaScript communication via anywidget
TypeScript-based frontend for type safety and maintainability
Installation
From PyPI (when published)
pip install anymap-ts
From conda-forge
conda install -c conda-forge anymap-ts
From source (development)
git clone https://github.com/opengeos/anymap-ts.git
cd anymap-ts
pip install -e ".[dev]"
Optional dependencies
# For vector data support (GeoDataFrame)
pip install anymap-ts[vector]
# For local raster support (localtileserver)
pip install anymap-ts[raster]
# All optional dependencies
pip install anymap-ts[all]
Quick Start
MapLibre GL JS (Default)
fromanymap_tsimportMap# Create a map centered on a locationm=Map(center=[-122.4, 37.8], zoom=10)
m.add_basemap("OpenStreetMap")
m.add_draw_control()
m
Mapbox GL JS
importosfromanymap_tsimportMapboxMap# Set your Mapbox token (or use MAPBOX_TOKEN env var)m=MapboxMap(center=[-122.4, 37.8], zoom=10)
m.add_basemap("OpenStreetMap")
m
Leaflet
fromanymap_tsimportLeafletMapm=LeafletMap(center=[-122.4, 37.8], zoom=10)
m.add_basemap("OpenStreetMap")
m.add_marker(-122.4194, 37.7749, popup="San Francisco")
m
fromanymap_tsimportCesiumMap# Set CESIUM_TOKEN env var for terrain/3D Tilesm=CesiumMap(center=[-122.4, 37.8], zoom=10)
m.add_basemap("OpenStreetMap")
m.set_terrain() # Enable Cesium World Terrainm.fly_to(-122.4194, 37.7749, height=50000, heading=45, pitch=-45)
m
# Build all libraries
npm run build:all
# Build specific library
npm run build:maplibre
npm run build:mapbox
npm run build:leaflet
npm run build:deckgl
npm run build:openlayers
npm run build:cesium
# Watch mode
npm run watch
Project Structure
anymap-ts/
├── src/ # TypeScript source
│ ├── core/ # Base classes
│ ├── maplibre/ # MapLibre implementation
│ ├── mapbox/ # Mapbox implementation
│ ├── leaflet/ # Leaflet implementation
│ ├── openlayers/ # OpenLayers implementation
│ ├── deckgl/ # DeckGL implementation
│ ├── cesium/ # Cesium implementation
│ └── types/ # Type definitions
├── anymap_ts/ # Python package
│ ├── maplibre.py # MapLibreMap class
│ ├── mapbox.py # MapboxMap class
│ ├── leaflet.py # LeafletMap class
│ ├── openlayers.py # OpenLayersMap class
│ ├── deckgl.py # DeckGLMap class
│ ├── cesium.py # CesiumMap class
│ ├── keplergl.py # KeplerGLMap class
│ ├── potree.py # PotreeViewer class
│ ├── static/ # Built JS/CSS
│ └── templates/ # HTML export templates
└── examples/ # Example notebooks