📦 openlayers ​
This package provides utilities to create and manage OpenLayers maps using the declarative Map Context model from @geospatial-sdk/core.
Installation ​
sh
npm install @geospatial-sdk/openlayersUsage ​
typescript
import { createMapFromContext } from "@geospatial-sdk/openlayers";
import type { MapContext } from "@geospatial-sdk/core";
const mapContext: MapContext = {
layers: [
{
type: "xyz",
url: "https://tile.openstreetmap.org/{z}/{x}/{y}.png",
},
],
view: {
center: [6, 48.5],
zoom: 5,
},
};
const map = await createMapFromContext(
mapContext,
document.getElementById("map"),
);Functions ​
| Function | Description |
|---|---|
| applyContextDiffToMap | Apply a context diff to an OpenLayers map |
| createMapFromContext | Create an OpenLayers map from a context; optionally specify a target (root element) for the map |
| listen | - |
| readMapViewState | Reads the current view state of the map. |
| resetMapFromContext | Resets an OpenLayers map from a context; existing content will be cleared |