{"id":13784555,"url":"https://github.com/lukasmartinelli/mapbox-gl-inspect","last_synced_at":"2025-04-09T10:09:46.143Z","repository":{"id":60137336,"uuid":"78053404","full_name":"lukasmartinelli/mapbox-gl-inspect","owner":"lukasmartinelli","description":"Inspection plugin for Mapbox GL JS","archived":false,"fork":false,"pushed_at":"2020-09-08T10:54:24.000Z","size":315,"stargazers_count":142,"open_issues_count":10,"forks_count":24,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-04-02T02:46:43.721Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://mapbox-gl-inspect.lukasmartinelli.ch/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lukasmartinelli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-04T21:14:21.000Z","updated_at":"2025-02-25T06:24:04.000Z","dependencies_parsed_at":"2022-09-25T17:51:17.758Z","dependency_job_id":null,"html_url":"https://github.com/lukasmartinelli/mapbox-gl-inspect","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukasmartinelli%2Fmapbox-gl-inspect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukasmartinelli%2Fmapbox-gl-inspect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukasmartinelli%2Fmapbox-gl-inspect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukasmartinelli%2Fmapbox-gl-inspect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lukasmartinelli","download_url":"https://codeload.github.com/lukasmartinelli/mapbox-gl-inspect/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248018061,"owners_count":21034048,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T19:00:47.962Z","updated_at":"2025-04-09T10:09:46.115Z","avatar_url":"https://github.com/lukasmartinelli.png","language":"JavaScript","funding_links":[],"categories":["Applications / Command line tools"],"sub_categories":[],"readme":"# Mapbox GL Inspect [![Build Status](https://travis-ci.org/lukasmartinelli/mapbox-gl-inspect.svg?branch=master)](https://travis-ci.org/lukasmartinelli/mapbox-gl-inspect)\n\nAdd an inspect control to [Mapbox GL JS](https://github.com/mapbox/mapbox-gl-js) to view all features\nof the vector sources and allows hovering over features to see their properties.\n\n**Requires [mapbox-gl-js](https://github.com/mapbox/mapbox-gl-js) (version 0.29.0 – 0.31.x).**\n\n![Mapbox GL Inspect Preview](https://cloud.githubusercontent.com/assets/1288339/21744637/11759412-d51a-11e6-9581-f26741fcd182.gif)\n\n## Usage\n\n**mapbox-gl-inspect** is a [Mapbox GL JS plugin](https://www.mapbox.com/blog/build-mapbox-gl-js-plugins/) that you can easily add on top of your map. Check `index.html` for a complete example.\n\nMake sure to include the CSS and JS files.\n\n**When using a CDN**\n\n```html\n\u003cscript src='https://github.com/lukasmartinelli/mapbox-gl-inspect/releases/download/v1.3.1/mapbox-gl-inspect.js'\u003e\u003c/script\u003e\n\u003clink href='https://github.com/lukasmartinelli/mapbox-gl-inspect/releases/download/v1.3.1/mapbox-gl-inspect.css' rel='stylesheet' /\u003e\n```\n\n**When using modules**\n\n```js\nrequire('mapbox-gl-inspect/dist/mapbox-gl-inspect.css');\nvar mapboxgl = require('mapbox-gl');\nvar MapboxInspect = require('mapbox-gl-inspect');\n\n// Pass an initialized popup to Mapbox GL\nmap.addControl(new MapboxInspect({\n  popup: new mapboxgl.Popup({\n    closeButton: false,\n    closeOnClick: false\n  })\n}));\n```\n\n\n### Add Inspect Control\n\nAdd the inspect control to your map.\n\n```javascript\nmap.addControl(new MapboxInspect());\n```\n\n\n### Show Inspection Map\n\nSwitch to the inspection map by default.\n\n```javascript\nmap.addControl(new MapboxInspect({\n  showInspectMap: true\n}));\n```\n\n### Show only Inspection Mode\n\nSwitch to the inspection map by default and hide the inspect button to switch back to the normal map. Check [`examples/inspect-only.html`](http://mapbox-gl-inspect.lukasmartinelli.ch/examples/inspect-only.html).\n\n\n```javascript\nmap.addControl(new MapboxInspect({\n  showInspectMap: true,\n  showInspectButton: false\n}));\n```\n\n### Disable Popup\n\nDisable the feature Popup in inspection mode and in map mode. Check [`examples/no-popup.html`](http://mapbox-gl-inspect.lukasmartinelli.ch/examples/no-popup.html).\n\n```javascript\nmap.addControl(new MapboxInspect({\n  showInspectMapPopup: false,\n  showMapPopup: false\n}));\n```\n\n### Custom Popup Function\n\nYou can also control the Popup output. Check [`examples/custom-popup.html`](http://mapbox-gl-inspect.lukasmartinelli.ch/examples/custom-popup.html).\n\n```javascript\nmap.addControl(new MapboxInspect({\n  renderPopup: function(features) {\n    return '\u003ch1\u003e' + features.length + '\u003c/h1\u003e';\n  }\n}));\n```\n\n### Custom Color Function\n\nYou are able to control the generated colors and background of the inspection style.\nCheck [`examples/custom-color-1.html`](http://mapbox-gl-inspect.lukasmartinelli.ch/examples/custom-color-1.html) and [`examples/custom-color-2.html`](http://mapbox-gl-inspect.lukasmartinelli.ch/examples/custom-color-2.html).\n\n```javascript\nvar colors = ['#FC49A3', '#CC66FF', '#66CCFF', '#66FFCC'];\nmap.addControl(new MapboxInspect({\n  backgroundColor: '#000',\n  assignLayerColor: function(layerId, alpha) {\n    var randomNumber = parseInt(Math.random() * colors.length);\n    return colors[randomNumber];\n   }\n}));\n```\n\n### Show just Popup but no Inspect Style\n\nYou can also hide the inspect button and enable the popup on the map if just want the popup hovering feature in your normal map but no inspect style.\nCheck [`examples/no-inspect-style.html`](http://mapbox-gl-inspect.lukasmartinelli.ch/examples/no-inspect-style.html).\n\n\n```js\nmap.addControl(new MapboxInspect({\n  showInspectButton: false,\n  showMapPopup: true\n}));\n```\n\n### Show Popup only for certain Features\n\nYou can pass a `queryParameters` object structured like the parameters object documented for [`map.queryRenderedFeatures`](https://www.mapbox.com/mapbox-gl-js/api/#Map#queryRenderedFeatures).\nThis let's you show the inspect popup for only certain layers.\nCheck [`examples/query-params.html`](http://mapbox-gl-inspect.lukasmartinelli.ch/examples/query-params.html).\n\n\n```js\nmap.addControl(new MapboxInspect({\n  queryParameters: {\n    layers: ['composite_road_line']\n  }\n}));\n```\n\nYou can also use this feature to do custom layer [filtering](https://www.mapbox.com/mapbox-gl-style-spec/#types-filter).\n\n```js\nmap.addControl(new MapboxInspect({\n  queryParameters: {\n    filter: ['\u003e', 'height', 10]\n  }\n}));\n```\n\n### Less Fidly Popup\n\nIf inspecting features is too fiddly for thin lines you can optionally set a custom pixel buffer around the pointer when querying for features to make inspection a bit more forgiving.\nCheck [`examples/less-fidly.html`](http://mapbox-gl-inspect.lukasmartinelli.ch/examples/less-fidly.html).\n\n\n```js\nmap.addControl(new MapboxInspect({\n  selectThreshold: 50\n});\n```\n\n### Show Popup only on Click not on Hovering\n\nDo not show the inspect popup when hovering over the map but only when clicking on the map.\nCheck [`examples/popup-on-click.html`](http://mapbox-gl-inspect.lukasmartinelli.ch/examples/popup-on-click.html).\n\n\n```js\nmap.addControl(new MapboxInspect({\n  showMapPopup: true,\n  showMapPopupOnHover: false,\n  showInspectMapPopupOnHover: false\n});\n```\n\n## Develop\n\nRun the linter and watch for changes to rebuild with browserify.\n\n```\nnpm install\nnpm run test\nnpm run watch\n```\n\nCreate a minified standalone build.\n\n```\nnpm install\nnpm run build\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukasmartinelli%2Fmapbox-gl-inspect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flukasmartinelli%2Fmapbox-gl-inspect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukasmartinelli%2Fmapbox-gl-inspect/lists"}