@open-pioneer/overview-map v0.11.0
@open-pioneer/overview-map
This package offers a UI component with which an overview map can be integrated. This helps the user to better understand the current map view in a larger scale context.
Usage
To integrate the overview map in your app, add the component (with a map) and configure a layer to be shown in the overview map:
const overviewMapLayer = ... // an OpenLayers layer, see below
<OverviewMap map={map} olLayer={overviewMapLayer} />; /* instead of passing the map, the `DefaultMapProvider` can alternatively be used */Configuring the layer
The OverviewMap requires an OpenLayers Layer object in the olLayer property, for example:
// Layer construction is wrapped in useMemo to avoid needless reconstructions on render.
// You can also use a service or different shared state to construct your layer.
const overviewMapLayer = useMemo(
() =>
new TileLayer({
source: new OSM()
}),
[]
);
// Later ...
<OverviewMap map={map} olLayer={overviewMapLayer} />;NOTE: Keep in mind that an OpenLayers
Layerobject should only be used from (at most) a single map. This means that theolLayerused here should be a new layer instance that is not used anywhere else. Most importantly, you cannot use an.olLayerfrom theMapModeldirectly.
Configuring the size
The OverviewMap component uses a default height of 200px and width of 300px.
To override the default size, use the height and width properties.
Both properties support the usual values supported by Chakra UI:
<OverviewMap map={map} olLayer={overviewMapLayer} height="300px" width="400px" />License
Apache-2.0 (see LICENSE file)
6 months ago
8 months ago
7 months ago
5 months ago
5 months ago
11 months ago
8 months ago
6 months ago
11 months ago
8 months ago
8 months ago
11 months ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago