@loaders.gl/wms 4.3.0-alpha.1 → 4.3.0-alpha.3
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/dist/csw-capabilities-loader.js +1 -1
- package/dist/csw-domain-loader.js +1 -1
- package/dist/csw-records-loader.js +1 -1
- package/dist/gml-loader.js +1 -1
- package/dist/index.cjs +125 -300
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +7 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -10
- package/dist/lib/deprecated/create-image-source.d.ts +21 -0
- package/dist/lib/deprecated/create-image-source.d.ts.map +1 -0
- package/dist/lib/deprecated/create-image-source.js +44 -0
- package/dist/lib/parsers/wfs/parse-wfs-capabilities.d.ts.map +1 -0
- package/dist/{wip/lib → lib/parsers}/wfs/parse-wfs-capabilities.js +5 -2
- package/dist/lib/parsers/wfs/parse-wfs.d.ts.map +1 -0
- package/dist/services/arcgis/arcgis-feature-server.d.ts +67 -0
- package/dist/services/arcgis/arcgis-feature-server.d.ts.map +1 -0
- package/dist/services/arcgis/arcgis-feature-server.js +446 -0
- package/dist/services/arcgis/{arcgis-image-service.d.ts → arcgis-image-server.d.ts} +25 -10
- package/dist/services/arcgis/arcgis-image-server.d.ts.map +1 -0
- package/dist/services/arcgis/{arcgis-image-service.js → arcgis-image-server.js} +28 -11
- package/dist/services/ogc/csw-service.d.ts +13 -13
- package/dist/services/ogc/csw-service.d.ts.map +1 -1
- package/dist/services/ogc/wfs-service.d.ts +279 -0
- package/dist/services/ogc/wfs-service.d.ts.map +1 -0
- package/dist/services/ogc/wfs-service.js +388 -0
- package/dist/services/ogc/wms-service.d.ts +42 -21
- package/dist/services/ogc/wms-service.d.ts.map +1 -1
- package/dist/services/ogc/wms-service.js +29 -14
- package/dist/{wip/wfs-capabilities-loader.d.ts → wfs-capabilities-loader.d.ts} +2 -1
- package/dist/wfs-capabilities-loader.d.ts.map +1 -0
- package/dist/{wip/wfs-capabilities-loader.js → wfs-capabilities-loader.js} +3 -2
- package/dist/wip/wcs-capabilities-loader.js +1 -1
- package/dist/wip/wmts-capabilities-loader.js +1 -1
- package/dist/wms-capabilities-loader.js +1 -1
- package/dist/wms-error-loader.js +1 -1
- package/package.json +6 -6
- package/src/index.ts +12 -24
- package/src/lib/{services/create-image-service.ts → deprecated/create-image-service.ts.disabled} +4 -4
- package/src/lib/deprecated/create-image-source.ts +70 -0
- package/src/{wip/lib → lib/parsers}/wfs/parse-wfs-capabilities.ts +8 -5
- package/src/services/arcgis/arcgis-feature-server.ts +506 -0
- package/src/services/arcgis/{arcgis-image-service.ts → arcgis-image-server.ts} +41 -18
- package/src/services/ogc/csw-service.ts +17 -15
- package/src/services/ogc/wfs-service.ts +624 -0
- package/src/services/ogc/wms-service.ts +54 -30
- package/src/{wip/wfs-capabilities-loader.ts → wfs-capabilities-loader.ts} +3 -2
- package/dist/lib/services/create-image-service.d.ts +0 -14
- package/dist/lib/services/create-image-service.d.ts.map +0 -1
- package/dist/lib/services/create-image-service.js +0 -39
- package/dist/lib/services/image-service.d.ts +0 -28
- package/dist/lib/services/image-service.d.ts.map +0 -1
- package/dist/lib/services/image-service.js +0 -45
- package/dist/services/arcgis/arcgis-image-service.d.ts.map +0 -1
- package/dist/services/create-image-source.d.ts +0 -18
- package/dist/services/create-image-source.d.ts.map +0 -1
- package/dist/services/create-image-source.js +0 -17
- package/dist/wip/lib/wfs/parse-wfs-capabilities.d.ts.map +0 -1
- package/dist/wip/lib/wfs/parse-wfs.d.ts.map +0 -1
- package/dist/wip/services/arcgis-feature-service.d.ts +0 -56
- package/dist/wip/services/arcgis-feature-service.d.ts.map +0 -1
- package/dist/wip/services/arcgis-feature-service.js +0 -27
- package/dist/wip/wfs-capabilities-loader.d.ts.map +0 -1
- package/src/services/create-image-source.ts +0 -33
- package/src/wip/services/arcgis-feature-service.ts +0 -89
- /package/dist/{wip/lib → lib/parsers}/wfs/parse-wfs-capabilities.d.ts +0 -0
- /package/dist/{wip/lib → lib/parsers}/wfs/parse-wfs.d.ts +0 -0
- /package/dist/{wip/lib → lib/parsers}/wfs/parse-wfs.js +0 -0
- /package/src/lib/{services/image-service.ts → deprecated/template-image-service.ts.disabled} +0 -0
- /package/src/{wip/lib → lib/parsers}/wfs/parse-wfs.ts +0 -0
|
@@ -0,0 +1,506 @@
|
|
|
1
|
+
// loaders.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import {Schema, GeoJSONTable} from '@loaders.gl/schema';
|
|
6
|
+
import type {
|
|
7
|
+
VectorSourceProps,
|
|
8
|
+
VectorSourceMetadata,
|
|
9
|
+
GetFeaturesParameters,
|
|
10
|
+
LoaderWithParser
|
|
11
|
+
} from '@loaders.gl/loader-utils';
|
|
12
|
+
import {Source, VectorSource} from '@loaders.gl/loader-utils';
|
|
13
|
+
|
|
14
|
+
const TEST_SERVICE =
|
|
15
|
+
'https://services2.arcgis.com/CcI36Pduqd0OR4W9/ArcGIS/rest/services/Bicycle_Routes_Public/FeatureServer/0';
|
|
16
|
+
const TEST_QUERY =
|
|
17
|
+
// eslint-disable-next-line no-template-curly-in-string
|
|
18
|
+
'query?returnGeometry=true&where=1%3D1&outSR=4326&outFields=*&inSR=4326&geometry=${-90}%2C+${30}%2C+${-70}%2C+${50}&geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&geometryPrecision=6&resultType=tile&f=geojson';
|
|
19
|
+
|
|
20
|
+
// @ts-nocheck
|
|
21
|
+
// type FetchLike = (url: string, options?: RequestInit) => Promise<Response>;
|
|
22
|
+
|
|
23
|
+
export type ArcGISImageServiceQueryOptions = {
|
|
24
|
+
returnGeometry: boolean;
|
|
25
|
+
where: '1%3D1';
|
|
26
|
+
outSR: 4326;
|
|
27
|
+
outFields: string | '*';
|
|
28
|
+
inSR: 4326;
|
|
29
|
+
geometry: `${-90}%2C+${30}%2C+${-70}%2C+${50}`;
|
|
30
|
+
geometryType: 'esriGeometryEnvelope'; // TODO - look up valid values in Esri docs
|
|
31
|
+
spatialRel: 'esriSpatialRelIntersects'; // TODO - look up valid values in Esri docs
|
|
32
|
+
geometryPrecision: number; // TODO - look up valid values in Esri docs
|
|
33
|
+
resultType: 'tile'; // TODO - look up valid values in Esri docs
|
|
34
|
+
f?: 'geojson'; // TODO - look up valid values in Esri docs
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// const DEFAULT_QUERY_OPTIONS: Required<ArcGISImageServiceQueryOptions> = {
|
|
38
|
+
// returnGeometry:true,
|
|
39
|
+
// where: '1%3D1',
|
|
40
|
+
// outSR: 4326,
|
|
41
|
+
// outFields: '*',
|
|
42
|
+
// inSR: 4326,
|
|
43
|
+
// geometry: `${-90}%2C+${30}%2C+${-70}%2C+${50}`,
|
|
44
|
+
// geometryType: 'esriGeometryEnvelope',
|
|
45
|
+
// spatialRel: 'esriSpatialRelIntersects',
|
|
46
|
+
// geometryPrecision: 6,
|
|
47
|
+
// resultType: 'tile',
|
|
48
|
+
// f: 'geojson'
|
|
49
|
+
// };
|
|
50
|
+
|
|
51
|
+
// export type ArcGISFeatureServiceProps = ArcGISImageServiceQueryOptions & {
|
|
52
|
+
// url: string;
|
|
53
|
+
// loadOptions?: LoaderOptions;
|
|
54
|
+
// fetch?: typeof fetch | FetchLike;
|
|
55
|
+
// };
|
|
56
|
+
|
|
57
|
+
// export class ArcGISFeatureService {
|
|
58
|
+
// url: string;
|
|
59
|
+
// loadOptions: LoaderOptions;
|
|
60
|
+
// fetch: typeof fetch | FetchLike;
|
|
61
|
+
|
|
62
|
+
// constructor(props: ArcGISFeatureServiceProps) {
|
|
63
|
+
// this.url = props.url;
|
|
64
|
+
// this.loadOptions = props.loadOptions || {};
|
|
65
|
+
// this.fetch = props.fetch || fetch;
|
|
66
|
+
// }
|
|
67
|
+
|
|
68
|
+
// // URL creators
|
|
69
|
+
|
|
70
|
+
// metadataURL(options: {parameters?: Record<string, unknown>}): string {
|
|
71
|
+
// return this.getUrl({...options});
|
|
72
|
+
// }
|
|
73
|
+
|
|
74
|
+
// /**
|
|
75
|
+
// * Form a URL to an ESRI FeatureServer
|
|
76
|
+
// // https://services2.arcgis.com/CcI36Pduqd0OR4W9/ArcGIS/rest/services/Bicycle_Routes_Public/FeatureServer/0/query?
|
|
77
|
+
// // returnGeometry=true&where=1%3D1&outSR=4326&outFields=*&inSR=4326&geometry=${-90}%2C+${30}%2C+${-70}%2C+${50}&
|
|
78
|
+
// // geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&geometryPrecision=6&resultType=tile&f=geojson`
|
|
79
|
+
// */
|
|
80
|
+
// exportImageURL(options: {
|
|
81
|
+
// boundingBox: [number, number, number, number];
|
|
82
|
+
// boundingBoxSR?: string;
|
|
83
|
+
// width: number;
|
|
84
|
+
// height: number;
|
|
85
|
+
// imageSR?: string;
|
|
86
|
+
// time?: never;
|
|
87
|
+
// f?: 'geojson';
|
|
88
|
+
// resultType?: 'tile';
|
|
89
|
+
// noData?: never;
|
|
90
|
+
// noDataInterpretation?: 'esriNoDataMatchAny';
|
|
91
|
+
// interpolation?: '+RSP_NearestNeighbor';
|
|
92
|
+
// compression?: never
|
|
93
|
+
// compressionQuality?: never;
|
|
94
|
+
// bandIds?: never;
|
|
95
|
+
// mosaicRule?: never;
|
|
96
|
+
// renderingRule?: never;
|
|
97
|
+
// f?: 'image';
|
|
98
|
+
// }): string {
|
|
99
|
+
// const {boundingBox} = options;
|
|
100
|
+
// // const bbox = `bbox=${boundingBox[0]},${boundingBox[1]},${boundingBox[2]},${boundingBox[3]}`;
|
|
101
|
+
// // const size = `size=${width},${height}`
|
|
102
|
+
// return this.getUrl({path: 'exportImage', });
|
|
103
|
+
// }
|
|
104
|
+
// }
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* @ndeprecated This is a WIP, not fully implemented
|
|
108
|
+
* @see https://developers.arcgis.com/rest/services-reference/enterprise/feature-service.htm
|
|
109
|
+
*/
|
|
110
|
+
export const ArcGISFeatureServerSource = {
|
|
111
|
+
name: 'ArcGISFeatureServer',
|
|
112
|
+
id: 'arcgis-feature-server',
|
|
113
|
+
module: 'wms',
|
|
114
|
+
version: '0.0.0',
|
|
115
|
+
extensions: [],
|
|
116
|
+
mimeTypes: [],
|
|
117
|
+
options: {
|
|
118
|
+
url: undefined!,
|
|
119
|
+
'arcgis-feature-server': {
|
|
120
|
+
/** Tabular loaders, normally the GeoJSONLoader */
|
|
121
|
+
loaders: []
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
type: 'arcgis-feature-server',
|
|
126
|
+
fromUrl: true,
|
|
127
|
+
fromBlob: false,
|
|
128
|
+
|
|
129
|
+
testURL: (url: string): boolean => url.toLowerCase().includes('FeatureServer'),
|
|
130
|
+
createDataSource: (url, props: ArcGISVectorSourceProps): ArcGISVectorSource =>
|
|
131
|
+
new ArcGISVectorSource(props)
|
|
132
|
+
} as const satisfies Source<ArcGISVectorSource, ArcGISVectorSourceProps>;
|
|
133
|
+
|
|
134
|
+
export type ArcGISVectorSourceProps = VectorSourceProps & {
|
|
135
|
+
url: string;
|
|
136
|
+
'arcgis-feature-server'?: {
|
|
137
|
+
loaders: LoaderWithParser[];
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* ArcGIS ImageServer
|
|
143
|
+
* Note - exports a big API, that could be exposed here if there is a use case
|
|
144
|
+
* @see https://developers.arcgis.com/rest/services-reference/enterprise/feature-service.htm
|
|
145
|
+
*/
|
|
146
|
+
export class ArcGISVectorSource extends VectorSource<ArcGISVectorSourceProps> {
|
|
147
|
+
data: string;
|
|
148
|
+
protected formatSpecificMetadata: Promise<any>;
|
|
149
|
+
|
|
150
|
+
constructor(props: ArcGISVectorSourceProps) {
|
|
151
|
+
super(props);
|
|
152
|
+
this.data = props.url;
|
|
153
|
+
this.formatSpecificMetadata = this._getFormatSpecificMetadata();
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/** TODO - not yet clear if we can find schema information in the FeatureServer metadata or if we need to request a feature */
|
|
157
|
+
async getSchema(): Promise<Schema> {
|
|
158
|
+
await this.getMetadata({formatSpecificMetadata: true});
|
|
159
|
+
return {metadata: {}, fields: []};
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
async getMetadata(options: {formatSpecificMetadata}): Promise<VectorSourceMetadata> {
|
|
163
|
+
// Wait for raw metadata to load
|
|
164
|
+
const formatSpecificMetadata = await this.formatSpecificMetadata;
|
|
165
|
+
|
|
166
|
+
const metadata = parseArcGISFeatureServerMetadata(formatSpecificMetadata);
|
|
167
|
+
|
|
168
|
+
// Only add the big blob of source metadata if explicitly requested
|
|
169
|
+
if (options.formatSpecificMetadata) {
|
|
170
|
+
metadata.formatSpecificMetadata = formatSpecificMetadata;
|
|
171
|
+
}
|
|
172
|
+
return metadata;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
async getFeatures(parameters: GetFeaturesParameters): Promise<GeoJSONTable> {
|
|
176
|
+
const url = `${TEST_SERVICE}/${TEST_QUERY}`;
|
|
177
|
+
const response = await this.fetch(url);
|
|
178
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
179
|
+
// TODO - hack - done to avoid pulling in selectLoader from core
|
|
180
|
+
const loader = this.props['arcgis-feature-server']?.loaders?.[0];
|
|
181
|
+
const table = loader?.parse(arrayBuffer);
|
|
182
|
+
return table;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// ImageServer endpoints
|
|
186
|
+
|
|
187
|
+
protected async _getFormatSpecificMetadata() {
|
|
188
|
+
// PJSON is formatted by a bit slower than JSON
|
|
189
|
+
const url = `${TEST_SERVICE}/f=pjson`;
|
|
190
|
+
const response = await this.fetch(url);
|
|
191
|
+
return await response.json();
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/*
|
|
196
|
+
getArcGISOptions({
|
|
197
|
+
boundingBox: [min: [x: number, y: number], max: [x: number, y: number]]
|
|
198
|
+
}) {
|
|
199
|
+
return {
|
|
200
|
+
returnGeometry: true,
|
|
201
|
+
where: '1=1',
|
|
202
|
+
outFields: '*',
|
|
203
|
+
inSR: 432,
|
|
204
|
+
geometry: '${-90}%2C+${30}%2C+${-70}%2C+${50}',
|
|
205
|
+
geometryType: 'esriGeometryEnvelope',
|
|
206
|
+
spatialRel: 'esriSpatialRelIntersects',
|
|
207
|
+
geometryPrecision: 6,
|
|
208
|
+
resultType: 'tile',
|
|
209
|
+
f: 'geojson'
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
*/
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Form a URL to an ESRI ImageServer
|
|
216
|
+
// https://sampleserver6.arcgisonline.com/arcgis/rest/services/NLCDLandCover2001/ImageServer/exportImage?bbox=${bounds[0]},${bounds[1]},${bounds[2]},${bounds[3]}&bboxSR=4326&size=${width},${height}&imageSR=102100&time=&format=jpgpng&pixelType=U8&noData=&noDataInterpretation=esriNoDataMatchAny&interpolation=+RSP_NearestNeighbor&compression=&compressionQuality=&bandIds=&mosaicRule=&renderingRule=&f=image`,
|
|
217
|
+
*
|
|
218
|
+
exportImage(options: {
|
|
219
|
+
boundingBox: [number, number, number, number];
|
|
220
|
+
boundingBoxSR?: string;
|
|
221
|
+
width: number;
|
|
222
|
+
height: number;
|
|
223
|
+
imageSR?: string;
|
|
224
|
+
time?: never;
|
|
225
|
+
format?: 'jpgpng';
|
|
226
|
+
pixelType?: 'U8';
|
|
227
|
+
noData?: never;
|
|
228
|
+
noDataInterpretation?: 'esriNoDataMatchAny';
|
|
229
|
+
interpolation?: '+RSP_NearestNeighbor';
|
|
230
|
+
compression?: never;
|
|
231
|
+
compressionQuality?: never;
|
|
232
|
+
bandIds?: never;
|
|
233
|
+
mosaicRule?: never;
|
|
234
|
+
renderingRule?: never;
|
|
235
|
+
f?: 'image';
|
|
236
|
+
}): Promise<ImageType> {
|
|
237
|
+
// See WMSService.getMap()
|
|
238
|
+
throw new Error('not implemented');
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// URL creators
|
|
242
|
+
|
|
243
|
+
metadataURL(options: {parameters?: Record<string, unknown>}): string {
|
|
244
|
+
return `${this.props.url}?f=pjson`;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Form a URL to an ESRI ImageServer
|
|
249
|
+
// https://sampleserver6.arcgisonline.com/arcgis/rest/services/NLCDLandCover2001/ImageServer/exportImage?
|
|
250
|
+
// bbox=${bounds[0]},${bounds[1]},${bounds[2]},${bounds[3]}&bboxSR=4326&
|
|
251
|
+
// size=${width},${height}&imageSR=102100&time=&format=jpgpng&pixelType=U8&
|
|
252
|
+
// noData=&noDataInterpretation=esriNoDataMatchAny&interpolation=+RSP_NearestNeighbor&compression=&
|
|
253
|
+
// compressionQuality=&bandIds=&mosaicRule=&renderingRule=&
|
|
254
|
+
// f=image
|
|
255
|
+
*
|
|
256
|
+
exportImageURL(options: {
|
|
257
|
+
bbox: [number, number, number, number];
|
|
258
|
+
boxSR?: string;
|
|
259
|
+
width: number;
|
|
260
|
+
height: number;
|
|
261
|
+
imageSR?: string;
|
|
262
|
+
time?: never;
|
|
263
|
+
format?: 'jpgpng';
|
|
264
|
+
pixelType?: 'U8';
|
|
265
|
+
noData?: never;
|
|
266
|
+
noDataInterpretation?: 'esriNoDataMatchAny';
|
|
267
|
+
interpolation?: '+RSP_NearestNeighbor';
|
|
268
|
+
compression?: never;
|
|
269
|
+
compressionQuality?: never;
|
|
270
|
+
bandIds?: never;
|
|
271
|
+
mosaicRule?: never;
|
|
272
|
+
renderingRule?: never;
|
|
273
|
+
f?: 'image';
|
|
274
|
+
}): string {
|
|
275
|
+
const bbox = `bbox=${options.bbox[0]},${options.bbox[1]},${options.bbox[2]},${options.bbox[3]}`;
|
|
276
|
+
const size = `size=${options.width},${options.height}`;
|
|
277
|
+
const arcgisOptions = {...options, bbox, size};
|
|
278
|
+
// @ts-expect-error
|
|
279
|
+
delete arcgisOptions.width;
|
|
280
|
+
// @ts-expect-error
|
|
281
|
+
delete arcgisOptions.height;
|
|
282
|
+
return this.getUrl('exportImage', arcgisOptions);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// INTERNAL METHODS
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* @note protected, since perhaps getWMSUrl may need to be overridden to handle certain backends?
|
|
289
|
+
* @note if override is common, maybe add a callback prop?
|
|
290
|
+
*
|
|
291
|
+
protected getUrl(
|
|
292
|
+
path: string,
|
|
293
|
+
options: Record<string, unknown>,
|
|
294
|
+
extra?: Record<string, unknown>
|
|
295
|
+
): string {
|
|
296
|
+
let url = `${this.props.url}/${path}`;
|
|
297
|
+
let first = true;
|
|
298
|
+
for (const [key, value] of Object.entries(options)) {
|
|
299
|
+
url += first ? '?' : '&';
|
|
300
|
+
first = false;
|
|
301
|
+
if (Array.isArray(value)) {
|
|
302
|
+
url += `${key.toUpperCase()}=${value.join(',')}`;
|
|
303
|
+
} else {
|
|
304
|
+
url += `${key.toUpperCase()}=${value ? String(value) : ''}`;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
return url;
|
|
308
|
+
}
|
|
309
|
+
*/
|
|
310
|
+
|
|
311
|
+
function parseArcGISFeatureServerMetadata(json: any): VectorSourceMetadata {
|
|
312
|
+
const layers: VectorSourceMetadata['layers'] = [];
|
|
313
|
+
for (const layer of json.layers || []) {
|
|
314
|
+
layers.push({
|
|
315
|
+
// id: layer.id,
|
|
316
|
+
name: layer.name
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
return {
|
|
321
|
+
// version: json.currentVersion || '',
|
|
322
|
+
title: json.serviceDescription || '',
|
|
323
|
+
name: json.serviceDescription || '',
|
|
324
|
+
abstract: json.description || '',
|
|
325
|
+
keywords: [],
|
|
326
|
+
// attrribution: json.copyrightText || ''.
|
|
327
|
+
// crs: 'EPSG:4326',
|
|
328
|
+
layers
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/** Sample metadata
|
|
333
|
+
* @see https://developers.arcgis.com/rest/services-reference/enterprise/feature-service.htm
|
|
334
|
+
*/
|
|
335
|
+
// "currentVersion": 11.1,
|
|
336
|
+
// "serviceDescription": "Birds",
|
|
337
|
+
// "hasVersionedData": false,
|
|
338
|
+
// "supportsDisconnectedEditing: false,
|
|
339
|
+
// "supportsDatumTransformation": true,
|
|
340
|
+
// "supportsReturnDeleteResults": true,
|
|
341
|
+
// "supportsRelationshipsResource": true,
|
|
342
|
+
// "syncEnabled": false,
|
|
343
|
+
// "supportedExportFormats": "sqlite,filegdb,shapefile,csv,geojson",
|
|
344
|
+
// "hasStaticData": false,
|
|
345
|
+
// "maxRecordCount": 1000,
|
|
346
|
+
// "supportedQueryFormats": "JSON",
|
|
347
|
+
// "capabilities": "Query,Create,Delete,Update,Uploads,Editing,Extract,ChangeTracking,Sync",
|
|
348
|
+
// "description": "",
|
|
349
|
+
// "copyrightText": "",
|
|
350
|
+
// "userTypeExtensions: [
|
|
351
|
+
// "utilityNetwork"
|
|
352
|
+
// ],
|
|
353
|
+
// "advancedEditingCapabilities": {
|
|
354
|
+
// "supportsSplit": true,
|
|
355
|
+
// "supportsReturnServiceEditsInSourceSR": true
|
|
356
|
+
// },
|
|
357
|
+
// "spatialReference": {
|
|
358
|
+
// "wkid": 4326,
|
|
359
|
+
// "latestWkid": 4326
|
|
360
|
+
// },
|
|
361
|
+
// "initialExtent": {
|
|
362
|
+
// "xmin": -118.016756138237,
|
|
363
|
+
// "ymin": 32.8933824408207,
|
|
364
|
+
// "xmax": -116.532738278622,
|
|
365
|
+
// "ymax": 34.3261469363675,
|
|
366
|
+
// "spatialReference": {
|
|
367
|
+
// "wkid": 4326,
|
|
368
|
+
// "latestWkid": 4326
|
|
369
|
+
// }
|
|
370
|
+
// },
|
|
371
|
+
// "fullExtent": {
|
|
372
|
+
// "xmin": -117.855689264791,
|
|
373
|
+
// "ymin": 32.5702577626442,
|
|
374
|
+
// "xmax": -116.87086222794,
|
|
375
|
+
// "ymax": 34.1460567673275,
|
|
376
|
+
// "spatialReference": {
|
|
377
|
+
// "wkid": 4326,
|
|
378
|
+
// "latestWkid": 4326
|
|
379
|
+
// }
|
|
380
|
+
// },
|
|
381
|
+
// "allowGeometryUpdates": true,
|
|
382
|
+
// "units": "esriDecimalDegrees",
|
|
383
|
+
// "syncEnabled": true,
|
|
384
|
+
// "validationSystemLayers": {
|
|
385
|
+
// "validationPointErrorlayerId": 1,
|
|
386
|
+
// "validationLineErrorlayerId": 2,
|
|
387
|
+
// "validationPolygonErrorlayerId": 3,
|
|
388
|
+
// "validationObjectErrortableId": 5
|
|
389
|
+
// },
|
|
390
|
+
// "extractChangesCapabilities": {
|
|
391
|
+
// "supportsReturnIdsOnly": true,
|
|
392
|
+
// "supportsReturnExtentOnly": false,
|
|
393
|
+
// "supportsReturnAttachments": false,
|
|
394
|
+
// "supportsLayerQueries": false,
|
|
395
|
+
// "supportsSpatialFilter": false,
|
|
396
|
+
// "supportsReturnFeature": false,
|
|
397
|
+
// "supportsReturnHasGeometryUpdates": true
|
|
398
|
+
// },
|
|
399
|
+
// "syncCapabilities": {
|
|
400
|
+
// "supportsASync": true,
|
|
401
|
+
// "supportsRegisteringExistingData": true,
|
|
402
|
+
// "supportsSyncDirectionControl": true,
|
|
403
|
+
// "supportsPerLayerSync": true,
|
|
404
|
+
// "supportsPerReplicaSync": false,
|
|
405
|
+
// "supportsRollbackOnFailure": false,
|
|
406
|
+
// "supportedSyncDataOptions": 3
|
|
407
|
+
// "supportsQueryWithDatumTransformation": true,
|
|
408
|
+
// },
|
|
409
|
+
// "editorTrackingInfo": {
|
|
410
|
+
// "enableEditorTracking": false,
|
|
411
|
+
// "enableOwnershipAccessControl": false,
|
|
412
|
+
// "allowOthersToUpdate": true,
|
|
413
|
+
// "allowOthersToDelete": false
|
|
414
|
+
// },
|
|
415
|
+
// "layers": [
|
|
416
|
+
// {
|
|
417
|
+
// "id": 0,
|
|
418
|
+
// "name": "Sitings",
|
|
419
|
+
// "parentLayerId": -1,
|
|
420
|
+
// "defaultVisibility": true,
|
|
421
|
+
// "subLayerIds": null,
|
|
422
|
+
// "minScale": 0,
|
|
423
|
+
// "maxScale": 0,
|
|
424
|
+
// "geometryType": "esriGeometryPoint"
|
|
425
|
+
// },
|
|
426
|
+
// {
|
|
427
|
+
// "id": 1,
|
|
428
|
+
// "name": "NestingGrounds",
|
|
429
|
+
// "parentLayerId": -1,
|
|
430
|
+
// "defaultVisibility": true,
|
|
431
|
+
// "subLayerIds": null,
|
|
432
|
+
// "minScale": 0,
|
|
433
|
+
// "maxScale": 0,
|
|
434
|
+
// "geometryType": "esriGeometryPolygon"
|
|
435
|
+
// },
|
|
436
|
+
// {
|
|
437
|
+
// "id": 2,
|
|
438
|
+
// "name": "LandCover",
|
|
439
|
+
// "parentLayerId": -1,
|
|
440
|
+
// "defaultVisibility": true,
|
|
441
|
+
// "subLayerIds": null,
|
|
442
|
+
// "minScale": 0,
|
|
443
|
+
// "maxScale": 0,
|
|
444
|
+
// "geometryType": "esriGeometryPolygon"
|
|
445
|
+
// }
|
|
446
|
+
// ],
|
|
447
|
+
// "tables": [],
|
|
448
|
+
// "relationships": [
|
|
449
|
+
// {
|
|
450
|
+
// "id": 0,
|
|
451
|
+
// "name": "relationship_1"
|
|
452
|
+
// }
|
|
453
|
+
// ],
|
|
454
|
+
// "datumTransformations": [
|
|
455
|
+
// {
|
|
456
|
+
// "geoTransforms": [
|
|
457
|
+
// {
|
|
458
|
+
// "wkid": 15931,
|
|
459
|
+
// "latestWkid": 15931,
|
|
460
|
+
// "transformForward": false,
|
|
461
|
+
// "name": NAD_1983_NSRS2007_To_WGS_1984_1"
|
|
462
|
+
// }
|
|
463
|
+
// ]
|
|
464
|
+
// },
|
|
465
|
+
// {
|
|
466
|
+
// "geoTransforms": [
|
|
467
|
+
// {
|
|
468
|
+
// "wkid": 15931,
|
|
469
|
+
// "latestWkid": 15931,
|
|
470
|
+
// "transformForward": true,
|
|
471
|
+
// "name": NAD_1983_NSRS2007_to_WGS_1984_1"
|
|
472
|
+
// }
|
|
473
|
+
// ]
|
|
474
|
+
// }
|
|
475
|
+
// ],
|
|
476
|
+
// "isIndoorsService": true,
|
|
477
|
+
// "isLocationTrackingService": true,
|
|
478
|
+
// "isLocationTrackingView": true
|
|
479
|
+
// }
|
|
480
|
+
// The following is a portion of a JSON response example for a spatial reference, VCS, tolerance, resolution properties, and high model info:
|
|
481
|
+
|
|
482
|
+
// ...
|
|
483
|
+
// "spatialReference": {
|
|
484
|
+
// "wkid": 102100,
|
|
485
|
+
// "latestWkid": 3857,
|
|
486
|
+
// "vcsWkid": 115700,
|
|
487
|
+
// "latestVcsWkid": 115700,
|
|
488
|
+
// "xyTolerance": 0.001,
|
|
489
|
+
// "zTolerance": 0.001,
|
|
490
|
+
// "mTolerance": 0.001,
|
|
491
|
+
// "falseX": -20037700,
|
|
492
|
+
// "falseY": -30241100,
|
|
493
|
+
// "xyUnits": 1.4892314192838538E8,
|
|
494
|
+
// "falseZ": -100000,
|
|
495
|
+
// "zUnits": 10000,
|
|
496
|
+
// "falseM": -100000,
|
|
497
|
+
// "mUnits": 10000
|
|
498
|
+
// },
|
|
499
|
+
// "heightModelInfo": {
|
|
500
|
+
// "heightModel": "ellipsoidal",
|
|
501
|
+
// "vertCRS": "WGS_1984",
|
|
502
|
+
// "heightUnit": "meter"
|
|
503
|
+
// },
|
|
504
|
+
// ...
|
|
505
|
+
// // TODO - normalize metadata
|
|
506
|
+
// }
|
|
@@ -2,17 +2,44 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
|
-
import {ImageType} from '@loaders.gl/images';
|
|
6
|
-
import type {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
import type {ImageType} from '@loaders.gl/images';
|
|
6
|
+
import type {
|
|
7
|
+
Source,
|
|
8
|
+
ImageSourceProps,
|
|
9
|
+
ImageSourceMetadata,
|
|
10
|
+
GetImageParameters
|
|
11
|
+
} from '@loaders.gl/loader-utils';
|
|
12
|
+
import {ImageSource} from '@loaders.gl/loader-utils';
|
|
10
13
|
|
|
11
14
|
// import type {ImageSourceProps} from '@loaders.gl/loader-utils';
|
|
12
15
|
// import {ImageSource} from '@loaders.gl/loader-utils';
|
|
13
16
|
|
|
14
|
-
export
|
|
15
|
-
|
|
17
|
+
export const ArcGISImageServerSource = {
|
|
18
|
+
name: 'ArcGISImageServer',
|
|
19
|
+
id: 'arcgis-image-server',
|
|
20
|
+
module: 'wms',
|
|
21
|
+
version: '0.0.0',
|
|
22
|
+
extensions: [],
|
|
23
|
+
mimeTypes: [],
|
|
24
|
+
options: {
|
|
25
|
+
'arcgis-image-server': {
|
|
26
|
+
// TODO - add options here
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
type: 'arcgis-image-server',
|
|
31
|
+
fromUrl: true,
|
|
32
|
+
fromBlob: false,
|
|
33
|
+
|
|
34
|
+
testURL: (url: string): boolean => url.toLowerCase().includes('ImageServer'),
|
|
35
|
+
createDataSource: (url, props: ArcGISImageSourceProps): ArcGISImageSource =>
|
|
36
|
+
new ArcGISImageSource(url as string, props)
|
|
37
|
+
} as const satisfies Source<ArcGISImageSource, ArcGISImageSourceProps>;
|
|
38
|
+
|
|
39
|
+
export type ArcGISImageSourceProps = ImageSourceProps & {
|
|
40
|
+
'arcgis-image-server'?: {
|
|
41
|
+
// TODO - add options here
|
|
42
|
+
};
|
|
16
43
|
};
|
|
17
44
|
|
|
18
45
|
/**
|
|
@@ -20,12 +47,14 @@ export type ArcGISImageServerProps = ImageServiceProps & {
|
|
|
20
47
|
* Note - exports a big API, that could be exposed here if there is a use case
|
|
21
48
|
* @see https://developers.arcgis.com/rest/services-reference/enterprise/image-service.htm
|
|
22
49
|
*/
|
|
23
|
-
export class ArcGISImageSource extends
|
|
50
|
+
export class ArcGISImageSource extends ImageSource<ArcGISImageSourceProps> {
|
|
51
|
+
url: string;
|
|
24
52
|
data: string;
|
|
25
53
|
|
|
26
|
-
constructor(props:
|
|
54
|
+
constructor(url: string, props: ArcGISImageSourceProps) {
|
|
27
55
|
super(props);
|
|
28
|
-
this.
|
|
56
|
+
this.url = url;
|
|
57
|
+
this.data = url;
|
|
29
58
|
}
|
|
30
59
|
|
|
31
60
|
// ImageSource (normalized endpoints)
|
|
@@ -79,7 +108,7 @@ export class ArcGISImageSource extends ImageService<ArcGISImageServerProps> {
|
|
|
79
108
|
// URL creators
|
|
80
109
|
|
|
81
110
|
metadataURL(options: {parameters?: Record<string, unknown>}): string {
|
|
82
|
-
return `${this.
|
|
111
|
+
return `${this.url}?f=pjson`;
|
|
83
112
|
}
|
|
84
113
|
|
|
85
114
|
/**
|
|
@@ -131,7 +160,7 @@ export class ArcGISImageSource extends ImageService<ArcGISImageServerProps> {
|
|
|
131
160
|
options: Record<string, unknown>,
|
|
132
161
|
extra?: Record<string, unknown>
|
|
133
162
|
): string {
|
|
134
|
-
let url = `${this.
|
|
163
|
+
let url = `${this.url}/${path}`;
|
|
135
164
|
let first = true;
|
|
136
165
|
for (const [key, value] of Object.entries(options)) {
|
|
137
166
|
url += first ? '?' : '&';
|
|
@@ -155,9 +184,3 @@ export class ArcGISImageSource extends ImageService<ArcGISImageServerProps> {
|
|
|
155
184
|
}
|
|
156
185
|
}
|
|
157
186
|
}
|
|
158
|
-
|
|
159
|
-
export const ArcGISImageService: Service = {
|
|
160
|
-
type: 'arcgis-image-server',
|
|
161
|
-
testURL: (url: string): boolean => url.toLowerCase().includes('ImageServer'),
|
|
162
|
-
create: (props: ArcGISImageServerProps): ArcGISImageSource => new ArcGISImageSource(props)
|
|
163
|
-
};
|
|
@@ -18,6 +18,23 @@ import {CSWDomainLoader} from '../../csw-domain-loader';
|
|
|
18
18
|
|
|
19
19
|
import {WMSErrorLoader as CSWErrorLoader} from '../../wms-error-loader';
|
|
20
20
|
|
|
21
|
+
export type CSWServiceProps = DataSourceProps & {
|
|
22
|
+
url: string;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/** Describes a service or resource exposed by the catalog */
|
|
26
|
+
export type Service = {
|
|
27
|
+
/** name of service or resource */
|
|
28
|
+
name: string;
|
|
29
|
+
/** type of service or resource */
|
|
30
|
+
type: string;
|
|
31
|
+
url: string;
|
|
32
|
+
params?: string;
|
|
33
|
+
scheme?: string;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// CSW PARAMETER TYPES
|
|
37
|
+
|
|
21
38
|
type CSWCommonParameters = {
|
|
22
39
|
/** In case the endpoint supports multiple services */
|
|
23
40
|
service?: 'CSW';
|
|
@@ -43,21 +60,6 @@ export type CSWGetDomainParameters = CSWCommonParameters & {
|
|
|
43
60
|
// TBA
|
|
44
61
|
};
|
|
45
62
|
|
|
46
|
-
/** Describes a service or resource exposed by the catalog */
|
|
47
|
-
export type Service = {
|
|
48
|
-
/** name of service or resource */
|
|
49
|
-
name: string;
|
|
50
|
-
/** type of service or resource */
|
|
51
|
-
type: string;
|
|
52
|
-
url: string;
|
|
53
|
-
params?: string;
|
|
54
|
-
scheme?: string;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
export type CSWServiceProps = DataSourceProps & {
|
|
58
|
-
url: string;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
63
|
/**
|
|
62
64
|
* The CSWService class
|
|
63
65
|
* - provides type safe methods to form URLs to a CSW service
|