@loaders.gl/services 5.0.0-alpha.7 → 5.0.0-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -46
- package/dist/authentication.d.ts +22 -9
- package/dist/authentication.d.ts.map +1 -1
- package/dist/authentication.js +28 -11
- package/dist/authentication.js.map +1 -1
- package/dist/index.cjs +301 -23886
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +2 -31
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -20
- package/dist/index.js.map +1 -1
- package/package.json +6 -16
- package/src/authentication.ts +31 -19
- package/src/index.ts +3 -84
- package/dist/arcgis/arcgis-capability-graph.d.ts +0 -48
- package/dist/arcgis/arcgis-capability-graph.d.ts.map +0 -1
- package/dist/arcgis/arcgis-capability-graph.js +0 -220
- package/dist/arcgis/arcgis-capability-graph.js.map +0 -1
- package/dist/arcgis/arcgis-feature-server-source-loader.d.ts +0 -94
- package/dist/arcgis/arcgis-feature-server-source-loader.d.ts.map +0 -1
- package/dist/arcgis/arcgis-feature-server-source-loader.js +0 -231
- package/dist/arcgis/arcgis-feature-server-source-loader.js.map +0 -1
- package/dist/arcgis/arcgis-image-server-source-loader.d.ts +0 -96
- package/dist/arcgis/arcgis-image-server-source-loader.d.ts.map +0 -1
- package/dist/arcgis/arcgis-image-server-source-loader.js +0 -143
- package/dist/arcgis/arcgis-image-server-source-loader.js.map +0 -1
- package/dist/arcgis/arcgis-image-tile-source-loader.d.ts +0 -71
- package/dist/arcgis/arcgis-image-tile-source-loader.d.ts.map +0 -1
- package/dist/arcgis/arcgis-image-tile-source-loader.js +0 -153
- package/dist/arcgis/arcgis-image-tile-source-loader.js.map +0 -1
- package/dist/arcgis/arcgis-map-tile-source-loader.d.ts +0 -106
- package/dist/arcgis/arcgis-map-tile-source-loader.d.ts.map +0 -1
- package/dist/arcgis/arcgis-map-tile-source-loader.js +0 -202
- package/dist/arcgis/arcgis-map-tile-source-loader.js.map +0 -1
- package/dist/arcgis/arcgis-scene-aggregation.d.ts +0 -34
- package/dist/arcgis/arcgis-scene-aggregation.d.ts.map +0 -1
- package/dist/arcgis/arcgis-scene-aggregation.js +0 -57
- package/dist/arcgis/arcgis-scene-aggregation.js.map +0 -1
- package/dist/arcgis/arcgis-scene-server-source-loader.d.ts +0 -112
- package/dist/arcgis/arcgis-scene-server-source-loader.d.ts.map +0 -1
- package/dist/arcgis/arcgis-scene-server-source-loader.js +0 -157
- package/dist/arcgis/arcgis-scene-server-source-loader.js.map +0 -1
- package/dist/arcgis/arcgis-server.d.ts +0 -15
- package/dist/arcgis/arcgis-server.d.ts.map +0 -1
- package/dist/arcgis/arcgis-server.js +0 -41
- package/dist/arcgis/arcgis-server.js.map +0 -1
- package/dist/arcgis/arcgis-url-utils.d.ts +0 -3
- package/dist/arcgis/arcgis-url-utils.d.ts.map +0 -1
- package/dist/arcgis/arcgis-url-utils.js +0 -23
- package/dist/arcgis/arcgis-url-utils.js.map +0 -1
- package/dist/arcgis/arcgis-vector-tile-server-source-loader.d.ts +0 -115
- package/dist/arcgis/arcgis-vector-tile-server-source-loader.d.ts.map +0 -1
- package/dist/arcgis/arcgis-vector-tile-server-source-loader.js +0 -156
- package/dist/arcgis/arcgis-vector-tile-server-source-loader.js.map +0 -1
- package/dist/service-registry.d.ts +0 -18
- package/dist/service-registry.d.ts.map +0 -1
- package/dist/service-registry.js +0 -29
- package/dist/service-registry.js.map +0 -1
- package/src/arcgis/arcgis-capability-graph.ts +0 -295
- package/src/arcgis/arcgis-feature-server-source-loader.ts +0 -346
- package/src/arcgis/arcgis-image-server-source-loader.ts +0 -242
- package/src/arcgis/arcgis-image-tile-source-loader.ts +0 -206
- package/src/arcgis/arcgis-map-tile-source-loader.ts +0 -286
- package/src/arcgis/arcgis-scene-aggregation.ts +0 -90
- package/src/arcgis/arcgis-scene-server-source-loader.ts +0 -258
- package/src/arcgis/arcgis-server.ts +0 -61
- package/src/arcgis/arcgis-url-utils.ts +0 -26
- package/src/arcgis/arcgis-vector-tile-server-source-loader.ts +0 -233
- package/src/service-registry.ts +0 -43
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
// loaders.gl
|
|
2
|
-
// SPDX-License-Identifier: MIT
|
|
3
|
-
// Copyright (c) vis.gl contributors
|
|
4
|
-
import { DataSource } from '@loaders.gl/loader-utils';
|
|
5
|
-
import { MVTLoader } from '@loaders.gl/mvt';
|
|
6
|
-
/** A source for ArcGIS VectorTileServer metadata and PBF tiles. */
|
|
7
|
-
export class ArcGISVectorTileServerSource extends DataSource {
|
|
8
|
-
/** Decoded tile family consumed by generic tile renderers. */
|
|
9
|
-
mimeType = 'application/vnd.mapbox-vector-tile';
|
|
10
|
-
/** ArcGIS tiles are decoded to WGS84 coordinates before rendering. */
|
|
11
|
-
localCoordinates = false;
|
|
12
|
-
/** Cached service metadata request. */
|
|
13
|
-
serviceMetadata = null;
|
|
14
|
-
/** Query parameters supplied with the service URL, such as an access token. */
|
|
15
|
-
serviceQueryParameters;
|
|
16
|
-
/** Creates an ArcGIS VectorTileServer source. */
|
|
17
|
-
constructor(url, options = {}, coreApi) {
|
|
18
|
-
const serviceURL = new URL(url);
|
|
19
|
-
serviceURL.pathname = serviceURL.pathname.replace(/\/$/, '');
|
|
20
|
-
super(`${serviceURL.origin}${serviceURL.pathname}`, options, ArcGISVectorTileServerSourceLoader.defaultOptions, coreApi);
|
|
21
|
-
this.serviceQueryParameters = new URLSearchParams(serviceURL.search);
|
|
22
|
-
}
|
|
23
|
-
/** Returns normalized service and tile-grid metadata. */
|
|
24
|
-
async getMetadata() {
|
|
25
|
-
const metadata = await this.getServiceMetadata();
|
|
26
|
-
const tileInfo = metadata.tileInfo;
|
|
27
|
-
const lods = tileInfo?.lods || [];
|
|
28
|
-
const extent = metadata.fullExtent || metadata.initialExtent;
|
|
29
|
-
return {
|
|
30
|
-
name: metadata.mapName || this.url.split('/').pop() || '',
|
|
31
|
-
title: metadata.mapName,
|
|
32
|
-
abstract: metadata.serviceDescription,
|
|
33
|
-
format: 'application/vnd.mapbox-vector-tile',
|
|
34
|
-
minZoom: lods[0]?.level,
|
|
35
|
-
maxZoom: lods.at(-1)?.level,
|
|
36
|
-
boundingBox: extent
|
|
37
|
-
? [
|
|
38
|
-
[extent.xmin, extent.ymin],
|
|
39
|
-
[extent.xmax, extent.ymax]
|
|
40
|
-
]
|
|
41
|
-
: undefined,
|
|
42
|
-
layer: {
|
|
43
|
-
name: metadata.mapName || '',
|
|
44
|
-
srs: tileInfo?.spatialReference ? [getSpatialReference(tileInfo.spatialReference)] : [],
|
|
45
|
-
layers: []
|
|
46
|
-
},
|
|
47
|
-
formatHeader: {
|
|
48
|
-
tileInfo,
|
|
49
|
-
styleURL: this.getStyleURL(),
|
|
50
|
-
spriteURL: this.getSpriteURL()
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
/** Fetches one raw PBF tile from the ArcGIS tile endpoint. */
|
|
55
|
-
async getTile(parameters, signal) {
|
|
56
|
-
const response = await this.fetch(this.getTileURL(parameters), {
|
|
57
|
-
signal,
|
|
58
|
-
headers: { Accept: 'application/vnd.mapbox-vector-tile, application/x-protobuf' }
|
|
59
|
-
});
|
|
60
|
-
if (!response.ok)
|
|
61
|
-
return null;
|
|
62
|
-
return response.arrayBuffer();
|
|
63
|
-
}
|
|
64
|
-
/** Returns the schema advertised by decoded vector tiles. */
|
|
65
|
-
async getSchema() {
|
|
66
|
-
return { fields: [], metadata: {} };
|
|
67
|
-
}
|
|
68
|
-
/** Fetches and decodes one ArcGIS vector tile to geographic coordinates. */
|
|
69
|
-
async getVectorTile(parameters) {
|
|
70
|
-
const arrayBuffer = await this.getTile(parameters, parameters.signal);
|
|
71
|
-
if (!arrayBuffer) {
|
|
72
|
-
return null;
|
|
73
|
-
}
|
|
74
|
-
const inheritedOptions = this.loadOptions.mvt;
|
|
75
|
-
const sourceOptions = this.options['arcgis-vector-tile-server']?.mvt;
|
|
76
|
-
return (await this.coreApi.parse(arrayBuffer, MVTLoader, {
|
|
77
|
-
...this.loadOptions,
|
|
78
|
-
mvt: {
|
|
79
|
-
...inheritedOptions,
|
|
80
|
-
...sourceOptions,
|
|
81
|
-
coordinates: 'wgs84',
|
|
82
|
-
tileIndex: { x: parameters.x, y: parameters.y, z: parameters.z },
|
|
83
|
-
layers: normalizeLayers(parameters.layers) || sourceOptions?.layers || inheritedOptions?.layers
|
|
84
|
-
}
|
|
85
|
-
}));
|
|
86
|
-
}
|
|
87
|
-
/** Provides decoded vector tiles through the deck.gl source interface. */
|
|
88
|
-
async getTileData(parameters) {
|
|
89
|
-
return this.getVectorTile({ ...parameters.index, signal: parameters.signal });
|
|
90
|
-
}
|
|
91
|
-
/** Builds the ArcGIS cached vector tile URL. */
|
|
92
|
-
getTileURL(parameters) {
|
|
93
|
-
return this.getResourceURL(`/tile/${parameters.z}/${parameters.y}/${parameters.x}.pbf`);
|
|
94
|
-
}
|
|
95
|
-
/** Returns the service metadata URL. */
|
|
96
|
-
getMetadataURL() {
|
|
97
|
-
const url = new URL(this.getResourceURL(''));
|
|
98
|
-
url.searchParams.set('f', 'pjson');
|
|
99
|
-
return url.toString();
|
|
100
|
-
}
|
|
101
|
-
/** Returns the ArcGIS Mapbox style resource URL. */
|
|
102
|
-
getStyleURL() {
|
|
103
|
-
return this.getResourceURL('/resources/styles/root.json');
|
|
104
|
-
}
|
|
105
|
-
/** Returns the ArcGIS sprite resource base URL. */
|
|
106
|
-
getSpriteURL() {
|
|
107
|
-
return this.getResourceURL('/resources/sprites/sprite');
|
|
108
|
-
}
|
|
109
|
-
/** Loads and caches the ArcGIS VectorTileServer metadata document. */
|
|
110
|
-
async getServiceMetadata() {
|
|
111
|
-
this.serviceMetadata ||= this.fetch(this.getMetadataURL()).then(async (response) => {
|
|
112
|
-
if (!response.ok)
|
|
113
|
-
throw new Error(`ArcGIS VectorTileServer request failed: ${response.status}`);
|
|
114
|
-
return (await response.json());
|
|
115
|
-
});
|
|
116
|
-
return this.serviceMetadata;
|
|
117
|
-
}
|
|
118
|
-
/** Builds a resource URL while retaining service query parameters. */
|
|
119
|
-
getResourceURL(resourcePath) {
|
|
120
|
-
const url = new URL(this.url);
|
|
121
|
-
url.pathname = `${url.pathname.replace(/\/$/, '')}${resourcePath}`;
|
|
122
|
-
for (const [key, value] of this.serviceQueryParameters) {
|
|
123
|
-
url.searchParams.set(key, value);
|
|
124
|
-
}
|
|
125
|
-
return url.toString();
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
/** Source loader for ArcGIS VectorTileServer services. */
|
|
129
|
-
export const ArcGISVectorTileServerSourceLoader = {
|
|
130
|
-
dataType: null,
|
|
131
|
-
batchType: null,
|
|
132
|
-
name: 'ArcGIS VectorTileServer',
|
|
133
|
-
id: 'arcgis-vector-tile-server',
|
|
134
|
-
module: 'services',
|
|
135
|
-
version: '0.0.0',
|
|
136
|
-
extensions: [],
|
|
137
|
-
mimeTypes: ['application/vnd.mapbox-vector-tile', 'application/x-protobuf'],
|
|
138
|
-
type: 'arcgis-vector-tile-server',
|
|
139
|
-
fromUrl: true,
|
|
140
|
-
fromBlob: false,
|
|
141
|
-
options: { 'arcgis-vector-tile-server': {} },
|
|
142
|
-
defaultOptions: { 'arcgis-vector-tile-server': {} },
|
|
143
|
-
testURL: (url) => /\/vectortileserver(?:[\/?#]|$)/i.test(url),
|
|
144
|
-
createDataSource: (url, options = {}, coreApi) => new ArcGISVectorTileServerSource(url, options, coreApi)
|
|
145
|
-
};
|
|
146
|
-
/** Converts an ArcGIS spatial reference to an EPSG identifier. */
|
|
147
|
-
function getSpatialReference(spatialReference) {
|
|
148
|
-
return `EPSG:${spatialReference.latestWkid || spatialReference.wkid}`;
|
|
149
|
-
}
|
|
150
|
-
/** Normalizes generic tile layer selection for the MVT parser. */
|
|
151
|
-
function normalizeLayers(layers) {
|
|
152
|
-
if (!layers)
|
|
153
|
-
return undefined;
|
|
154
|
-
return Array.isArray(layers) ? layers : [layers];
|
|
155
|
-
}
|
|
156
|
-
//# sourceMappingURL=arcgis-vector-tile-server-source-loader.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"arcgis-vector-tile-server-source-loader.js","sourceRoot":"","sources":["../../src/arcgis/arcgis-vector-tile-server-source-loader.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,+BAA+B;AAC/B,oCAAoC;AAYpC,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAC,SAAS,EAAwB,MAAM,iBAAiB,CAAC;AAsCjE,mEAAmE;AACnE,MAAM,OAAO,4BACX,SAAQ,UAA6D;IAGrE,8DAA8D;IACrD,QAAQ,GAAG,oCAAoC,CAAC;IACzD,sEAAsE;IAC7D,gBAAgB,GAAG,KAAK,CAAC;IAClC,uCAAuC;IAC/B,eAAe,GAAoD,IAAI,CAAC;IAChF,+EAA+E;IAC9D,sBAAsB,CAAkB;IAEzD,iDAAiD;IACjD,YACE,GAAW,EACX,UAAqD,EAAE,EACvD,OAAiB;QAEjB,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QAChC,UAAU,CAAC,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAC7D,KAAK,CACH,GAAG,UAAU,CAAC,MAAM,GAAG,UAAU,CAAC,QAAQ,EAAE,EAC5C,OAAO,EACP,kCAAkC,CAAC,cAAc,EACjD,OAAO,CACR,CAAC;QACF,IAAI,CAAC,sBAAsB,GAAG,IAAI,eAAe,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IACvE,CAAC;IAED,yDAAyD;IACzD,KAAK,CAAC,WAAW;QACf,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,kBAAkB,EAAE,CAAC;QACjD,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC;QACnC,MAAM,IAAI,GAAG,QAAQ,EAAE,IAAI,IAAI,EAAE,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D,IAAI,CAAC,MAAM;QAAE,OAAO,SAAS,CAAC;IAC9B,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AACnD,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ArcGISFeatureServerSourceLoader } from "./arcgis/arcgis-feature-server-source-loader.js";
|
|
2
|
-
import { ArcGISImageServerSourceLoader } from "./arcgis/arcgis-image-server-source-loader.js";
|
|
3
|
-
import { ArcGISImageTileSourceLoader } from "./arcgis/arcgis-image-tile-source-loader.js";
|
|
4
|
-
import { ArcGISMapTileSourceLoader } from "./arcgis/arcgis-map-tile-source-loader.js";
|
|
5
|
-
import { ArcGISSceneServerSourceLoader } from "./arcgis/arcgis-scene-server-source-loader.js";
|
|
6
|
-
import { ArcGISVectorTileServerSourceLoader } from "./arcgis/arcgis-vector-tile-server-source-loader.js";
|
|
7
|
-
/** A source loader currently exposed through the services package. */
|
|
8
|
-
export type ServiceLoader = typeof ArcGISFeatureServerSourceLoader | typeof ArcGISImageServerSourceLoader | typeof ArcGISImageTileSourceLoader | typeof ArcGISMapTileSourceLoader | typeof ArcGISVectorTileServerSourceLoader | typeof ArcGISSceneServerSourceLoader;
|
|
9
|
-
/** All source loaders owned by `@loaders.gl/services`, in URL-selection order. */
|
|
10
|
-
export declare const SERVICE_LOADERS: ServiceLoader[];
|
|
11
|
-
/**
|
|
12
|
-
* Finds a service loader by its canonical loader id or service type.
|
|
13
|
-
*
|
|
14
|
-
* The lookup is intentionally small and explicit. It provides discovery without
|
|
15
|
-
* introducing a second request lifecycle or hiding provider-specific options.
|
|
16
|
-
*/
|
|
17
|
-
export declare function getServiceLoader(serviceType: string): ServiceLoader | undefined;
|
|
18
|
-
//# sourceMappingURL=service-registry.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"service-registry.d.ts","sourceRoot":"","sources":["../src/service-registry.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,+BAA+B,EAAC,wDAAqD;AAC7F,OAAO,EAAC,6BAA6B,EAAC,sDAAmD;AACzF,OAAO,EAAC,2BAA2B,EAAC,oDAAiD;AACrF,OAAO,EAAC,yBAAyB,EAAC,kDAA+C;AACjF,OAAO,EAAC,6BAA6B,EAAC,sDAAmD;AACzF,OAAO,EAAC,kCAAkC,EAAC,4DAAyD;AAEpG,sEAAsE;AACtE,MAAM,MAAM,aAAa,GACrB,OAAO,+BAA+B,GACtC,OAAO,6BAA6B,GACpC,OAAO,2BAA2B,GAClC,OAAO,yBAAyB,GAChC,OAAO,kCAAkC,GACzC,OAAO,6BAA6B,CAAC;AAEzC,kFAAkF;AAClF,eAAO,MAAM,eAAe,EAAE,aAAa,EAO1C,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAM/E"}
|
package/dist/service-registry.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
// loaders.gl
|
|
2
|
-
// SPDX-License-Identifier: MIT
|
|
3
|
-
// Copyright (c) vis.gl contributors
|
|
4
|
-
import { ArcGISFeatureServerSourceLoader } from "./arcgis/arcgis-feature-server-source-loader.js";
|
|
5
|
-
import { ArcGISImageServerSourceLoader } from "./arcgis/arcgis-image-server-source-loader.js";
|
|
6
|
-
import { ArcGISImageTileSourceLoader } from "./arcgis/arcgis-image-tile-source-loader.js";
|
|
7
|
-
import { ArcGISMapTileSourceLoader } from "./arcgis/arcgis-map-tile-source-loader.js";
|
|
8
|
-
import { ArcGISSceneServerSourceLoader } from "./arcgis/arcgis-scene-server-source-loader.js";
|
|
9
|
-
import { ArcGISVectorTileServerSourceLoader } from "./arcgis/arcgis-vector-tile-server-source-loader.js";
|
|
10
|
-
/** All source loaders owned by `@loaders.gl/services`, in URL-selection order. */
|
|
11
|
-
export const SERVICE_LOADERS = [
|
|
12
|
-
ArcGISFeatureServerSourceLoader,
|
|
13
|
-
ArcGISImageServerSourceLoader,
|
|
14
|
-
ArcGISImageTileSourceLoader,
|
|
15
|
-
ArcGISMapTileSourceLoader,
|
|
16
|
-
ArcGISVectorTileServerSourceLoader,
|
|
17
|
-
ArcGISSceneServerSourceLoader
|
|
18
|
-
];
|
|
19
|
-
/**
|
|
20
|
-
* Finds a service loader by its canonical loader id or service type.
|
|
21
|
-
*
|
|
22
|
-
* The lookup is intentionally small and explicit. It provides discovery without
|
|
23
|
-
* introducing a second request lifecycle or hiding provider-specific options.
|
|
24
|
-
*/
|
|
25
|
-
export function getServiceLoader(serviceType) {
|
|
26
|
-
const normalizedServiceType = serviceType.toLowerCase();
|
|
27
|
-
return SERVICE_LOADERS.find(serviceLoader => serviceLoader.id === normalizedServiceType || serviceLoader.type === normalizedServiceType);
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=service-registry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"service-registry.js","sourceRoot":"","sources":["../src/service-registry.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,EAAC,+BAA+B,EAAC,wDAAqD;AAC7F,OAAO,EAAC,6BAA6B,EAAC,sDAAmD;AACzF,OAAO,EAAC,2BAA2B,EAAC,oDAAiD;AACrF,OAAO,EAAC,yBAAyB,EAAC,kDAA+C;AACjF,OAAO,EAAC,6BAA6B,EAAC,sDAAmD;AACzF,OAAO,EAAC,kCAAkC,EAAC,4DAAyD;AAWpG,kFAAkF;AAClF,MAAM,CAAC,MAAM,eAAe,GAAoB;IAC9C,+BAA+B;IAC/B,6BAA6B;IAC7B,2BAA2B;IAC3B,yBAAyB;IACzB,kCAAkC;IAClC,6BAA6B;CAC9B,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,WAAmB;IAClD,MAAM,qBAAqB,GAAG,WAAW,CAAC,WAAW,EAAE,CAAC;IACxD,OAAO,eAAe,CAAC,IAAI,CACzB,aAAa,CAAC,EAAE,CACd,aAAa,CAAC,EAAE,KAAK,qBAAqB,IAAI,aAAa,CAAC,IAAI,KAAK,qBAAqB,CAC7F,CAAC;AACJ,CAAC"}
|
|
@@ -1,295 +0,0 @@
|
|
|
1
|
-
// loaders.gl
|
|
2
|
-
// SPDX-License-Identifier: MIT
|
|
3
|
-
// Copyright (c) vis.gl contributors
|
|
4
|
-
|
|
5
|
-
import {getArcGISServices} from './arcgis-server';
|
|
6
|
-
import type {ServiceCapabilities} from '@loaders.gl/loader-utils';
|
|
7
|
-
import type {Service as ArcGISService} from './arcgis-server';
|
|
8
|
-
|
|
9
|
-
/** Normalized capabilities discovered from one ArcGIS REST service. */
|
|
10
|
-
export type ArcGISServiceCapabilities = ArcGISService & {
|
|
11
|
-
/** Stable identifier for the discovered service. */
|
|
12
|
-
id: string;
|
|
13
|
-
/** Broad service family used for selection. */
|
|
14
|
-
kind: 'vector' | 'image' | 'tile' | 'scene' | 'unknown';
|
|
15
|
-
/** Shared normalized service capability contract. */
|
|
16
|
-
capabilities: ServiceCapabilities;
|
|
17
|
-
/** Raw service metadata for provider-specific consumers. */
|
|
18
|
-
metadata: Record<string, unknown>;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
/** A normalized graph of services discovered below an ArcGIS REST directory. */
|
|
22
|
-
export type ArcGISCapabilityGraph = {
|
|
23
|
-
/** URL used as the discovery root. */
|
|
24
|
-
rootUrl: string;
|
|
25
|
-
/** Services discovered below the root, including normalized capabilities. */
|
|
26
|
-
nodes: ArcGISServiceCapabilities[];
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
/** Requirements used to select the best matching service node. */
|
|
30
|
-
export type ArcGISServiceSelection = {
|
|
31
|
-
/** Preferred service family. */
|
|
32
|
-
kind?: ArcGISServiceCapabilities['kind'];
|
|
33
|
-
/** Required response or source format. */
|
|
34
|
-
format?: string;
|
|
35
|
-
/** Preferred coordinate system. */
|
|
36
|
-
crs?: string;
|
|
37
|
-
/** Required I3S layer profile for SceneServer nodes. */
|
|
38
|
-
profile?: string;
|
|
39
|
-
/** Required layer identifier for SceneServer nodes. */
|
|
40
|
-
layerId?: string | number;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
/** Options controlling ArcGIS capability discovery. */
|
|
44
|
-
export type ArcGISCapabilityGraphOptions = {
|
|
45
|
-
/** Optional fetch implementation for hermetic tests and custom transports. */
|
|
46
|
-
fetch?: typeof fetch;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Discovers an ArcGIS REST directory and normalizes the capabilities of each service.
|
|
51
|
-
*
|
|
52
|
-
* Capability requests are explicit and independent from source loading. Applications that
|
|
53
|
-
* already know the endpoint can continue using the source classes directly.
|
|
54
|
-
*/
|
|
55
|
-
export async function discoverArcGISCapabilities(
|
|
56
|
-
url: string,
|
|
57
|
-
options: ArcGISCapabilityGraphOptions = {}
|
|
58
|
-
): Promise<ArcGISCapabilityGraph | null> {
|
|
59
|
-
const fetchFile = options.fetch || fetch;
|
|
60
|
-
const services = await getArcGISServices(url, fetchFile);
|
|
61
|
-
if (!services) return null;
|
|
62
|
-
|
|
63
|
-
const nodes = await Promise.all(
|
|
64
|
-
services.map(async service => {
|
|
65
|
-
let metadata = await fetchServiceMetadata(service.url, fetchFile);
|
|
66
|
-
if (service.type.toLowerCase().includes('scene')) {
|
|
67
|
-
metadata = await enrichSceneServerMetadata(service.url, metadata, fetchFile);
|
|
68
|
-
}
|
|
69
|
-
return normalizeServiceCapabilities(service, metadata);
|
|
70
|
-
})
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
return {rootUrl: url, nodes};
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/** Selects the first service satisfying all supplied requirements. */
|
|
77
|
-
export function selectArcGISService(
|
|
78
|
-
graph: ArcGISCapabilityGraph,
|
|
79
|
-
requirements: ArcGISServiceSelection = {}
|
|
80
|
-
): ArcGISServiceCapabilities | undefined {
|
|
81
|
-
return graph.nodes.find(node => {
|
|
82
|
-
if (requirements.kind && node.kind !== requirements.kind) return false;
|
|
83
|
-
if (
|
|
84
|
-
requirements.format &&
|
|
85
|
-
!node.capabilities.formats.includes(requirements.format.toLowerCase())
|
|
86
|
-
)
|
|
87
|
-
return false;
|
|
88
|
-
if (requirements.crs && !node.capabilities.crs.includes(requirements.crs)) return false;
|
|
89
|
-
if (
|
|
90
|
-
requirements.profile &&
|
|
91
|
-
node.metadata.profile !== requirements.profile &&
|
|
92
|
-
!node.capabilities.layers.some(layer => layer.profile === requirements.profile)
|
|
93
|
-
)
|
|
94
|
-
return false;
|
|
95
|
-
if (
|
|
96
|
-
requirements.layerId !== undefined &&
|
|
97
|
-
!node.capabilities.layers.some(
|
|
98
|
-
layer =>
|
|
99
|
-
layer.id === String(requirements.layerId) || layer.name === String(requirements.layerId)
|
|
100
|
-
)
|
|
101
|
-
)
|
|
102
|
-
return false;
|
|
103
|
-
return true;
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/** Fetches one service's provider-specific metadata document. */
|
|
108
|
-
async function fetchServiceMetadata(
|
|
109
|
-
serviceUrl: string,
|
|
110
|
-
fetchFile: typeof fetch
|
|
111
|
-
): Promise<Record<string, unknown>> {
|
|
112
|
-
const url = new URL(serviceUrl);
|
|
113
|
-
url.searchParams.set('f', 'pjson');
|
|
114
|
-
const response = await fetchFile(url.toString());
|
|
115
|
-
if (!response.ok) {
|
|
116
|
-
throw new Error(`ArcGIS service metadata request failed: ${response.status}`);
|
|
117
|
-
}
|
|
118
|
-
return (await response.json()) as Record<string, unknown>;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/** Fetches layer documents so SceneServer profile selection uses authoritative store metadata. */
|
|
122
|
-
async function enrichSceneServerMetadata(
|
|
123
|
-
serviceUrl: string,
|
|
124
|
-
metadata: Record<string, unknown>,
|
|
125
|
-
fetchFile: typeof fetch
|
|
126
|
-
): Promise<Record<string, unknown>> {
|
|
127
|
-
const layers = Array.isArray(metadata.layers) ? metadata.layers : [];
|
|
128
|
-
if (!layers.length) return metadata;
|
|
129
|
-
const enrichedLayers = await Promise.all(
|
|
130
|
-
layers.map(async value => {
|
|
131
|
-
if (!value || typeof value !== 'object') return value;
|
|
132
|
-
const layer = value as Record<string, unknown>;
|
|
133
|
-
if (layer.id === undefined) return value;
|
|
134
|
-
const layerURL = `${serviceUrl.replace(/\/$/, '')}/layers/${encodeURIComponent(String(layer.id))}`;
|
|
135
|
-
try {
|
|
136
|
-
const layerMetadata = await fetchServiceMetadata(layerURL, fetchFile);
|
|
137
|
-
return {...layer, ...layerMetadata, id: layer.id, name: layer.name ?? layerMetadata.name};
|
|
138
|
-
} catch {
|
|
139
|
-
// Keep directory metadata when an individual layer is unavailable.
|
|
140
|
-
return value;
|
|
141
|
-
}
|
|
142
|
-
})
|
|
143
|
-
);
|
|
144
|
-
return {...metadata, layers: enrichedLayers};
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
/** Combines directory information and metadata into a normalized capability node. */
|
|
148
|
-
function normalizeServiceCapabilities(
|
|
149
|
-
service: ArcGISService,
|
|
150
|
-
metadata: Record<string, unknown>
|
|
151
|
-
): ArcGISServiceCapabilities {
|
|
152
|
-
const serviceType = service.type;
|
|
153
|
-
const kind = getServiceKind(serviceType);
|
|
154
|
-
const formats = getServiceFormats(metadata);
|
|
155
|
-
const crs = getServiceCrs(metadata);
|
|
156
|
-
const layers = getServiceLayers(metadata).map(layer => ({
|
|
157
|
-
...layer,
|
|
158
|
-
url:
|
|
159
|
-
layer.url ||
|
|
160
|
-
(serviceType.includes('scene') && layer.id
|
|
161
|
-
? `${service.url.replace(/\/$/, '')}/layers/${encodeURIComponent(layer.id)}`
|
|
162
|
-
: undefined)
|
|
163
|
-
}));
|
|
164
|
-
const capabilities: ServiceCapabilities = {
|
|
165
|
-
url: service.url,
|
|
166
|
-
type: getServiceCapabilityType(serviceType),
|
|
167
|
-
name: service.name,
|
|
168
|
-
title: typeof metadata.name === 'string' ? metadata.name : undefined,
|
|
169
|
-
abstract: typeof metadata.description === 'string' ? metadata.description : undefined,
|
|
170
|
-
crs,
|
|
171
|
-
formats,
|
|
172
|
-
layers,
|
|
173
|
-
operations: getServiceOperations(metadata),
|
|
174
|
-
formatSpecificMetadata: metadata
|
|
175
|
-
};
|
|
176
|
-
return {
|
|
177
|
-
...service,
|
|
178
|
-
id: service.url,
|
|
179
|
-
kind,
|
|
180
|
-
capabilities,
|
|
181
|
-
metadata
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
/** Extracts normalized layer entries from SceneServer and other service metadata. */
|
|
186
|
-
function getServiceLayers(metadata: Record<string, unknown>): ServiceCapabilities['layers'] {
|
|
187
|
-
const layerValues = Array.isArray(metadata.layers) ? metadata.layers : [];
|
|
188
|
-
return layerValues.flatMap(value => {
|
|
189
|
-
if (!value || typeof value !== 'object') return [];
|
|
190
|
-
const layer = value as Record<string, unknown>;
|
|
191
|
-
const spatialReference = layer.spatialReference as
|
|
192
|
-
| {wkid?: number; latestWkid?: number}
|
|
193
|
-
| undefined;
|
|
194
|
-
const wkid = spatialReference?.latestWkid || spatialReference?.wkid;
|
|
195
|
-
const extent = layer.extent as
|
|
196
|
-
| {xmin?: number; ymin?: number; xmax?: number; ymax?: number}
|
|
197
|
-
| undefined;
|
|
198
|
-
const bounds =
|
|
199
|
-
extent && [extent.xmin, extent.ymin, extent.xmax, extent.ymax].every(Number.isFinite)
|
|
200
|
-
? [extent.xmin!, extent.ymin!, extent.xmax!, extent.ymax!]
|
|
201
|
-
: undefined;
|
|
202
|
-
return [
|
|
203
|
-
{
|
|
204
|
-
name: layer.id === undefined ? String(layer.name || '') : String(layer.id),
|
|
205
|
-
id: layer.id === undefined ? undefined : String(layer.id),
|
|
206
|
-
url: typeof layer.url === 'string' ? layer.url : undefined,
|
|
207
|
-
title: typeof layer.name === 'string' ? layer.name : undefined,
|
|
208
|
-
crs: wkid ? [`EPSG:${wkid}`] : undefined,
|
|
209
|
-
bounds,
|
|
210
|
-
profile:
|
|
211
|
-
typeof layer.profile === 'string'
|
|
212
|
-
? layer.profile
|
|
213
|
-
: layer.store &&
|
|
214
|
-
typeof layer.store === 'object' &&
|
|
215
|
-
typeof (layer.store as Record<string, unknown>).profile === 'string'
|
|
216
|
-
? ((layer.store as Record<string, unknown>).profile as string)
|
|
217
|
-
: undefined,
|
|
218
|
-
layerType: typeof layer.layerType === 'string' ? layer.layerType : undefined,
|
|
219
|
-
version:
|
|
220
|
-
typeof layer.version === 'string'
|
|
221
|
-
? layer.version
|
|
222
|
-
: layer.store &&
|
|
223
|
-
typeof layer.store === 'object' &&
|
|
224
|
-
typeof (layer.store as Record<string, unknown>).version === 'string'
|
|
225
|
-
? ((layer.store as Record<string, unknown>).version as string)
|
|
226
|
-
: undefined
|
|
227
|
-
}
|
|
228
|
-
];
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
/** Extracts operation names when a service advertises them. */
|
|
233
|
-
function getServiceOperations(metadata: Record<string, unknown>): string[] {
|
|
234
|
-
const capabilities = metadata.capabilities;
|
|
235
|
-
return typeof capabilities === 'string'
|
|
236
|
-
? capabilities
|
|
237
|
-
.split(',')
|
|
238
|
-
.map(value => value.trim())
|
|
239
|
-
.filter(Boolean)
|
|
240
|
-
: [];
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
/** Maps a discovered ArcGIS family to the shared service capability type. */
|
|
244
|
-
function getServiceCapabilityType(serviceType: string): ServiceCapabilities['type'] {
|
|
245
|
-
if (serviceType.includes('vectortile') || serviceType.includes('vector-tile')) {
|
|
246
|
-
return 'arcgis-vector-tile-server';
|
|
247
|
-
}
|
|
248
|
-
if (serviceType.includes('feature')) return 'arcgis-feature-server';
|
|
249
|
-
if (serviceType.includes('image')) return 'arcgis-image-server';
|
|
250
|
-
if (serviceType.includes('scene')) return 'arcgis-scene-server';
|
|
251
|
-
if (serviceType.includes('map')) return 'arcgis-map-server';
|
|
252
|
-
return 'unknown';
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
/** Maps an ArcGIS service type to the generic source family. */
|
|
256
|
-
function getServiceKind(serviceType: string): ArcGISServiceCapabilities['kind'] {
|
|
257
|
-
if (serviceType.includes('feature')) return 'vector';
|
|
258
|
-
if (serviceType.includes('image')) return 'image';
|
|
259
|
-
if (serviceType.includes('scene')) return 'scene';
|
|
260
|
-
if (
|
|
261
|
-
serviceType.includes('map') ||
|
|
262
|
-
serviceType.includes('vectortile') ||
|
|
263
|
-
serviceType.includes('vector-tile')
|
|
264
|
-
)
|
|
265
|
-
return 'tile';
|
|
266
|
-
return 'unknown';
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
/** Extracts and canonicalizes formats advertised by an ArcGIS service. */
|
|
270
|
-
function getServiceFormats(metadata: Record<string, unknown>): string[] {
|
|
271
|
-
const formats = new Set<string>();
|
|
272
|
-
const supportedFormats = metadata.supportedQueryFormats;
|
|
273
|
-
if (typeof supportedFormats === 'string') {
|
|
274
|
-
for (const format of supportedFormats.split(',')) formats.add(format.trim().toLowerCase());
|
|
275
|
-
}
|
|
276
|
-
const imageFormats = metadata.supportedImageFormatTypes;
|
|
277
|
-
if (typeof imageFormats === 'string') {
|
|
278
|
-
for (const format of imageFormats.split(',')) formats.add(format.trim().toLowerCase());
|
|
279
|
-
}
|
|
280
|
-
const tileInfo = metadata.tileInfo as {format?: string} | undefined;
|
|
281
|
-
if (typeof tileInfo?.format === 'string') formats.add(tileInfo.format.toLowerCase());
|
|
282
|
-
return [...formats].sort();
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
/** Extracts unique EPSG identifiers from common ArcGIS metadata locations. */
|
|
286
|
-
function getServiceCrs(metadata: Record<string, unknown>): string[] {
|
|
287
|
-
const spatialReferences = new Set<string>();
|
|
288
|
-
for (const value of [metadata.spatialReference, (metadata.fullExtent as any)?.spatialReference]) {
|
|
289
|
-
const spatialReference = value as {wkid?: number; latestWkid?: number} | undefined;
|
|
290
|
-
for (const wkid of [spatialReference?.wkid, spatialReference?.latestWkid]) {
|
|
291
|
-
if (wkid) spatialReferences.add(`EPSG:${wkid}`);
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
return [...spatialReferences].sort();
|
|
295
|
-
}
|