Skip to content

Commit

Permalink
add maplibre-gl-inspect to viewer (#315)
Browse files Browse the repository at this point in the history
* add maplibre-gl-inspect to viewer

* downgrade maplibre to 4.7.1
  • Loading branch information
bdon authored Oct 9, 2024
1 parent 468df9f commit e40f516
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 11 deletions.
42 changes: 34 additions & 8 deletions app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
"format": "biome format --write src test --javascript-formatter-indent-style=space --json-formatter-indent-style=space"
},
"dependencies": {
"maplibre-gl": "5.0.0-pre.1",
"@maplibre/maplibre-gl-inspect": "^1.7.0",
"maplibre-gl": "4.7.1",
"pixelmatch": "^5.3.0",
"pmtiles": "3.1.0",
"pmtiles": "3.2.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-dropzone": "^14.2.3",
Expand Down
13 changes: 12 additions & 1 deletion app/src/MapViewComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import MaplibreInspect from "@maplibre/maplibre-gl-inspect";
import "@maplibre/maplibre-gl-inspect/dist/maplibre-gl-inspect.css";
import maplibregl from "maplibre-gl";
import { MapGeoJSONFeature, StyleSpecification } from "maplibre-gl";
import "maplibre-gl/dist/maplibre-gl.css";
Expand Down Expand Up @@ -175,7 +177,7 @@ function MapLibreView(props: {
);
}

const protocol = new pmtiles.Protocol();
const protocol = new pmtiles.Protocol({ metadata: true });
protocolRef.current = protocol;
maplibregl.addProtocol("pmtiles", protocol.tile);

Expand All @@ -199,6 +201,15 @@ function MapLibreView(props: {
}),
);

map.addControl(
new MaplibreInspect({
popup: new maplibregl.Popup({
closeButton: false,
closeOnClick: false,
}),
}),
);

const popup = new maplibregl.Popup({
closeButton: true,
closeOnClick: false,
Expand Down

0 comments on commit e40f516

Please sign in to comment.