Skip to content

Commit 64bed5b

Browse files
committed
Use index for all OpenMapTiles samples.
1 parent 7e5fd97 commit 64bed5b

File tree

2 files changed

+5
-32
lines changed

2 files changed

+5
-32
lines changed

demo.js

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ import SampleControl from './OpenMapSamplesControl';
44
import Sample from "openmapsamples/lib/Sample";
55
import Layer from "openmapsamples/lib/Layer";
66
import { ExamplePlaceData, ExampleTransportationData } from "openmapsamples/lib/SampleData/ExampleSampleData";
7-
import { default as highwayAttributesSample, sampleData as highwayAttributesSampleData } from "openmapsamples/samples/OpenMapTiles/HighwayAttributes";
8-
import { default as highwayLinkAttributesSample, sampleData as highwayLinkAttributesSampleData } from "openmapsamples/samples/OpenMapTiles/HighwayLinkAttributes";
7+
import { default as OpenMapTilesSamples } from "openmapsamples/samples/OpenMapTiles";
98
// import MaplibreInspect from "maplibre-gl-inspect";
109
// import "maplibre-gl-inspect/dist/maplibre-gl-inspect.css";
1110

@@ -29,34 +28,8 @@ async function main() {
2928
// Add our sample data.
3029
let sampleControl = new SampleControl();
3130

32-
// Add our Highway Attributes sample.
33-
sampleControl.addSample(highwayAttributesSample);
34-
// Set a custom row-hight callback to give more space to motorways at high zooms.
35-
// This isn't needed for all styles, but the osm-standard style
36-
// inflates widths of motorways and trunk at high zooms.
37-
highwayAttributesSampleData.setRowHeightCallback(function(zoom, row, numRows) {
38-
if (zoom > 18 && row < 1) {
39-
return 24 / numRows / Math.pow(2, zoom - 4);
40-
} else if (zoom > 16 && row < 1) {
41-
return 22 / numRows / Math.pow(2, zoom - 4);
42-
} else {
43-
return 20 / numRows / Math.pow(2, zoom - 4);
44-
}
45-
});
46-
47-
// Add our Highway Link Attributes sample.
48-
sampleControl.addSample(highwayLinkAttributesSample);
49-
// Set a custom row-hight callback to give more space to motorways at high zooms.
50-
// This isn't needed for all styles, but the osm-standard style
51-
// inflates widths of motorways and trunk at high zooms.
52-
highwayLinkAttributesSampleData.setRowHeightCallback(function(zoom, row, numRows) {
53-
if (zoom > 18 && row < 2) {
54-
return 24 / numRows / Math.pow(2, zoom - 4);
55-
} else if (zoom > 16 && row < 2) {
56-
return 22 / numRows / Math.pow(2, zoom - 4);
57-
} else {
58-
return 20 / numRows / Math.pow(2, zoom - 4);
59-
}
31+
OpenMapTilesSamples.forEach((sample, i) => {
32+
sampleControl.addSample(sample);
6033
});
6134

6235
let sample = sampleControl.addSample(

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)