A library to get legend graphics from the map-context.
To install the package, use npm:
npm install @geospatial-sdk/legend
import { createLegendFromLayer } from "@geospatial-sdk/legend";
const layer = {
type: "wms",
url: "https://example.com/wms",
name: "test-layer",
};
createLegendFromLayer(layer).then((legendDiv) => {
document.body.appendChild(legendDiv);
});
For more detailed API documentation, see the documentation website.
For examples and demos, see the examples website.