IdentifyUtils.js
1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import {loadModules} from 'esri-loader'
export default {
methods: {
identify(url,layerIds,geometry ,callBackFunction){
var self = this;
loadModules([
"esri/tasks/IdentifyTask",
"esri/tasks/support/IdentifyParameters"
]).then(([
IdentifyTask,
IdentifyParameters
]) => {
var identifyTask = new IdentifyTask({
url:url
}),
identifyParameters = new IdentifyParameters();
identifyParameters.geometry = geometry;
if(layerIds){
identifyParameters.layerIds = layerIds;
}
identifyParameters.layerOption = "all";
identifyParameters.tolerance = 3;
identifyParameters.mapExtent = geometry.extent;
identifyParameters.returnGeometry = true;
identifyParameters.spatialReference = geometry.spatialReference;
identifyTask.execute(identifyParameters).then(result => {
if(callBackFunction && typeof callBackFunction == 'function'){
callBackFunction(result);
}
});
}).catch(err => {
throw(err);
});
}
}
}