mapwidgets¶
code styleblack
contributionswelcome
mapwidgets provides PySide6 map viewers with interchangeable JavaScript map
backends. The same Python API can render interactive desktop maps with
MapLibre GL JS or the Google Maps JavaScript API.
The library keeps the core schema objects lightweight and makes GUI and geospatial dependencies optional. Install only the extras needed for the workflow you are running.
What it provides¶
- A
MapViewerfactory for choosingmaplibreorgoogleat runtime. - Concrete
MapLibreViewerandGoogleMapViewerclasses for backend-specific behavior. - Pydantic element models for markers, polylines, polygons, circles, and rectangles.
- Backend-neutral
RasterLayerandVectorLayerobjects. - GeoTIFF helpers for preparing XYZ PNG tile pyramids from orthomosaics and other georeferenced rasters.
Minimal example¶
from PySide6.QtWidgets import QApplication
from mapwidgets import MapViewer, Marker
app = QApplication.instance() or QApplication([])
viewer = (
MapViewer(backend="maplibre")
.set_center(32.2207, -98.2023)
.set_zoom(15)
.add_marker(
Marker(
position={"lat": 32.2207, "lng": -98.2023},
title="Field",
)
)
.show()
.wait_for_map_ready()
)
app.exec()
Documentation map¶
- Start with Installation and Quick Start.
- Use Backends when choosing between MapLibre and Google Maps.
- Use Layers and GeoTIFF Tiling for Shapefiles, GeoJSON, orthomosaics, and raster tile pyramids.
- Use the API reference for import paths and method summaries.