Estoy intentando probar ArcGIS REST,带有512x512角度7的openlayers瓷砖,可以解决问题。
所有对象均发生错误core.js:9110错误TypeError:无法读取未定义的属性“ replace” 在sy.tileUrlFunction
int
ngOnInit() {
this.map = new ol.Map({
target: 'map',
layers: [
new ol.layer.Tile({
source: new ol.source.XYZ({
attributions: 'Copyright:© 2013 ESRI, i-cubed, GeoEye',
maxZoom: 16,
projection: 'EPSG:4326',
tileSize: this.tileSize,
tileUrlFunction: function(tileCoord) {
return this.urlTemplate.replace('{z}', (tileCoord[0] - 1).toString())
.replace('{x}', tileCoord[1].toString())
.replace('{y}', (-tileCoord[2] - 1).toString());
},
wrapX: true
})
})
],
view: new ol.View({
center: [0, 0],
projection: 'EPSG:4326',
zoom: 2,
minZoom: 2
})
});
}
答案 0 :(得分:0)
仅在ngOnInit中添加urlTemplate的声明
var url= 'https://services.arcgisonline.com/arcgis/rest/services/' +
'ESRI_Imagery_World_2D/MapServer/tile/{z}/{y}/{x}';