Skip to content

mapwidgets

mapwidgets logo
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 MapViewer factory for choosing maplibre or google at runtime.
  • Concrete MapLibreViewer and GoogleMapViewer classes for backend-specific behavior.
  • Pydantic element models for markers, polylines, polygons, circles, and rectangles.
  • Backend-neutral RasterLayer and VectorLayer objects.
  • 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