@open-formulieren/leaflet-tools
Version:
Shared utilities for Leaflet maps and Dutch (NL) geo standards
23 lines (22 loc) • 778 B
JavaScript
import { TILE_BASE_URL, TILES_ATTRIBUTION } from './constants';
export const buildTileLayerEndpoint = (variant = 'standaard', projection = 'EPSG:28992') => {
const base = `${TILE_BASE_URL}${variant}/${projection}`;
return `${base}/{z}/{x}/{y}.png`;
};
/**
* A pre-configured tile layer for the Rijksdriehoek (RD) projection (EPSG:28992).
*
* This used the standard tile layer with attribution enabled, while limiting the zoom
* level between 1 and 13.
*
* @note
*
* Increasing the zoom level is *possible*, but the inaccuracies of the proj4
* transformation start to show beyond zoom level 13.
*/
export const TILE_LAYER_RD = {
url: buildTileLayerEndpoint('standaard', 'EPSG:28992'),
minZoom: 1,
maxZoom: 13,
attribution: TILES_ATTRIBUTION,
};