12345 |
- /*
- All material copyright ESRI, All Rights Reserved, unless otherwise specified.
- See https://js.arcgis.com/4.24/esri/copyright.txt for details.
- */
- import t from"../request.js";import{normalizeCentralMeridian as r}from"../geometry/support/normalizeUtils.js";import{parseUrl as e,encode as s,asValidOptions as o}from"./utils.js";import{identifyToIdentifyRESTParameters as n}from"./operations/identify.js";import u from"./support/IdentifyParameters.js";import f from"./support/IdentifyResult.js";async function i(u,f,i){const c=(f=a(f)).geometry?[f.geometry]:[],l=e(u);return l.path+="/identify",r(c).then((r=>{const e=n(f,{geometry:r&&r[0]}),u=s({...l.query,f:"json",...e}),a=o(u,i);return t(l.path,a).then(m).then((t=>p(t,f.sublayers)))}))}function m(t){const r=t.data;r.results=r.results||[];const e={results:[]};return e.results=r.results.map((t=>f.fromJSON(t))),e}function a(t){return t=u.from(t)}function p(t,r){if(!r?.length)return t;const e=new Map;function s(t){e.set(t.id,t),t.sublayers&&t.sublayers.forEach(s)}r.forEach(s);for(const o of t.results)o.feature.sourceLayer=e.get(o.layerId);return t}export{i as identify};
|