@makina-corpus/mapbox-gl-forbidden-area

1.0.0 • Public • Published

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

/@makina-corpus/mapbox-gl-forbidden-area/

    Package Sidebar

    Install

    npm i @makina-corpus/mapbox-gl-forbidden-area

    Weekly Downloads

    0

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    852 kB

    Total Files

    9

    Last publish

    Collaborators

    • bastyen
    • dtrucs
    • pacproduct
    • mab
    • makinacorpus
    • jrmi