AirMap's Mapbox GL Contextual Airspace Plugin
A control for mapbox-gl-js Mapbox GL JS plugin to view and interact with AirMap's Contextual Airspace Rules.
To use the AirMap Contextual Airspace Plugin, you must register as a developer and obtain an API key from the AirMap Developer Portal. Once your application has been created, simply copy the provided config JSON to provide to the Contextual Airspace Plugin. You'll also need to register for a Mapbox Access Token.
From AirMap's CDN
<!-- Latest patch release --><!-- Latest minor release -->
npm install airmap-contextual-airspace-plugin
After installing the
airmap-contextual-airspace-pluginmodule via npm or bower, you'll need bundle it up along with its dependencies using a tool like webpack or browserify. If you don't have a build process in place for managing dependencies, it is recommended that you use the module via the CDN. See below for instructions on using with webpack and browserify. If you install with bower and intend to support ES5, you will also need to run your bundle through babel.
Here's an example of a minimal setup. See Documentation for more details.
Mapbox-gl-js Ruleset Plugin
Or if using from NPM:
const map =container: 'map'style: 'mapbox://styles/mapbox/streets-v8'center: -1184932 340135zoom: 13const config ="airmap":"api_key": AIRMAP_API_KEY"auth0":"client_id": """callback_url": """mapbox":"access_token": MAPBOX_ACCESS_TOKENconst options =preferredRulesets:'usa_part_107''deu_rules_waiver'overrideRulesets:// 'usa_part_107'enableRecommendedRulesets: truetheme: 'light'const plugin = config options;map
If you are installing the Contextual Airspace Plugin with npm, a prebuilt package is also available in
dist/airmap.contextualairspaceplugin.min.js. This will
allow you to use the Contextual Airspace Plugin without changing your webpack/browserify configuration. However, using your bundler to package
all dependencies is the preferred approach (webpack recommends against using prebuilt files).
If this is your first time developing with the Contextual Airspace plugin, you'll need to store an AirMap API Key and Mapbox Access Token
in your localStorage for use on the
http://localhost:8080/ demo page:
Once this is done, you won't need to do it again unless you clear your browser's localStorage.
$ npm install $ npm start $ open http://localhost:8080/
See LICENSE for details.