axios.get(serverUrl).then(res => {
that.mapExtentChange = that.$map.MapView.on("click", function (evt) {
that.$map.identifyTask(val.geoUrl,[val.subLayer],evt.mapPoint,).then((results)=>{
if(results.length > 0){
var result = results[0].feature;
console.log("图层数据",results)
}
})
});
}).catch(error => {
console.log(error)
})
let mapView = {
identifyTask: function (url, layerids, geometry) {
return new Promise(function (resolve, reject) {
loadModules(["esri/rest/identify", "esri/rest/support/IdentifyParameters"])
.then(([identify, IdentifyParameters]) => {
var params = new IdentifyParameters();
params.tolerance = 0.5;
params.returnGeometry = true;
params.returnFieldName = false;
params.layerIds = layerids;
params.layerOption = "all";
params.geometry = geometry;
params.width = arcgismap.MapView.width;
params.height = arcgismap.MapView.height;
params.mapExtent = arcgismap.MapView.extent;
identify.identify(url, params).then(function (response) {
console.log("response.results", response);
resolve(response.results);
})
})
})
},
}
export default mapView