Sources
maplibre.sources
GeoJSONSource
Bases: Source
GeoJSON Source
Examples:
>>> geojson = "https://docs.mapbox.com/mapbox-gl-js/assets/earthquakes.geojson"
>>> source = GeoJSONSource(data=geojson)
Source code in maplibre/sources.py
RasterTileSource
Bases: Source
Raster tile source
Examples:
>>> raster_tile_source = RasterTileSource(
... tiles=["https://tile.openstreetmap.org/{z}/{x}/{y}.png"],
... tile_size=256,
... min_zoom=0,
... max_zoom=19,
... )
Source code in maplibre/sources.py
SourceType
VectorTileSource
Bases: Source
Vector tile source
Examples:
>>> vector_tile_source = VectorTileSource(
... tiles=["https://demotiles.maplibre.org/tiles/{z}/{x}/{y}.pbf"],
... min_zoom=0,
... max_zoom=6,
... )
>>> layer = Layer(
... type=LayerType.LINE,
... id="countries",
... source=vector_tile_source,
... source_layer="countries",
... paint={"fill-color": "lightgreen", "fill-outline-color": "black"},
... )