Custom Gis Application with Arcgis Javascript API with modern layouting
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

9 lines
2.9 KiB

// All material copyright Esri, All Rights Reserved, unless otherwise specified.
// See https://js.arcgis.com/4.30/esri/copyright.txt for details.
//>>built
define("exports ../../kernel ../../request ../../core/Error ../../core/promiseUtils ./arcgisLayerUrl ../../portal/Portal ../../portal/PortalItem".split(" "),function(l,u,g,h,k,m,v,n){async function w(a){var b=(await p(a)).serviceItemId;if(!b)return null;b=new n({id:b,apiKey:a.apiKey});const c=await x(a);null!=c&&(b.portal=new v({url:c}));try{return b.load({signal:a.signal})}catch(e){return k.throwIfAbortError(e),null}}async function p(a){if(a.rootDocument)return a.rootDocument;const b={query:{f:"json",
...a.customParameters,token:a.apiKey},responseType:"json",signal:a.signal};try{const c=await g(a.sceneServerUrl,b);a.rootDocument=c.data}catch{a.rootDocument={}}return a.rootDocument}async function x(a){var b=u.id?.findServerInfo(a.sceneServerUrl);if(b?.owningSystemUrl)return b.owningSystemUrl;b=a.sceneServerUrl.replace(/(.*\/rest)\/.*/i,"$1")+"/info";try{const c=(await g(b,{query:{f:"json"},responseType:"json",signal:a.signal})).data.owningSystemUrl;if(c)return c}catch(c){k.throwIfAbortError(c)}return null}
async function q(a,b){a=m.parse(a);if(!a)throw new h("invalid-feature-service-url","Invalid feature service url");const c=a.url.path;a=b.layerId;if(null==a)return{serverUrl:c};var e=p(b),d=b.featureServiceItem?await b.featureServiceItem.fetchData("json"):null;const y=(d?.layers?.[0]||d?.tables?.[0])?.customParameters,r=f=>g(c,{query:{f:"json",...y},responseType:"json",authMode:f,signal:b.signal});d=r("anonymous").catch(()=>r("no-prompt"));const [t,z]=await Promise.all([d,e]);e=z?.layers;d=t.data&&
t.data.layers;if(!Array.isArray(d))throw Error("expected layers array");if(!Array.isArray(e)){if(null!=a&&a<d.length)return{serverUrl:c,layerId:d[a].id}}else for(let f=0;f<Math.min(e.length,d.length);f++)if(e[f].id===a)return{serverUrl:c,layerId:d[f].id};throw Error("could not find matching associated sublayer");}async function A({sceneLayerItem:a,signal:b}){if(!a)return null;try{const c=(await a.fetchRelatedItems({relationshipType:"Service2Service",direction:"reverse"},{signal:b})).find(d=>"Feature Service"===
d.type)||null;if(!c)return null;const e=new n({portal:c.portal,id:c.id});await e.load();return e}catch(c){return k.throwIfAbortError(c),null}}l.findAssociatedFeatureService=async function(a,b){a=m.parse(a);if(!a)throw new h("invalid-url","Invalid scene service url");a={...b,sceneServerUrl:a.url.path,layerId:a.sublayer??void 0};a.sceneLayerItem??(a.sceneLayerItem=await w(a));if(null==a.sceneLayerItem)return q(a.sceneServerUrl.replace("/SceneServer","/FeatureServer"),a);b=await A(a);if(!b?.url)throw new h("related-service-not-found",
"Could not find feature service through portal item relationship");a.featureServiceItem=b;a=await q(b.url,a);a.portalItem=b;return a};Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});