UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

3 lines (2 loc) 3.19 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.19/LICENSE.txt */ import{sqlAnd as e}from"../../../core/sql.js";import t from"../../../geometry/Point.js";import r from"../../../geometry/SpatialReference.js";import{polygonCentroidPoint as n}from"../../../geometry/support/centroid.js";import{searchImages as i}from"../../../layers/orientedImagery/queries.js";import{createCoveragePolygon as o}from"../../../layers/orientedImagery/core/coverageUtils.js";async function a(e,r,a,s,c){const{polygon:u}=o(r.attributes),f=t.fromJSON(n(u));f.z=void 0;const y=h(e.definitionExpression,a);let d,p;try{d=await i({layerInstanceOrURL:e,point:f,queryParams:{where:y,timeExtent:s}},c)}catch(l){p=l}return new m(f,d,p)}async function s(e,t,r,n,o){const a=e.effectiveSequenceOrderField,s=h(e.definitionExpression,r,`${a} IS NOT NULL`);let c,u;try{c=await i({layerInstanceOrURL:e,point:t,queryParams:{where:s,orderByFields:[`${a}`],returnGeometry:!0,outFields:["*"],timeExtent:n}},o)}catch(f){u=f}return new m(t,c,u)}function c(e,t,r,n){const i=e.effectiveSequenceOrderField,o=h(e.definitionExpression,t,`${i} IS NOT NULL`),a=e.createQuery();return a.where=o,a.timeExtent=r,e.queryFeatureCount(a,n)}async function u(t,n,i,o="ASC",a,s,c){const u=t.effectiveSequenceOrderField;let f=h(t.definitionExpression,a,`${u} IS NOT NULL`);const y="number"==typeof n?n-1:void 0;"string"===n&&(f=e(f,`${u} = ${n}`));const m=t.createQuery();m.where=f,m.start=y,m.num=i,m.timeExtent=s,m.orderByFields=[`${u} ${o}`],t.spatialReference.isGeographic&&(m.outSpatialReference=r.WebMercator);try{const e=await t.queryFeatures(m,c);return await w(e,t),new d(e)}catch(p){return new d(void 0,p)}}async function f(e,t,n=0,i=1,o,a,s){const c=e.effectiveSequenceOrderField,u=l(c,n),f=h(e.definitionExpression,o,p(n,t,c)),y=e.createQuery();y.where=f,y.num=i,y.orderByFields=u,y.timeExtent=a,e.spatialReference.isGeographic&&(y.outSpatialReference=r.WebMercator);try{const t=await e.queryFeatures(y,s);return await w(t,e),new d(t)}catch(m){return new d(void 0,m)}}async function y(e,t,n,i,o){const a=Array.isArray(t)?t:[t],s=h(e.definitionExpression,n,`${e.objectIdField} IN (${a.join(",")})`),c=e.createQuery();c.where=s,e.spatialReference.isGeographic&&(c.outSpatialReference=r.WebMercator),i&&(c.timeExtent=i);try{const t=await e.queryFeatures(c,o);return await w(t,e),new d(t)}catch(u){return new d(void 0,u)}}class d{constructor(e,t){this.response=e,this.error=t}}class m{constructor(e,t,r){this.nextLocation=e,this.response=t,this.error=r}}function p(e,t,r){return e>0?`${r} IS NOT NULL AND ${r} > ${t}`:`${r} IS NOT NULL AND ${r} < ${t}`}function l(e,t){return t>0?[`${e}`]:[`${e} DESC`]}async function w(e,t){const r=await import("../../../layers/orientedImagery/core/ExposurePoint.js").then(e=>e.default);e.features.forEach(e=>{const n=r.fromJSON({...e.toJSON(),layer:t});n&&(e.attributes=n)})}function h(...t){let r="1=1";return t.forEach(t=>{r=e(r,t)}),r}export{m as QueryNextLocationFeaturesResponse,d as QueryOrientedImageryFeaturesResponse,f as queryAfterSequenceField,y as queryFeatureByObjectIds,a as queryNextLocationFeatures,u as queryOffsetSequenceFeatures,c as querySequenceCount,s as querySequenceFeaturesAroundPoint};