Skip to content

Commit

Permalink
Add max zoom prop
Browse files Browse the repository at this point in the history
  • Loading branch information
MiraGeowerkstatt committed May 28, 2024
1 parent de6df25 commit 7abf85b
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions src/client/src/components/basemapSelector/basemaps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,6 @@ const baseLayerNames = {
greymap: "ch.swisstopo.pixelkarte-grau",
};

const createLayer = (layerName: string) => {
return new TileLayer({
minResolution: 0.1,
source: new XYZ({
url: `https://wmts10.geo.admin.ch/1.0.0/${layerName}/default/current/3857/{z}/{x}/{y}.jpeg`,
crossOrigin,
attributions,
}),
});
};

export const basemaps: Basemap[] = [
{
shortName: "colormap",
Expand All @@ -58,6 +47,7 @@ export const basemaps: Basemap[] = [
layers: [
new TileLayer({
minResolution: 2.5,
maxZoom: 27,
source: new XYZ({
url: `https://wmts10.geo.admin.ch/1.0.0/${baseLayerNames.colormap}/default/current/3857/{z}/{x}/{y}.jpeg`,
crossOrigin,
Expand Down Expand Up @@ -85,13 +75,29 @@ export const basemaps: Basemap[] = [
{
shortName: "satellite",
previewImg: baseLayerNames.satellite,
layer: createLayer(baseLayerNames.satellite),
layer: new TileLayer({
minResolution: 0.1,
maxZoom: 27,
source: new XYZ({
url: `https://wmts10.geo.admin.ch/1.0.0/${baseLayerNames.satellite}/default/current/3857/{z}/{x}/{y}.jpeg`,
crossOrigin,
attributions,
}),
}),
},

{
shortName: "greymap",
previewImg: baseLayerNames.greymap,
layer: createLayer(baseLayerNames.greymap),
layer: new TileLayer({
minResolution: 0.1,
maxZoom: 27,
source: new XYZ({
url: `https://wmts10.geo.admin.ch/1.0.0/${baseLayerNames.greymap}/default/current/3857/{z}/{x}/{y}.jpeg`,
crossOrigin,
attributions,
}),
}),
},
];

Expand Down

0 comments on commit 7abf85b

Please sign in to comment.