TopoTijdreis
TopoTijdReis and PDOK in OpenLayers
by j_l_h_hartmann
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.5.0/proj4.js"></script>
<script src="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.0.1/build/ol.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.0.1/css/ol.css">
<body>
<div id=map style="width:600px;height:800px">
</div>
</body>
JavaScript
function mkTopoTijdReisSource(jaar) {
proj4.defs("EPSG:28992_TopoTijdReis","+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +towgs84=565.417,50.3319,465.552,-0.398957,0.343988,-1.8774,4.0725 +units=m +no_defs");
if (ol.proj.proj4) ol.proj.proj4.register(proj4)
var proj28992TopoTijdReisExtent = [12628.0541, 308179.0423, 283594.4779, 611063.1429]
proj28992TopoTijdReis = new ol.proj.Projection({
code:"EPSG:28992_TopoTijdReis",
extent:proj28992TopoTijdReisExtent
})
var resolutions = [
3251.206502413005,
1625.6032512065026,
812.8016256032513,
406.40081280162565,
203.20040640081282,
101.60020320040641,
50.800101600203206,
25.400050800101603,
12.700025400050801,
6.350012700025401,
3.1750063500127004,
1.5875031750063502,
0.7937515875031751,
0.39687579375158755,
0.19843789687579377,
0.09921894843789689,
0.04960947421894844
]
var matrixIds = new Array(14);
for (var z = 0; z < 14; ++z) {
matrixIds[z] = z;
}
var url =
"https://tiles.arcgis.com/tiles/nSZVuSZjHpEZZbRo/arcgis/rest/services/Historische_tijdreis_" +
jaar +
"/MapServer/WMTS"
var l = "Historische_tijdreis_" + jaar
var source = new ol.source.WMTS({
url:url,
layer:l,
matrixSet: "default028mm",
format: "image/jpgpng",
projection: proj28992TopoTijdReis,
tileGrid: new ol.tilegrid.WMTS({
origin: [-3.05155E7, 3.1112399999999993E7],
resolutions: resolutions,
matrixIds: matrixIds
}),
style: "default",
})
return(source)
}
function mkPdokSource(layer) {
proj4.defs("EPSG:28992","+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel...