Skip to content

autonomens/mapbox-gl-forbidden-area

Repository files navigation

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 };
  };
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published