Skip to content

Commit

Permalink
Switched default basemap to BRT - grijs
Browse files Browse the repository at this point in the history
The rewrite to start with invisible pastel and OSM basemaps also improved the initial load time :)
  • Loading branch information
bengunnewijkGeonovum committed Feb 14, 2024
1 parent 06651a0 commit 2f692a6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ async function main() {
globalThis.map = map;

// Add two Dutch basemap options for the Dutch example.
await addPDOKTileLayer(map, "grijs");
await addPDOKTileLayer(map, "pastel");
await addPDOKTileLayer(map, "grijs", true);
await addPDOKTileLayer(map, "pastel", false);
// Add a global basemap for people who edit with data outside the Netherlands.
addOSMBaseLayer(map);
addOSMBaseLayer(map, false);

addPopupToLayer(map);

Expand Down
6 changes: 4 additions & 2 deletions scripts/basemaps.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,19 @@ import { addOpenLayersTransformation } from "./openlayers-proj4.js";
// URL https://service.pdok.nl//brt/achtergrondkaart/wmts/v2_0?request=GetCapabilities&service=WMTS
// Source tileMatrixSet=EPSG:28992&crs=EPSG:28992&layers=pastel&styles=default&format=image/png&url=https://service.pdok.nl//brt/achtergrondkaart/wmts/v2_0?request%3DGetCapabilities%26service%3DWMTS

export function addOSMBaseLayer(map) {
export function addOSMBaseLayer(map, startVisible = true) {
const tileLayer = new ol.layer.Tile({
title: "OSM",
type: "base",
source: new ol.source.OSM(),
visible: startVisible,
});

map.addLayer(tileLayer);
return tileLayer;
}

export async function addPDOKTileLayer(map, wmtsLayerId) {
export async function addPDOKTileLayer(map, wmtsLayerId, startVisible = true) {
const wmtsServiceURL =
"https://service.pdok.nl/brt/achtergrondkaart/wmts/v2_0?request=GetCapabilities&service=WMTS";

Expand Down Expand Up @@ -76,6 +77,7 @@ export async function addPDOKTileLayer(map, wmtsLayerId) {

const tileLayer = new ol.layer.Tile({
source: new ol.source.WMTS(wmtsOptions),
visible: startVisible,
});

tileLayer.set("name", "PDOK - BRT " + wmtsLayerId);
Expand Down

0 comments on commit 2f692a6

Please sign in to comment.