我正在尝试使用 react-arcgis npm 向 arcgis 添加一个图层,
esriPromise(["esri/layers/TileLayer"]).then(([ TileLayer ]) => {
var initLayer = new TileLayer({
url: "http://......."
});
console.log(initLayer);
this.setState({ layer: initLayer });
});
但是我得到大多数属性的空输出。
另外,当我尝试将图层属性添加到地图时,出现以下错误,
[esri.core.Accessor] Accessor#set 分配“esri.layers.TileLayer”的实例,它不是“esri.core.Collection”的子类
<div id = 'main-content'>
<Map
class="full-screen-map"
mapProperties={{
basemap: 'topo',
showLabels : true,
logo: false,
sliderPosition: 'bottom-left',
layers: this.state.layer,
}}
viewProperties={{
layers: this.state.layer,
zoom: 12,
extent: this.state.extent,
minZoom: minZoom,
maxZoom: maxZoom,
}}
onFail={this.handleFail}
onLoad={this.handleMapLoad}
/>
</div>
任何帮助将非常感激...