@loaders.gl/arcgis 5.0.0-alpha.11 → 5.0.0-alpha.13
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/LICENSE +1 -1
- package/README.md +37 -16
- package/dist/arcgis/arcgis-capability-graph.d.ts +1 -1
- package/dist/arcgis/arcgis-capability-graph.d.ts.map +1 -1
- package/dist/arcgis/arcgis-feature-server-source-loader-types.d.ts +1 -1
- package/dist/arcgis/arcgis-feature-server-source-loader-types.d.ts.map +1 -1
- package/dist/arcgis/arcgis-feature-server-source-loader.d.ts +3 -3
- package/dist/arcgis/arcgis-feature-server-source-loader.d.ts.map +1 -1
- package/dist/arcgis/arcgis-feature-server-source-loader.js +3 -2
- package/dist/arcgis/arcgis-feature-server-source-loader.js.map +1 -1
- package/dist/arcgis/arcgis-image-server-source-loader-types.d.ts +1 -1
- package/dist/arcgis/arcgis-image-server-source-loader-types.d.ts.map +1 -1
- package/dist/arcgis/arcgis-image-server-source-loader.d.ts +3 -3
- package/dist/arcgis/arcgis-image-server-source-loader.d.ts.map +1 -1
- package/dist/arcgis/arcgis-image-server-source-loader.js +2 -2
- package/dist/arcgis/arcgis-image-server-source-loader.js.map +1 -1
- package/dist/arcgis/arcgis-image-tile-source-loader-types.d.ts +1 -1
- package/dist/arcgis/arcgis-image-tile-source-loader-types.d.ts.map +1 -1
- package/dist/arcgis/arcgis-image-tile-source-loader.d.ts +3 -3
- package/dist/arcgis/arcgis-image-tile-source-loader.d.ts.map +1 -1
- package/dist/arcgis/arcgis-image-tile-source-loader.js +7 -3
- package/dist/arcgis/arcgis-image-tile-source-loader.js.map +1 -1
- package/dist/arcgis/arcgis-map-tile-source-loader-types.d.ts +1 -1
- package/dist/arcgis/arcgis-map-tile-source-loader-types.d.ts.map +1 -1
- package/dist/arcgis/arcgis-map-tile-source-loader.d.ts +2 -2
- package/dist/arcgis/arcgis-map-tile-source-loader.d.ts.map +1 -1
- package/dist/arcgis/arcgis-map-tile-source-loader.js +15 -19
- package/dist/arcgis/arcgis-map-tile-source-loader.js.map +1 -1
- package/dist/arcgis/arcgis-scene-server-source-loader-types.d.ts +1 -1
- package/dist/arcgis/arcgis-scene-server-source-loader-types.d.ts.map +1 -1
- package/dist/arcgis/arcgis-scene-server-source-loader.d.ts +3 -3
- package/dist/arcgis/arcgis-scene-server-source-loader.d.ts.map +1 -1
- package/dist/arcgis/arcgis-scene-server-source-loader.js +2 -2
- package/dist/arcgis/arcgis-scene-server-source-loader.js.map +1 -1
- package/dist/arcgis/arcgis-tile-grid.d.ts +5 -0
- package/dist/arcgis/arcgis-tile-grid.d.ts.map +1 -0
- package/dist/arcgis/arcgis-tile-grid.js +43 -0
- package/dist/arcgis/arcgis-tile-grid.js.map +1 -0
- package/dist/arcgis/arcgis-vector-tile-server-source-loader-types.d.ts +1 -1
- package/dist/arcgis/arcgis-vector-tile-server-source-loader-types.d.ts.map +1 -1
- package/dist/arcgis/arcgis-vector-tile-server-source-loader.d.ts +5 -3
- package/dist/arcgis/arcgis-vector-tile-server-source-loader.d.ts.map +1 -1
- package/dist/arcgis/arcgis-vector-tile-server-source-loader.js +20 -6
- package/dist/arcgis/arcgis-vector-tile-server-source-loader.js.map +1 -1
- package/dist/arcgis-feature-query-types.d.ts +2 -2
- package/dist/arcgis-feature-query-types.d.ts.map +1 -1
- package/dist/arcgis-items.d.ts +1 -1
- package/dist/arcgis-items.d.ts.map +1 -1
- package/dist/arcgis-source-types.d.ts +8 -2
- package/dist/arcgis-source-types.d.ts.map +1 -1
- package/dist/arcgis-source-types.js.map +1 -1
- package/dist/authentication.d.ts +2 -2
- package/dist/authentication.d.ts.map +1 -1
- package/dist/authentication.js +1 -1
- package/dist/authentication.js.map +1 -1
- package/dist/bundled.d.ts +7 -7
- package/dist/bundled.d.ts.map +1 -1
- package/dist/bundled.js.map +1 -1
- package/dist/index.cjs +14294 -18024
- package/dist/index.cjs.map +3 -3
- package/package.json +8 -9
- package/src/arcgis/arcgis-capability-graph.ts +1 -1
- package/src/arcgis/arcgis-feature-query.ts +1 -1
- package/src/arcgis/arcgis-feature-server-source-loader-types.ts +1 -1
- package/src/arcgis/arcgis-feature-server-source-loader.ts +6 -8
- package/src/arcgis/arcgis-image-server-source-loader-types.ts +1 -1
- package/src/arcgis/arcgis-image-server-source-loader.ts +4 -4
- package/src/arcgis/arcgis-image-tile-source-loader-types.ts +1 -1
- package/src/arcgis/arcgis-image-tile-source-loader.ts +12 -5
- package/src/arcgis/arcgis-map-tile-source-loader-types.ts +1 -1
- package/src/arcgis/arcgis-map-tile-source-loader.ts +24 -21
- package/src/arcgis/arcgis-scene-server-source-loader-types.ts +1 -1
- package/src/arcgis/arcgis-scene-server-source-loader.ts +4 -4
- package/src/arcgis/arcgis-tile-grid.ts +55 -0
- package/src/arcgis/arcgis-vector-tile-server-source-loader-types.ts +1 -1
- package/src/arcgis/arcgis-vector-tile-server-source-loader.ts +27 -8
- package/src/arcgis-feature-query-types.ts +2 -2
- package/src/arcgis-items.ts +1 -1
- package/src/arcgis-source-types.ts +11 -3
- package/src/authentication.ts +2 -2
- package/src/bundled.ts +33 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/arcgis",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.13",
|
|
4
4
|
"description": "ArcGIS REST data sources for geospatial visualization",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -81,16 +81,15 @@
|
|
|
81
81
|
"README.md"
|
|
82
82
|
],
|
|
83
83
|
"dependencies": {
|
|
84
|
-
"@loaders.gl/
|
|
85
|
-
"@loaders.gl/
|
|
86
|
-
"@loaders.gl/
|
|
87
|
-
"@loaders.gl/
|
|
88
|
-
"@loaders.gl/
|
|
89
|
-
"
|
|
90
|
-
"@loaders.gl/schema": "5.0.0-alpha.11"
|
|
84
|
+
"@loaders.gl/arrow-geometry": "5.0.0-alpha.13",
|
|
85
|
+
"@loaders.gl/images": "5.0.0-alpha.13",
|
|
86
|
+
"@loaders.gl/raster": "5.0.0-alpha.13",
|
|
87
|
+
"@loaders.gl/tiles": "5.0.0-alpha.13",
|
|
88
|
+
"@loaders.gl/tiles-3d": "5.0.0-alpha.13",
|
|
89
|
+
"lerc": "^4.2.0"
|
|
91
90
|
},
|
|
92
91
|
"peerDependencies": {
|
|
93
92
|
"@loaders.gl/core": "~5.0.0-alpha.0"
|
|
94
93
|
},
|
|
95
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "1464ee8e912521b658a51f96c88c3b2310ceb2cd"
|
|
96
95
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import {getArcGISServices} from './arcgis-server';
|
|
6
6
|
export {getArcGISServices} from './arcgis-server';
|
|
7
7
|
export type {Service as ArcGISService} from './arcgis-server';
|
|
8
|
-
import type {ServiceCapabilities} from '@loaders.gl/loader-utils';
|
|
8
|
+
import type {ServiceCapabilities} from '@loaders.gl/core/loader-utils';
|
|
9
9
|
import type {Service as ArcGISService} from './arcgis-server';
|
|
10
10
|
|
|
11
11
|
/** Normalized capabilities discovered from one ArcGIS REST service. */
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
import type {Feature, GeoJSONTable} from '@loaders.gl/schema';
|
|
5
|
+
import type {Feature, GeoJSONTable} from '@loaders.gl/core/schema';
|
|
6
6
|
import type {
|
|
7
7
|
ArcGISFeatureExtent,
|
|
8
8
|
ArcGISFeatureObjectIds,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
5
|
import {ARCGIS_FEATURE_SERVER_SOURCE_LOADER_METADATA} from '../arcgis-source-types';
|
|
6
|
-
import type {CoreAPI, SourceLoader} from '@loaders.gl/loader-utils';
|
|
6
|
+
import type {CoreAPI, SourceLoader} from '@loaders.gl/core/loader-utils';
|
|
7
7
|
import type {ArcGISVectorSource} from './arcgis-feature-server-source-loader';
|
|
8
8
|
import type {ArcGISFeatureServerSourceLoaderOptions} from '../arcgis-source-types';
|
|
9
9
|
|
|
@@ -9,20 +9,18 @@ import type {
|
|
|
9
9
|
ArcGISFeatureServerSourceLoaderOptions
|
|
10
10
|
} from '../arcgis-source-types';
|
|
11
11
|
|
|
12
|
-
import type {DataType, Schema} from '@loaders.gl/schema';
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
convertGeojsonToBinaryFeatureCollection
|
|
16
|
-
} from '@loaders.gl/gis';
|
|
12
|
+
import type {DataType, Schema} from '@loaders.gl/core/schema';
|
|
13
|
+
import {convertFeaturesToWKBArrowTable} from '@loaders.gl/arrow-geometry/feature-collection-to-arrow';
|
|
14
|
+
import {convertGeojsonToBinaryFeatureCollection} from '@loaders.gl/arrow-geometry/legacy-binary';
|
|
17
15
|
import type {
|
|
18
16
|
CoreAPI,
|
|
19
17
|
VectorSourceMetadata,
|
|
20
18
|
GetFeaturesParameters,
|
|
21
19
|
VectorSource,
|
|
22
20
|
VectorSourceData
|
|
23
|
-
} from '@loaders.gl/loader-utils';
|
|
24
|
-
import type {SourceLoader} from '@loaders.gl/loader-utils';
|
|
25
|
-
import {DataSource} from '@loaders.gl/loader-utils';
|
|
21
|
+
} from '@loaders.gl/core/loader-utils';
|
|
22
|
+
import type {SourceLoader} from '@loaders.gl/core/loader-utils';
|
|
23
|
+
import {DataSource} from '@loaders.gl/core/loader-utils';
|
|
26
24
|
import {buildArcGISResourceURL} from './arcgis-url-utils';
|
|
27
25
|
import {ArcGISFeatureQueryClient} from './arcgis-feature-query';
|
|
28
26
|
import type {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
5
|
import {ARCGIS_IMAGE_SERVER_SOURCE_LOADER_METADATA} from '../arcgis-source-types';
|
|
6
|
-
import type {CoreAPI, SourceLoader} from '@loaders.gl/loader-utils';
|
|
6
|
+
import type {CoreAPI, SourceLoader} from '@loaders.gl/core/loader-utils';
|
|
7
7
|
import type {ArcGISImageSource} from './arcgis-image-server-source-loader';
|
|
8
8
|
import type {ArcGISImageSourceLoaderProps} from '../arcgis-source-types';
|
|
9
9
|
|
|
@@ -17,10 +17,10 @@ import type {
|
|
|
17
17
|
ImageSource,
|
|
18
18
|
ImageSourceMetadata,
|
|
19
19
|
GetImageParameters
|
|
20
|
-
} from '@loaders.gl/loader-utils';
|
|
21
|
-
import {DataSource} from '@loaders.gl/loader-utils';
|
|
22
|
-
import type {LERCData} from '@loaders.gl/
|
|
23
|
-
import {LERCLoader} from '@loaders.gl/
|
|
20
|
+
} from '@loaders.gl/core/loader-utils';
|
|
21
|
+
import {DataSource} from '@loaders.gl/core/loader-utils';
|
|
22
|
+
import type {LERCData} from '@loaders.gl/raster';
|
|
23
|
+
import {LERCLoader} from '@loaders.gl/raster';
|
|
24
24
|
import {buildArcGISResourceURL} from './arcgis-url-utils';
|
|
25
25
|
|
|
26
26
|
/** Runtime service loader for synchronous construction. */
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
5
|
import {ARCGIS_IMAGE_TILE_SOURCE_LOADER_METADATA} from '../arcgis-source-types';
|
|
6
|
-
import type {CoreAPI, SourceLoader} from '@loaders.gl/loader-utils';
|
|
6
|
+
import type {CoreAPI, SourceLoader} from '@loaders.gl/core/loader-utils';
|
|
7
7
|
import type {ArcGISImageTileSource} from './arcgis-image-tile-source-loader';
|
|
8
8
|
import type {ArcGISImageTileSourceLoaderOptions} from '../arcgis-source-types';
|
|
9
9
|
|
|
@@ -15,10 +15,10 @@ import type {
|
|
|
15
15
|
SourceLoader,
|
|
16
16
|
TileSource,
|
|
17
17
|
TileSourceMetadata
|
|
18
|
-
} from '@loaders.gl/loader-utils';
|
|
19
|
-
import {DataSource} from '@loaders.gl/loader-utils';
|
|
20
|
-
import type {LERCData} from '@loaders.gl/
|
|
21
|
-
import {LERCLoader} from '@loaders.gl/
|
|
18
|
+
} from '@loaders.gl/core/loader-utils';
|
|
19
|
+
import {DataSource} from '@loaders.gl/core/loader-utils';
|
|
20
|
+
import type {LERCData} from '@loaders.gl/raster';
|
|
21
|
+
import {LERCLoader} from '@loaders.gl/raster';
|
|
22
22
|
|
|
23
23
|
/** A tile source that renders ArcGIS ImageServer exports as deck.gl tiles. */
|
|
24
24
|
export class ArcGISImageTileSource
|
|
@@ -76,6 +76,7 @@ export class ArcGISImageTileSource
|
|
|
76
76
|
parameters: GetTileParameters,
|
|
77
77
|
signal?: AbortSignal
|
|
78
78
|
): Promise<ImageType | LERCData | null> {
|
|
79
|
+
signal ||= parameters.signal;
|
|
79
80
|
const response = await this.fetch(this.getTileURL(parameters), signal ? {signal} : undefined);
|
|
80
81
|
if (!response.ok) {
|
|
81
82
|
throw new Error(
|
|
@@ -92,7 +93,10 @@ export class ArcGISImageTileSource
|
|
|
92
93
|
|
|
93
94
|
/** Fetches a tile using the deck.gl-compatible request shape. */
|
|
94
95
|
async getTileData(parameters: GetTileDataParameters): Promise<ImageType | LERCData | null> {
|
|
95
|
-
return this.getTile(
|
|
96
|
+
return this.getTile(
|
|
97
|
+
{...parameters.index, tileMatrix: parameters.tileMatrix, signal: parameters.signal},
|
|
98
|
+
parameters.signal
|
|
99
|
+
);
|
|
96
100
|
}
|
|
97
101
|
|
|
98
102
|
/** Updates parameters applied to subsequent ImageServer export requests. */
|
|
@@ -102,6 +106,9 @@ export class ArcGISImageTileSource
|
|
|
102
106
|
|
|
103
107
|
/** Builds an ImageServer exportImage URL for one web-mercator tile. */
|
|
104
108
|
getTileURL(parameters: GetTileParameters, tileSize?: number): string {
|
|
109
|
+
if (parameters.tileMatrix !== undefined && parameters.tileMatrix !== String(parameters.z)) {
|
|
110
|
+
throw new Error('ArcGIS ImageServer export requires a matching XYZ zoom');
|
|
111
|
+
}
|
|
105
112
|
const options = this.options['arcgis-image-server-tiles'] || {};
|
|
106
113
|
const resolvedTileSize = tileSize || options.tileSize || 256;
|
|
107
114
|
const [west, south, east, north] = getWebMercatorTileBounds(parameters);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
5
|
import {ARCGIS_MAP_TILE_SOURCE_LOADER_METADATA} from '../arcgis-source-types';
|
|
6
|
-
import type {CoreAPI, SourceLoader} from '@loaders.gl/loader-utils';
|
|
6
|
+
import type {CoreAPI, SourceLoader} from '@loaders.gl/core/loader-utils';
|
|
7
7
|
import type {ArcGISMapTileSource} from './arcgis-map-tile-source-loader';
|
|
8
8
|
import type {ArcGISMapTileSourceLoaderOptions} from '../arcgis-source-types';
|
|
9
9
|
|
|
@@ -19,8 +19,9 @@ import type {
|
|
|
19
19
|
SourceLoader,
|
|
20
20
|
TileSource,
|
|
21
21
|
TileSourceMetadata
|
|
22
|
-
} from '@loaders.gl/loader-utils';
|
|
23
|
-
import {DataSource} from '@loaders.gl/loader-utils';
|
|
22
|
+
} from '@loaders.gl/core/loader-utils';
|
|
23
|
+
import {DataSource, getTileGridMatrixId} from '@loaders.gl/core/loader-utils';
|
|
24
|
+
import {createArcGISTileGrid} from './arcgis-tile-grid';
|
|
24
25
|
|
|
25
26
|
/** ArcGIS MapServer source for cached `/tile/{z}/{y}/{x}` image tiles. */
|
|
26
27
|
export class ArcGISMapTileSource
|
|
@@ -59,7 +60,9 @@ export class ArcGISMapTileSource
|
|
|
59
60
|
title: metadata.name || '',
|
|
60
61
|
abstract: metadata.description || metadata.serviceDescription || '',
|
|
61
62
|
attributions: metadata.copyrightText ? [metadata.copyrightText] : undefined,
|
|
62
|
-
minZoom:
|
|
63
|
+
minZoom: metadata.tileInfo?.lods?.length
|
|
64
|
+
? Math.min(...metadata.tileInfo.lods.map(level => level.level))
|
|
65
|
+
: 0,
|
|
63
66
|
maxZoom: metadata.tileInfo?.lods?.length
|
|
64
67
|
? Math.max(...metadata.tileInfo.lods.map(lod => lod.level))
|
|
65
68
|
: undefined,
|
|
@@ -74,21 +77,7 @@ export class ArcGISMapTileSource
|
|
|
74
77
|
srs: spatialReferenceWkid ? [`EPSG:${spatialReferenceWkid}`] : [],
|
|
75
78
|
layers: []
|
|
76
79
|
},
|
|
77
|
-
tileGrid: metadata.tileInfo
|
|
78
|
-
? {
|
|
79
|
-
crs: (metadata.tileInfo.spatialReference as {wkid?: number} | undefined)?.wkid
|
|
80
|
-
? `EPSG:${(metadata.tileInfo.spatialReference as {wkid: number}).wkid}`
|
|
81
|
-
: undefined,
|
|
82
|
-
tileSize:
|
|
83
|
-
metadata.tileInfo.rows && metadata.tileInfo.cols
|
|
84
|
-
? [metadata.tileInfo.cols, metadata.tileInfo.rows]
|
|
85
|
-
: undefined,
|
|
86
|
-
origin: metadata.tileInfo.origin
|
|
87
|
-
? [metadata.tileInfo.origin.x, metadata.tileInfo.origin.y]
|
|
88
|
-
: undefined,
|
|
89
|
-
matrixIds: metadata.tileInfo.lods?.map(lod => String(lod.level))
|
|
90
|
-
}
|
|
91
|
-
: undefined
|
|
80
|
+
tileGrid: createArcGISTileGrid(metadata.tileInfo, spatialReference)
|
|
92
81
|
};
|
|
93
82
|
}
|
|
94
83
|
|
|
@@ -116,23 +105,32 @@ export class ArcGISMapTileSource
|
|
|
116
105
|
|
|
117
106
|
/** Fetches a tile using the deck.gl-compatible request shape. */
|
|
118
107
|
async getTileData(parameters: GetTileDataParameters): Promise<ImageType | null> {
|
|
119
|
-
return this.getTile(
|
|
108
|
+
return this.getTile(
|
|
109
|
+
{...parameters.index, tileMatrix: parameters.tileMatrix, signal: parameters.signal},
|
|
110
|
+
parameters.signal
|
|
111
|
+
);
|
|
120
112
|
}
|
|
121
113
|
|
|
122
114
|
/** Builds the standard ArcGIS cached tile URL. */
|
|
123
115
|
getTileURL(parameters: GetTileParameters): string {
|
|
116
|
+
const metadata = this.options['arcgis-map-server']?.metadata || this._metadata;
|
|
117
|
+
const matrixId = getTileGridMatrixId(
|
|
118
|
+
createArcGISTileGrid(metadata?.tileInfo, metadata?.spatialReference),
|
|
119
|
+
parameters
|
|
120
|
+
);
|
|
124
121
|
const template = this.options['arcgis-map-server']?.urlTemplate;
|
|
125
122
|
if (template) {
|
|
126
123
|
const templateURL = new URL(
|
|
127
124
|
template
|
|
128
|
-
.replaceAll('{z}',
|
|
125
|
+
.replaceAll('{z}', encodeURIComponent(matrixId))
|
|
126
|
+
.replaceAll('{tileMatrix}', encodeURIComponent(matrixId))
|
|
129
127
|
.replaceAll('{y}', String(parameters.y))
|
|
130
128
|
.replaceAll('{x}', String(parameters.x))
|
|
131
129
|
);
|
|
132
130
|
return templateURL.toString();
|
|
133
131
|
}
|
|
134
132
|
const url = new URL(this.getServiceURL(parameters));
|
|
135
|
-
url.pathname = `${url.pathname.replace(/\/$/, '')}/tile/${
|
|
133
|
+
url.pathname = `${url.pathname.replace(/\/$/, '')}/tile/${encodeURIComponent(matrixId)}/${parameters.y}/${parameters.x}`;
|
|
136
134
|
return url.toString();
|
|
137
135
|
}
|
|
138
136
|
|
|
@@ -143,6 +141,11 @@ export class ArcGISMapTileSource
|
|
|
143
141
|
|
|
144
142
|
/** Builds a dynamic MapServer `export` request for one web-mercator tile. */
|
|
145
143
|
getExportTileURL(parameters: GetTileParameters, tileSize?: number): string {
|
|
144
|
+
if (parameters.tileMatrix !== undefined && parameters.tileMatrix !== String(parameters.z)) {
|
|
145
|
+
throw new Error(
|
|
146
|
+
'ArcGIS dynamic export requires a matching XYZ zoom; use cached mode for native matrices'
|
|
147
|
+
);
|
|
148
|
+
}
|
|
146
149
|
const options = this.options['arcgis-map-server'] || {};
|
|
147
150
|
const resolvedTileSize = tileSize || options.tileSize || 256;
|
|
148
151
|
const [west, south, east, north] = getWebMercatorTileBounds(parameters);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
5
|
import {ARCGIS_SCENE_SERVER_SOURCE_LOADER_METADATA} from '../arcgis-source-types';
|
|
6
|
-
import type {CoreAPI, SourceLoader} from '@loaders.gl/loader-utils';
|
|
6
|
+
import type {CoreAPI, SourceLoader} from '@loaders.gl/core/loader-utils';
|
|
7
7
|
import type {ArcGISSceneServerSource} from './arcgis-scene-server-source-loader';
|
|
8
8
|
import type {ArcGISSceneServerSourceOptions} from '../arcgis-source-types';
|
|
9
9
|
|
|
@@ -10,14 +10,14 @@ import type {
|
|
|
10
10
|
ArcGISSceneServerSourceOptions
|
|
11
11
|
} from '../arcgis-source-types';
|
|
12
12
|
|
|
13
|
-
import type {CoreAPI, DataSourceOptions, SourceLoader} from '@loaders.gl/loader-utils';
|
|
14
|
-
import {DataSource} from '@loaders.gl/loader-utils';
|
|
13
|
+
import type {CoreAPI, DataSourceOptions, SourceLoader} from '@loaders.gl/core/loader-utils';
|
|
14
|
+
import {DataSource} from '@loaders.gl/core/loader-utils';
|
|
15
15
|
import {
|
|
16
16
|
createI3SLayerSource,
|
|
17
17
|
normalizeI3SServiceMetadata,
|
|
18
18
|
parseI3SSceneLayerMetadata
|
|
19
|
-
} from '@loaders.gl/i3s';
|
|
20
|
-
import type {I3SLayerSource, I3SServiceMetadata, SceneLayer3D} from '@loaders.gl/i3s';
|
|
19
|
+
} from '@loaders.gl/tiles-3d/i3s';
|
|
20
|
+
import type {I3SLayerSource, I3SServiceMetadata, SceneLayer3D} from '@loaders.gl/tiles-3d/i3s';
|
|
21
21
|
import {buildArcGISResourceURL} from './arcgis-url-utils';
|
|
22
22
|
|
|
23
23
|
/** Error raised when a SceneServer query cannot be completed or decoded. */
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {createTileGrid, createTileGridMatrix} from '@loaders.gl/core/loader-utils';
|
|
6
|
+
import type {TileGrid} from '@loaders.gl/core/loader-utils';
|
|
7
|
+
import type {ArcGISMapServerMetadata} from '../arcgis-source-types';
|
|
8
|
+
|
|
9
|
+
/** Normalizes advertised ArcGIS LODs without inventing dimensions from service coverage. */
|
|
10
|
+
export function createArcGISTileGrid(
|
|
11
|
+
tileInfo: ArcGISMapServerMetadata['tileInfo'],
|
|
12
|
+
spatialReference?: unknown
|
|
13
|
+
): TileGrid | undefined {
|
|
14
|
+
if (!tileInfo) return undefined;
|
|
15
|
+
const reference = (tileInfo.spatialReference || spatialReference) as
|
|
16
|
+
| {wkid?: number; latestWkid?: number; wkt?: string}
|
|
17
|
+
| undefined;
|
|
18
|
+
const identifier = reference?.latestWkid ?? reference?.wkid;
|
|
19
|
+
const crs =
|
|
20
|
+
identifier === 102100 || identifier === 102113
|
|
21
|
+
? 'EPSG:3857'
|
|
22
|
+
: identifier !== undefined
|
|
23
|
+
? `EPSG:${identifier}`
|
|
24
|
+
: reference?.wkt;
|
|
25
|
+
const levels = tileInfo.lods || [];
|
|
26
|
+
if (
|
|
27
|
+
levels.some(level => !Number.isSafeInteger(level.level) || level.level < 0) ||
|
|
28
|
+
new Set(levels.map(level => level.level)).size !== levels.length
|
|
29
|
+
) {
|
|
30
|
+
throw new Error('ArcGIS tile levels require unique nonnegative integer identifiers');
|
|
31
|
+
}
|
|
32
|
+
const matrices = levels.map(level =>
|
|
33
|
+
createTileGridMatrix({
|
|
34
|
+
id: String(level.level),
|
|
35
|
+
resolution: level.resolution,
|
|
36
|
+
point: tileInfo.origin ? [tileInfo.origin.x, tileInfo.origin.y] : undefined,
|
|
37
|
+
swapAxes: false,
|
|
38
|
+
tileWidth: tileInfo.cols,
|
|
39
|
+
tileHeight: tileInfo.rows
|
|
40
|
+
})
|
|
41
|
+
);
|
|
42
|
+
const grid = createTileGrid(crs, matrices);
|
|
43
|
+
// A service may advertise its grid header without any LODs.
|
|
44
|
+
if (!matrices.length) {
|
|
45
|
+
delete grid.matrices;
|
|
46
|
+
delete grid.matrixIds;
|
|
47
|
+
delete grid.matrixSizes;
|
|
48
|
+
grid.origin = tileInfo.origin ? [tileInfo.origin.x, tileInfo.origin.y] : undefined;
|
|
49
|
+
grid.tileSize =
|
|
50
|
+
tileInfo.cols !== undefined && tileInfo.rows !== undefined
|
|
51
|
+
? [tileInfo.cols, tileInfo.rows]
|
|
52
|
+
: undefined;
|
|
53
|
+
}
|
|
54
|
+
return grid;
|
|
55
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
5
|
import {ARCGIS_VECTOR_TILE_SERVER_SOURCE_LOADER_METADATA} from '../arcgis-source-types';
|
|
6
|
-
import type {CoreAPI, SourceLoader} from '@loaders.gl/loader-utils';
|
|
6
|
+
import type {CoreAPI, SourceLoader} from '@loaders.gl/core/loader-utils';
|
|
7
7
|
import type {ArcGISVectorTileServerSource} from './arcgis-vector-tile-server-source-loader';
|
|
8
8
|
import type {ArcGISVectorTileServerSourceLoaderOptions} from '../arcgis-source-types';
|
|
9
9
|
|
|
@@ -15,12 +15,14 @@ import type {
|
|
|
15
15
|
GetTileParameters,
|
|
16
16
|
SourceLoader,
|
|
17
17
|
TileSourceMetadata,
|
|
18
|
+
TileGrid,
|
|
18
19
|
VectorTile,
|
|
19
20
|
VectorTileSource
|
|
20
|
-
} from '@loaders.gl/loader-utils';
|
|
21
|
-
import {DataSource} from '@loaders.gl/loader-utils';
|
|
22
|
-
import {
|
|
23
|
-
import type
|
|
21
|
+
} from '@loaders.gl/core/loader-utils';
|
|
22
|
+
import {DataSource, getTileGridMatrixId} from '@loaders.gl/core/loader-utils';
|
|
23
|
+
import {createArcGISTileGrid} from './arcgis-tile-grid';
|
|
24
|
+
import {MVTLoader, type MVTLoaderOptions} from '@loaders.gl/tiles/mvt';
|
|
25
|
+
import type {Schema} from '@loaders.gl/core/schema';
|
|
24
26
|
|
|
25
27
|
/** A source for ArcGIS VectorTileServer metadata and PBF tiles. */
|
|
26
28
|
export class ArcGISVectorTileServerSource
|
|
@@ -33,6 +35,8 @@ export class ArcGISVectorTileServerSource
|
|
|
33
35
|
readonly localCoordinates = false;
|
|
34
36
|
/** Cached service metadata request. */
|
|
35
37
|
private serviceMetadata: Promise<ArcGISVectorTileServiceMetadata> | null = null;
|
|
38
|
+
/** Advertised grid, available after metadata loads. */
|
|
39
|
+
private tileGrid: TileGrid | undefined;
|
|
36
40
|
/** Query parameters supplied with the service URL, such as an access token. */
|
|
37
41
|
private readonly serviceQueryParameters: URLSearchParams;
|
|
38
42
|
|
|
@@ -58,14 +62,16 @@ export class ArcGISVectorTileServerSource
|
|
|
58
62
|
const metadata = await this.getServiceMetadata();
|
|
59
63
|
const tileInfo = metadata.tileInfo;
|
|
60
64
|
const lods = tileInfo?.lods || [];
|
|
65
|
+
this.tileGrid = createArcGISTileGrid(tileInfo);
|
|
61
66
|
const extent = metadata.fullExtent || metadata.initialExtent;
|
|
62
67
|
return {
|
|
63
68
|
name: metadata.mapName || this.url.split('/').pop() || '',
|
|
64
69
|
title: metadata.mapName,
|
|
65
70
|
abstract: metadata.serviceDescription,
|
|
66
71
|
format: 'application/vnd.mapbox-vector-tile',
|
|
67
|
-
minZoom: lods
|
|
68
|
-
maxZoom: lods.
|
|
72
|
+
minZoom: lods.length ? Math.min(...lods.map(level => level.level)) : undefined,
|
|
73
|
+
maxZoom: lods.length ? Math.max(...lods.map(level => level.level)) : undefined,
|
|
74
|
+
tileGrid: this.tileGrid,
|
|
69
75
|
boundingBox: extent
|
|
70
76
|
? [
|
|
71
77
|
[extent.xmin, extent.ymin],
|
|
@@ -102,6 +108,12 @@ export class ArcGISVectorTileServerSource
|
|
|
102
108
|
|
|
103
109
|
/** Fetches and decodes one ArcGIS vector tile to geographic coordinates. */
|
|
104
110
|
async getVectorTile(parameters: GetTileParameters): Promise<VectorTile | null> {
|
|
111
|
+
const matrixId = getTileGridMatrixId(this.tileGrid, parameters);
|
|
112
|
+
if (matrixId !== String(parameters.z)) {
|
|
113
|
+
throw new Error(
|
|
114
|
+
'ArcGIS geographic vector decoding requires a matching XYZ zoom; use getTile for native matrix bytes'
|
|
115
|
+
);
|
|
116
|
+
}
|
|
105
117
|
const arrayBuffer = await this.getTile(parameters, parameters.signal);
|
|
106
118
|
if (!arrayBuffer) {
|
|
107
119
|
return null;
|
|
@@ -123,12 +135,19 @@ export class ArcGISVectorTileServerSource
|
|
|
123
135
|
|
|
124
136
|
/** Provides decoded vector tiles through the deck.gl source interface. */
|
|
125
137
|
async getTileData(parameters: GetTileDataParameters): Promise<VectorTile | null> {
|
|
126
|
-
return this.getVectorTile({
|
|
138
|
+
return this.getVectorTile({
|
|
139
|
+
...parameters.index,
|
|
140
|
+
tileMatrix: parameters.tileMatrix,
|
|
141
|
+
signal: parameters.signal
|
|
142
|
+
});
|
|
127
143
|
}
|
|
128
144
|
|
|
129
145
|
/** Builds the ArcGIS cached vector tile URL. */
|
|
130
146
|
getTileURL(parameters: GetTileParameters): string {
|
|
131
|
-
|
|
147
|
+
const matrixId = getTileGridMatrixId(this.tileGrid, parameters);
|
|
148
|
+
return this.getResourceURL(
|
|
149
|
+
`/tile/${encodeURIComponent(matrixId)}/${parameters.y}/${parameters.x}.pbf`
|
|
150
|
+
);
|
|
132
151
|
}
|
|
133
152
|
|
|
134
153
|
/** Returns the service metadata URL. */
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
import type {GeoJSONTable} from '@loaders.gl/schema';
|
|
6
|
-
import type {GetFeaturesParameters} from '@loaders.gl/loader-utils';
|
|
5
|
+
import type {GeoJSONTable} from '@loaders.gl/core/schema';
|
|
6
|
+
import type {GetFeaturesParameters} from '@loaders.gl/core/loader-utils';
|
|
7
7
|
import type {ArcGISFeatureServiceQueryOptions} from './arcgis-source-types';
|
|
8
8
|
|
|
9
9
|
/** Parameters shared by feature, table and MapServer layer queries. */
|
package/src/arcgis-items.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
import type {FetchLike} from '@loaders.gl/loader-utils';
|
|
5
|
+
import type {FetchLike} from '@loaders.gl/core/loader-utils';
|
|
6
6
|
|
|
7
7
|
/** A supported service-backed portal item, retaining the original portal metadata. */
|
|
8
8
|
export type ArcGISItem = {
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
import type {DataSourceOptions, SourceLoader} from '@loaders.gl/loader-utils';
|
|
5
|
+
import type {DataSourceOptions, SourceLoader} from '@loaders.gl/core/loader-utils';
|
|
6
6
|
import type {ImageLoaderOptions} from '@loaders.gl/images';
|
|
7
|
-
import type {MVTLoaderOptions} from '@loaders.gl/mvt';
|
|
7
|
+
import type {MVTLoaderOptions} from '@loaders.gl/tiles/mvt';
|
|
8
8
|
|
|
9
9
|
/** Static source metadata shared by lazy descriptors and runtime loaders. */
|
|
10
10
|
type ArcGISSourceMetadata = Omit<SourceLoader, 'dataType' | 'batchType' | 'createDataSource'>;
|
|
@@ -155,7 +155,15 @@ export type ArcGISMapServerMetadata = {
|
|
|
155
155
|
fullExtent?: {xmin: number; ymin: number; xmax: number; ymax: number; spatialReference?: unknown};
|
|
156
156
|
spatialReference?: unknown;
|
|
157
157
|
tileInfo?: {
|
|
158
|
-
|
|
158
|
+
/** Advertised level identifiers and coordinate units per pixel. */
|
|
159
|
+
lods?: {
|
|
160
|
+
/** Native cache level identifier. */
|
|
161
|
+
level: number;
|
|
162
|
+
/** Coordinate units per pixel. */
|
|
163
|
+
resolution?: number;
|
|
164
|
+
/** Advertised scale denominator, retained as service metadata. */
|
|
165
|
+
scale?: number;
|
|
166
|
+
}[];
|
|
159
167
|
rows?: number;
|
|
160
168
|
cols?: number;
|
|
161
169
|
format?: string;
|
package/src/authentication.ts
CHANGED
|
@@ -7,12 +7,12 @@ import type {
|
|
|
7
7
|
FetchLike,
|
|
8
8
|
RequestCredential,
|
|
9
9
|
TokenValue
|
|
10
|
-
} from '@loaders.gl/loader-utils';
|
|
10
|
+
} from '@loaders.gl/core/loader-utils';
|
|
11
11
|
import {
|
|
12
12
|
TokenAuthentication,
|
|
13
13
|
createAuthenticatedFetch,
|
|
14
14
|
createQueryParameterCredential
|
|
15
|
-
} from '@loaders.gl/loader-utils';
|
|
15
|
+
} from '@loaders.gl/core/loader-utils';
|
|
16
16
|
|
|
17
17
|
/** Maximum JSON error bytes retained by the authentication detector. */
|
|
18
18
|
const MAXIMUM_AUTHENTICATION_ERROR_BYTES = 16384;
|
package/src/bundled.ts
CHANGED
|
@@ -35,7 +35,39 @@ export {
|
|
|
35
35
|
ArcGISVectorTileServerSource
|
|
36
36
|
} from './arcgis/arcgis-vector-tile-server-source-loader';
|
|
37
37
|
|
|
38
|
-
export type
|
|
38
|
+
export type {
|
|
39
|
+
ArcGISService,
|
|
40
|
+
ArcGISCapabilityGraph,
|
|
41
|
+
ArcGISCapabilityGraphOptions,
|
|
42
|
+
ArcGISServiceCapabilities,
|
|
43
|
+
ArcGISServiceSelection,
|
|
44
|
+
ArcGISFeatureServiceQueryOptions,
|
|
45
|
+
ArcGISFeatureServerSourceLoaderOptions,
|
|
46
|
+
ArcGISExportImageParameters,
|
|
47
|
+
ArcGISImageSourceLoaderProps,
|
|
48
|
+
ArcGISImageTileSourceLoaderOptions,
|
|
49
|
+
ArcGISMapTileSourceLoaderOptions,
|
|
50
|
+
ArcGISVectorTileServiceMetadata,
|
|
51
|
+
ArcGISVectorTileServerSourceLoaderOptions,
|
|
52
|
+
ArcGISSceneServerSourceOptions,
|
|
53
|
+
ArcGISSceneQueryOptions,
|
|
54
|
+
ArcGISSceneQueryResult,
|
|
55
|
+
ArcGISSceneAggregationOperation,
|
|
56
|
+
ArcGISSceneAggregationSpec,
|
|
57
|
+
ArcGISSceneAggregationOptions,
|
|
58
|
+
ArcGISSceneAggregationGroup,
|
|
59
|
+
ArcGISCredentialOptions,
|
|
60
|
+
ArcGISFeatureQueryParameters,
|
|
61
|
+
ArcGISFeatureQueryOptions,
|
|
62
|
+
ArcGISFeatureQueryProgress,
|
|
63
|
+
ArcGISFeatureQueryResult,
|
|
64
|
+
ArcGISFeatureObjectIds,
|
|
65
|
+
ArcGISFeatureExtent,
|
|
66
|
+
ArcGISItem,
|
|
67
|
+
ArcGISItemLayer,
|
|
68
|
+
ArcGISItemResolution,
|
|
69
|
+
ArcGISItemOptions
|
|
70
|
+
} from './index';
|
|
39
71
|
export {
|
|
40
72
|
getArcGISServices,
|
|
41
73
|
discoverArcGISCapabilities,
|