@makina-corpus/mapbox-gl-forbidden-area
v1.0.0
Published
Disable events on feature collection
Downloads
5
Keywords
Readme
Mapbox-gl-forbidden-area
Mapbox-gl-forbidden-area allows you to disable events on feature collection.
It requires Mapbox-gl-js (or Maplibre-gl-js) as a dependency.
Run Locally
cd mapbox-gl-forbidden-area
Install dependencies
npm install
Start the server
mapboxglToken="YOUR_ACCESS_TOKEN" npm run start
Build
npm run build
Installation
Install Mapbox-gl-forbidden-area with your package manager:
npm install @makina-corpus/mapbox-gl-forbidden-area
Usage in your application
import MapboxForbiddenAreaControl from "@makina-corpus/mapbox-gl-forbidden-area";
Sample configuration
const mapboxForbiddenAreaControl = new MapboxForbiddenAreaControl(parameters);
map.addControl(mapboxForbiddenAreaControl);
Parameters
interface Parameters {
featureCollection?: GeoJSON.FeatureCollection<GeoJSON.Geometry>;
eventsToFire?: string[];
eventsToDisable?: string[];
radius?: number;
forbiddenAreaConfiguration?: ForbiddenAreaConfiguration;
getGeometryOnEnterForbiddenArea?: Function;
}
interface ForbiddenAreaConfiguration {
sourceConfiguration: { id: string };
layerConfiguration: {
id: string;
type: string;
paint: { "fill-opacity": number; "fill-color": string };
};
}