JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 401
  • Score
    100M100P100Q98331F
  • License BSD-3-Clause

Mapbox GL JS plugin for inspecting vector data

Package Exports

  • mapbox-gl-inspect
  • mapbox-gl-inspect/dist/mapbox-gl-inspect.css
  • mapbox-gl-inspect/lib/colors
  • mapbox-gl-inspect/lib/renderPopup
  • mapbox-gl-inspect/lib/stylegen

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (mapbox-gl-inspect) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Mapbox GL Inspect Build Status

Add an inspect control to Mapbox GL JS to view all features of the vector sources and allows hovering over features to see their properties.

Mapbox GL Inspect Preview

Usage

mapbox-gl-inspect is a Mapbox GL JS plugin that you can easily add on top of your map. Check index.html for a complete example.

Make sure to include the CSS and JS files.

<script src='http://mapbox-gl-inspect.lukasmartinelli.ch/dist/mapbox-gl-inspect.min.js'></script>
<link href='http://mapbox-gl-inspect.lukasmartinelli.ch/dist/mapbox-gl-inspect.css' rel='stylesheet' />

Add the inspector control to your map.

map.addControl(new MapboxInspect());

Switch to the inspection map by default.

map.addControl(new MapboxInspect({
  showInspectMap: true
}));

Switch to the inspection map by default and hide the inspect button to switch back to the normal map. Check examples/inspect-only.html.

map.addControl(new MapboxInspect({
  showInspectMap: true,
  showInspectButton: false
}));

Disable the feature Popup in inspection mode. Check examples/no-popup.html.

map.addControl(new MapboxInspect({
  showPopup: false
}));

You are able to control the generated colors and background of the inspection style. Check examples/custom-color-1.html and examples/custom-color-2.html.

var colors = ['#FC49A3', '#CC66FF', '#66CCFF', '#66FFCC'];
map.addControl(new MapboxInspect({
  backgroundColor: '#000',
  assignLayerColor: function(layerId, alpha) {
    var randomNumber = parseInt(Math.random() * colors.length);
    return colors[randomNumber];
   }
}));

Develop

Run the linter and watch for changes to rebuild with browserify.

npm install
npm run test
npm run watch

Create a minified standalone build.

npm install
npm run build