我試圖在eps:28992設置上使用自定義wmts圖層創建一個openlayers3地圖。我以前使用過openlayers 2,但我沒有成功。使用openlayers3創建EPSG:28992地圖
我已經嘗試將eps圖層添加到proj,但它似乎沒有做任何事情,出現錯誤:Uncaught TypeError:無法讀取null的屬性'0'。 並且沒有請求瓷磚。
var projection = ol.proj.get('EPSG:28992');
var projectionExtent = projection.getExtent();
var resolutions = [3440.640, 1720.320, 860.160, 430.080, 215.040, 107.520, 53.760, 26.880, 13.440, 6.720, 3.360, 1.680, 0.840, 0.420, 0.210];
var matrixIds = new Array(26);
for (var i=0; i<26; ++i) {
matrixIds[i] = "EPSG:28992:" + i;
}
var attribution = new ol.Attribution({
html: 'Tiles © <a href="http://services.arcgisonline.com/arcgis/rest/' +
'services/Demographics/USA_Population_Density/MapServer/">ArcGIS</a>'
});
lonlat = result.center.split(',');
var map = new ol.Map({
view: new ol.View({
center: [lonlat[0],lonlat[1]],
zoom: result.zoom
}),
layers: [
new ol.layer.Tile({
opacity: 0.7,
source: new ol.source.WMTS({
attributions: [attribution],
url: "http://geodata.nationaalgeoregister.nl/wmts/",
name: "Basis Registratie Topografie",
layer: "brtachtergrondkaart",
matrixSet: "EPSG:28992",
format: 'image/png',
projection: projection,
tileGrid: new ol.tilegrid.WMTS({
origin: ol.extent.getTopLeft(projectionExtent),
resolutions: resolutions,
matrixIds: matrixIds
}),
style: 'default'
})
})
],
target: target
});
分辨率EN matrixIds在openlayers2工作,所以我直接複製他們,我覺得我失去了一些東西非常小的不ANY1有一個想法?
p.s.我加了EPSG:28992與以下行proj4.js:
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 +towgs84=565.417,50.3319,465.552,-0.398957,0.343988,-1.8774,4.0725 +units=m +no_defs");
關於卡斯帕
看看這是否可以幫助你:https://github.com/bartvde/PDOK-OpenLayers3 – bartvde
Thnx的演示,這正是我需要的。 –