@loaders.gl/wms 3.3.0-alpha.13 → 3.3.0-alpha.14
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/dist.min.js +182 -1046
- package/dist/es5/index.js +20 -13
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/lerc-loader.js +1 -1
- package/dist/es5/lib/data-sources/adhoc-image-service.js +4 -0
- package/dist/es5/lib/data-sources/adhoc-image-service.js.map +1 -1
- package/dist/es5/lib/data-sources/arcgis-image-service.js +180 -0
- package/dist/es5/lib/data-sources/arcgis-image-service.js.map +1 -0
- package/dist/es5/lib/data-sources/create-image-source.js +45 -0
- package/dist/es5/lib/data-sources/create-image-source.js.map +1 -0
- package/dist/es5/lib/data-sources/image-services/arcgis-image-service.js +179 -0
- package/dist/es5/lib/data-sources/image-services/arcgis-image-service.js.map +1 -0
- package/dist/es5/lib/data-sources/image-services/image-service.js +163 -0
- package/dist/es5/lib/data-sources/image-services/image-service.js.map +1 -0
- package/dist/es5/lib/data-sources/{wms-service.js → image-services/wms-service.js} +116 -75
- package/dist/es5/lib/data-sources/image-services/wms-service.js.map +1 -0
- package/dist/es5/wip/arcgis-feature-service.js +45 -0
- package/dist/es5/wip/arcgis-feature-service.js.map +1 -0
- package/dist/es5/wip/data-source.js.map +1 -1
- package/dist/es5/wip/gml-loader.js +1 -1
- package/dist/es5/wip/wcs-capabilities-loader.js +1 -1
- package/dist/es5/wip/wfs-capabilities-loader.js +1 -1
- package/dist/es5/wip/wmts-capabilities-loader.js +1 -1
- package/dist/es5/wms-capabilities-loader.js +1 -1
- package/dist/es5/wms-error-loader.js +1 -1
- package/dist/esm/index.js +5 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lerc-loader.js +1 -1
- package/dist/esm/lib/data-sources/adhoc-image-service.js +2 -0
- package/dist/esm/lib/data-sources/adhoc-image-service.js.map +1 -1
- package/dist/esm/lib/data-sources/arcgis-image-service.js +62 -0
- package/dist/esm/lib/data-sources/arcgis-image-service.js.map +1 -0
- package/dist/esm/lib/data-sources/create-image-source.js +30 -0
- package/dist/esm/lib/data-sources/create-image-source.js.map +1 -0
- package/dist/esm/lib/data-sources/image-services/arcgis-image-service.js +61 -0
- package/dist/esm/lib/data-sources/image-services/arcgis-image-service.js.map +1 -0
- package/dist/esm/lib/data-sources/image-services/image-service.js +72 -0
- package/dist/esm/lib/data-sources/image-services/image-service.js.map +1 -0
- package/dist/esm/lib/data-sources/{wms-service.js → image-services/wms-service.js} +46 -32
- package/dist/esm/lib/data-sources/image-services/wms-service.js.map +1 -0
- package/dist/esm/wip/arcgis-feature-service.js +28 -0
- package/dist/esm/wip/arcgis-feature-service.js.map +1 -0
- package/dist/esm/wip/data-source.js.map +1 -1
- package/dist/esm/wip/gml-loader.js +1 -1
- package/dist/esm/wip/wcs-capabilities-loader.js +1 -1
- package/dist/esm/wip/wfs-capabilities-loader.js +1 -1
- package/dist/esm/wip/wmts-capabilities-loader.js +1 -1
- package/dist/esm/wms-capabilities-loader.js +1 -1
- package/dist/esm/wms-error-loader.js +1 -1
- package/dist/index.d.ts +9 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -8
- package/dist/lib/data-sources/adhoc-image-service.d.ts +2 -0
- package/dist/lib/data-sources/adhoc-image-service.d.ts.map +1 -1
- package/dist/lib/data-sources/adhoc-image-service.js +2 -0
- package/dist/lib/data-sources/arcgis-image-service.d.ts +79 -0
- package/dist/lib/data-sources/arcgis-image-service.d.ts.map +1 -0
- package/dist/lib/data-sources/arcgis-image-service.js +85 -0
- package/dist/lib/data-sources/create-image-source.d.ts +16 -0
- package/dist/lib/data-sources/create-image-source.d.ts.map +1 -0
- package/dist/lib/data-sources/create-image-source.js +39 -0
- package/dist/lib/data-sources/image-services/arcgis-image-service.d.ts +71 -0
- package/dist/lib/data-sources/image-services/arcgis-image-service.d.ts.map +1 -0
- package/dist/lib/data-sources/image-services/arcgis-image-service.js +85 -0
- package/dist/lib/data-sources/image-services/image-service.d.ts +39 -0
- package/dist/lib/data-sources/image-services/image-service.d.ts.map +1 -0
- package/dist/lib/data-sources/image-services/image-service.js +82 -0
- package/dist/lib/data-sources/{wms-service.d.ts → image-services/wms-service.d.ts} +33 -38
- package/dist/lib/data-sources/image-services/wms-service.d.ts.map +1 -0
- package/dist/lib/data-sources/{wms-service.js → image-services/wms-service.js} +40 -28
- package/dist/wip/arcgis-feature-service.d.ts +56 -0
- package/dist/wip/arcgis-feature-service.d.ts.map +1 -0
- package/dist/wip/arcgis-feature-service.js +28 -0
- package/dist/wip/data-source.d.ts +14 -13
- package/dist/wip/data-source.d.ts.map +1 -1
- package/dist/wip/data-source.js +15 -13
- package/package.json +6 -6
- package/src/index.ts +13 -8
- package/src/lib/data-sources/adhoc-image-service.ts +3 -0
- package/src/lib/data-sources/arcgis-image-service.ts +146 -0
- package/src/lib/data-sources/create-image-source.ts +46 -0
- package/src/lib/data-sources/image-services/arcgis-image-service.ts +136 -0
- package/src/lib/data-sources/image-services/image-service.ts +105 -0
- package/src/lib/data-sources/{wms-service.ts → image-services/wms-service.ts} +51 -47
- package/src/wip/arcgis-feature-service.ts +89 -0
- package/src/wip/data-source.ts +15 -13
- package/dist/es5/lib/data-sources/wms-service.js.map +0 -1
- package/dist/esm/lib/data-sources/wms-service.js.map +0 -1
- package/dist/lib/data-sources/wms-service.d.ts.map +0 -1
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// loaders.gl, MIT license
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ArcGISImageService = void 0;
|
|
5
|
+
const image_source_1 = require("../image-source");
|
|
6
|
+
const image_service_1 = require("./image-service");
|
|
7
|
+
class ArcGISImageService extends image_source_1.ImageSource {
|
|
8
|
+
constructor(props) {
|
|
9
|
+
super();
|
|
10
|
+
this.props = (0, image_service_1.mergeImageServiceProps)(props);
|
|
11
|
+
this.fetch = (0, image_service_1.getFetchFunction)(this.props);
|
|
12
|
+
}
|
|
13
|
+
// ImageSource (normalized endpoints)
|
|
14
|
+
async getMetadata() {
|
|
15
|
+
return (await this.info());
|
|
16
|
+
// TODO - normalize metadata
|
|
17
|
+
}
|
|
18
|
+
async getImage(parameters) {
|
|
19
|
+
throw new Error('not implemented');
|
|
20
|
+
// TODO - Map generic parameters to ArcGIS specific parameters
|
|
21
|
+
// return await this.exportImage(parameters);
|
|
22
|
+
}
|
|
23
|
+
// ImageServer endpoints
|
|
24
|
+
async info() {
|
|
25
|
+
// We just need a JSON parsing...
|
|
26
|
+
// return this.getUrl({path: '', ...options});
|
|
27
|
+
throw new Error('not implemented');
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Form a URL to an ESRI ImageServer
|
|
31
|
+
// 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`,
|
|
32
|
+
*/
|
|
33
|
+
exportImage(options) {
|
|
34
|
+
// See WMSService.getMap()
|
|
35
|
+
throw new Error('not implemented');
|
|
36
|
+
}
|
|
37
|
+
// URL creators
|
|
38
|
+
infoURL(options) {
|
|
39
|
+
return this.props.url;
|
|
40
|
+
// return this.getUrl({path: '', ...options});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Form a URL to an ESRI ImageServer
|
|
44
|
+
// 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`,
|
|
45
|
+
*/
|
|
46
|
+
exportImageURL(options) {
|
|
47
|
+
// const {boundingBox} = options;
|
|
48
|
+
// const bbox = `bbox=${boundingBox[0]},${boundingBox[1]},${boundingBox[2]},${boundingBox[3]}`;
|
|
49
|
+
// const size = `size=${width},${height}`;
|
|
50
|
+
// return this.getUrl({path: 'exportImage'});
|
|
51
|
+
return this.props.url;
|
|
52
|
+
}
|
|
53
|
+
// INTERNAL METHODS
|
|
54
|
+
/**
|
|
55
|
+
* @note protected, since perhaps getWMSUrl may need to be overridden to handle certain backends?
|
|
56
|
+
* @note if override is common, maybe add a callback prop?
|
|
57
|
+
* */
|
|
58
|
+
getUrl(options, extra) {
|
|
59
|
+
let url = `${this.props.url}`;
|
|
60
|
+
let first = true;
|
|
61
|
+
for (const [key, value] of Object.entries(options)) {
|
|
62
|
+
url += first ? '?' : '&';
|
|
63
|
+
first = false;
|
|
64
|
+
if (Array.isArray(value)) {
|
|
65
|
+
url += `${key.toUpperCase()}=${value.join(',')}`;
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
url += `${key.toUpperCase()}=${value ? String(value) : ''}`;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return url;
|
|
72
|
+
}
|
|
73
|
+
/** Checks for and parses a WMS XML formatted ServiceError and throws an exception */
|
|
74
|
+
async checkResponse(response) {
|
|
75
|
+
if (!response.ok) {
|
|
76
|
+
// } || response.headers['content-type'] === WMSErrorLoader.mimeTypes[0]) {
|
|
77
|
+
// const arrayBuffer = await response.arrayBuffer();
|
|
78
|
+
// const error = await WMSErrorLoader.parse(arrayBuffer, this.loadOptions);
|
|
79
|
+
throw new Error('error');
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
exports.ArcGISImageService = ArcGISImageService;
|
|
84
|
+
ArcGISImageService.type = 'arcgis-image-server';
|
|
85
|
+
ArcGISImageService.testURL = (url) => url.toLowerCase().includes('ImageServer');
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { LoaderOptions } from '@loaders.gl/loader-utils';
|
|
2
|
+
import type { ImageType } from '@loaders.gl/images';
|
|
3
|
+
import type { ImageSourceMetadata, GetImageParameters } from '../image-source';
|
|
4
|
+
import { ImageSource } from '../image-source';
|
|
5
|
+
/** Template URL string should contain `${width}` etc which will be substituted. */
|
|
6
|
+
export type ImageServiceProps = {
|
|
7
|
+
/** Base URL to the service */
|
|
8
|
+
url: string;
|
|
9
|
+
/** Any load options to the loaders.gl Loaders used by the WMSService methods */
|
|
10
|
+
loadOptions?: LoaderOptions;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Quickly connect to "ad hoc" image sources without subclassing ImageSource.
|
|
14
|
+
* ImageSource allows template url strings to be used to ad hoc connect to arbitrary image data sources
|
|
15
|
+
* Accepts a template url string and builds requests URLs
|
|
16
|
+
*/
|
|
17
|
+
export declare class ImageService extends ImageSource {
|
|
18
|
+
static type: 'template';
|
|
19
|
+
static testURL: (url: string) => boolean;
|
|
20
|
+
props: Required<ImageServiceProps>;
|
|
21
|
+
fetch: (url: string, options?: RequestInit) => Promise<Response>;
|
|
22
|
+
constructor(props: ImageServiceProps);
|
|
23
|
+
getMetadata(): Promise<ImageSourceMetadata>;
|
|
24
|
+
getImage(parameters: GetImageParameters): Promise<ImageType>;
|
|
25
|
+
/** Break up bounding box in east, north, south, west */
|
|
26
|
+
protected getGranularParameters(parameters: GetImageParameters): Record<string, unknown>;
|
|
27
|
+
/** Supports both ${} and {} notations */
|
|
28
|
+
protected getURLFromTemplate(parameters: Record<string, unknown>): string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Gets the current fetch function from options
|
|
32
|
+
* @todo - move to loader-utils module
|
|
33
|
+
* @todo - use in core module counterpart
|
|
34
|
+
* @param options
|
|
35
|
+
* @param context
|
|
36
|
+
*/
|
|
37
|
+
export declare function getFetchFunction(options?: LoaderOptions): (url: string, fetchOptions?: RequestInit) => Promise<Response>;
|
|
38
|
+
export declare function mergeImageServiceProps(props: ImageServiceProps): Required<ImageServiceProps>;
|
|
39
|
+
//# sourceMappingURL=image-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-service.d.ts","sourceRoot":"","sources":["../../../../src/lib/data-sources/image-services/image-service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,aAAa,EAAC,MAAM,0BAA0B,CAAC;AACvD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAGlD,OAAO,KAAK,EAAC,mBAAmB,EAAE,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAE5C,mFAAmF;AACnF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,8BAA8B;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,gFAAgF;IAChF,WAAW,CAAC,EAAE,aAAa,CAAC;CAC7B,CAAC;AAEF;;;;GAIG;AACH,qBAAa,YAAa,SAAQ,WAAW;IAC3C,MAAM,CAAC,IAAI,EAAE,UAAU,CAAc;IACrC,MAAM,CAAC,OAAO,QAAS,MAAM,KAAG,OAAO,CAAoC;IAE3E,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,CAAC;IACnC,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;gBAErD,KAAK,EAAE,iBAAiB;IAQ9B,WAAW,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAI3C,QAAQ,CAAC,UAAU,EAAE,kBAAkB,GAAG,OAAO,CAAC,SAAS,CAAC;IAUlE,wDAAwD;IACxD,SAAS,CAAC,qBAAqB,CAAC,UAAU,EAAE,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAKxF,yCAAyC;IACzC,SAAS,CAAC,kBAAkB,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM;CAU1E;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,CAAC,EAAE,aAAa,SAKvC,MAAM,iBAAiB,WAAW,uBAWlD;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,iBAAiB,GAAG,QAAQ,CAAC,iBAAiB,CAAC,CAS5F"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// loaders.gl, MIT license
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.mergeImageServiceProps = exports.getFetchFunction = exports.ImageService = void 0;
|
|
5
|
+
const images_1 = require("@loaders.gl/images");
|
|
6
|
+
const image_source_1 = require("../image-source");
|
|
7
|
+
/**
|
|
8
|
+
* Quickly connect to "ad hoc" image sources without subclassing ImageSource.
|
|
9
|
+
* ImageSource allows template url strings to be used to ad hoc connect to arbitrary image data sources
|
|
10
|
+
* Accepts a template url string and builds requests URLs
|
|
11
|
+
*/
|
|
12
|
+
class ImageService extends image_source_1.ImageSource {
|
|
13
|
+
constructor(props) {
|
|
14
|
+
super();
|
|
15
|
+
this.props = mergeImageServiceProps(props);
|
|
16
|
+
this.fetch = getFetchFunction(props);
|
|
17
|
+
}
|
|
18
|
+
// IMAGE SOURCE API
|
|
19
|
+
async getMetadata() {
|
|
20
|
+
throw new Error('ImageSource.getMetadata not implemented');
|
|
21
|
+
}
|
|
22
|
+
async getImage(parameters) {
|
|
23
|
+
const granularParameters = this.getGranularParameters(parameters);
|
|
24
|
+
const url = this.getURLFromTemplate(granularParameters);
|
|
25
|
+
const response = await this.fetch(url);
|
|
26
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
27
|
+
return await images_1.ImageLoader.parse(arrayBuffer);
|
|
28
|
+
}
|
|
29
|
+
// HELPERS
|
|
30
|
+
/** Break up bounding box in east, north, south, west */
|
|
31
|
+
getGranularParameters(parameters) {
|
|
32
|
+
const [east, north, west, south] = parameters.bbox;
|
|
33
|
+
return { ...parameters, east, north, south, west };
|
|
34
|
+
}
|
|
35
|
+
/** Supports both ${} and {} notations */
|
|
36
|
+
getURLFromTemplate(parameters) {
|
|
37
|
+
let url = this.props.url;
|
|
38
|
+
for (const [key, value] of Object.entries(parameters)) {
|
|
39
|
+
// TODO - parameter could be repeated
|
|
40
|
+
// const regex = new RegExp(`\${${key}}`, 'g');
|
|
41
|
+
url = url.replace(`\${${key}}`, String(value));
|
|
42
|
+
url = url.replace(`{${key}}`, String(value));
|
|
43
|
+
}
|
|
44
|
+
return url;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.ImageService = ImageService;
|
|
48
|
+
ImageService.type = 'template';
|
|
49
|
+
ImageService.testURL = (url) => url.toLowerCase().includes('{');
|
|
50
|
+
/**
|
|
51
|
+
* Gets the current fetch function from options
|
|
52
|
+
* @todo - move to loader-utils module
|
|
53
|
+
* @todo - use in core module counterpart
|
|
54
|
+
* @param options
|
|
55
|
+
* @param context
|
|
56
|
+
*/
|
|
57
|
+
function getFetchFunction(options) {
|
|
58
|
+
const fetchFunction = options?.fetch;
|
|
59
|
+
// options.fetch can be a function
|
|
60
|
+
if (fetchFunction && typeof fetchFunction === 'function') {
|
|
61
|
+
return (url, fetchOptions) => fetchFunction(url, fetchOptions);
|
|
62
|
+
}
|
|
63
|
+
// options.fetch can be an options object, use global fetch with those options
|
|
64
|
+
const fetchOptions = options?.fetch;
|
|
65
|
+
if (fetchOptions && typeof fetchOptions !== 'function') {
|
|
66
|
+
return (url) => fetch(url, fetchOptions);
|
|
67
|
+
}
|
|
68
|
+
// else return the global fetch function
|
|
69
|
+
return (url) => fetch(url);
|
|
70
|
+
}
|
|
71
|
+
exports.getFetchFunction = getFetchFunction;
|
|
72
|
+
function mergeImageServiceProps(props) {
|
|
73
|
+
return {
|
|
74
|
+
// Default fetch
|
|
75
|
+
...props,
|
|
76
|
+
loadOptions: {
|
|
77
|
+
...props.loadOptions,
|
|
78
|
+
fetch: getFetchFunction(props.loadOptions)
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
exports.mergeImageServiceProps = mergeImageServiceProps;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { ImageType } from '@loaders.gl/images';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import type { WMSCapabilities, WMSFeatureInfo, WMSLayerDescription } from '
|
|
6
|
-
type FetchLike = (url: string, options?: RequestInit) => Promise<Response>;
|
|
2
|
+
import type { ImageSourceMetadata, GetImageParameters } from '../image-source';
|
|
3
|
+
import { ImageSource } from '../image-source';
|
|
4
|
+
import { ImageServiceProps } from './image-service';
|
|
5
|
+
import type { WMSCapabilities, WMSFeatureInfo, WMSLayerDescription } from '../../wms/wms-types';
|
|
7
6
|
type WMSCommonParameters = {
|
|
8
7
|
/** In case the endpoint supports multiple services */
|
|
9
8
|
service?: 'WMS';
|
|
@@ -42,7 +41,7 @@ export type WMSGetFeatureInfoParameters = WMSCommonParameters & {
|
|
|
42
41
|
/** list of layers to query (could be different from rendered layers) */
|
|
43
42
|
query_layers: string[];
|
|
44
43
|
/** MIME type of returned feature info */
|
|
45
|
-
info_format?: 'text/plain';
|
|
44
|
+
info_format?: 'text/plain' | 'application/vnd.ogc.gml';
|
|
46
45
|
/** Layers to render */
|
|
47
46
|
layers: string[];
|
|
48
47
|
/** Styling */
|
|
@@ -66,15 +65,6 @@ export type WMSGetLegendGraphicParameters = WMSCommonParameters & {
|
|
|
66
65
|
/** Request type */
|
|
67
66
|
request?: 'GetLegendGraphic';
|
|
68
67
|
};
|
|
69
|
-
/** Properties that can be specified when creating a new WMS service */
|
|
70
|
-
export type WMSServiceProps = {
|
|
71
|
-
/** Base URL to the service */
|
|
72
|
-
serviceUrl: string;
|
|
73
|
-
/** Any load options to the loaders.gl Loaders used by the WMSService methods */
|
|
74
|
-
loadOptions?: LoaderOptions;
|
|
75
|
-
/** Override the fetch function if required */
|
|
76
|
-
fetch?: typeof fetch | FetchLike;
|
|
77
|
-
};
|
|
78
68
|
/**
|
|
79
69
|
* The WMSService class provides
|
|
80
70
|
* - provides type safe methods to form URLs to a WMS service
|
|
@@ -83,9 +73,11 @@ export type WMSServiceProps = {
|
|
|
83
73
|
* @note Only the URL parameter conversion is supported. XML posts are not supported.
|
|
84
74
|
*/
|
|
85
75
|
export declare class WMSService extends ImageSource {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
76
|
+
static type: 'wms';
|
|
77
|
+
static testURL: (url: string) => boolean;
|
|
78
|
+
props: Required<ImageServiceProps>;
|
|
79
|
+
fetch: (url: string, options?: RequestInit) => Promise<Response>;
|
|
80
|
+
capabilities: WMSCapabilities | null;
|
|
89
81
|
/** A list of loaders used by the WMSService methods */
|
|
90
82
|
readonly loaders: ({
|
|
91
83
|
id: string;
|
|
@@ -101,9 +93,9 @@ export declare class WMSService extends ImageSource {
|
|
|
101
93
|
throwOnError: boolean;
|
|
102
94
|
};
|
|
103
95
|
};
|
|
104
|
-
parse: (arrayBuffer: ArrayBuffer, options?: import("
|
|
105
|
-
parseSync: (arrayBuffer: ArrayBuffer, options?: import("
|
|
106
|
-
parseTextSync: (text: string, options?: import("
|
|
96
|
+
parse: (arrayBuffer: ArrayBuffer, options?: import("../../../wms-error-loader").WMSLoaderOptions | undefined) => Promise<string>;
|
|
97
|
+
parseSync: (arrayBuffer: ArrayBuffer, options?: import("../../../wms-error-loader").WMSLoaderOptions | undefined) => string;
|
|
98
|
+
parseTextSync: (text: string, options?: import("../../../wms-error-loader").WMSLoaderOptions | undefined) => string;
|
|
107
99
|
} | {
|
|
108
100
|
id: string;
|
|
109
101
|
name: string;
|
|
@@ -116,13 +108,24 @@ export declare class WMSService extends ImageSource {
|
|
|
116
108
|
options: {
|
|
117
109
|
wms: {};
|
|
118
110
|
};
|
|
119
|
-
|
|
120
|
-
|
|
111
|
+
/** In case the endpoint supports multiple services */
|
|
112
|
+
parse: (arrayBuffer: ArrayBuffer, options?: import("../../../wms-capabilities-loader").WMSLoaderOptions | undefined) => Promise<WMSCapabilities>;
|
|
113
|
+
parseTextSync: (text: string, options?: import("../../../wms-capabilities-loader").WMSLoaderOptions | undefined) => WMSCapabilities;
|
|
114
|
+
} | {
|
|
115
|
+
id: string;
|
|
116
|
+
module: string;
|
|
117
|
+
name: string;
|
|
118
|
+
version: any;
|
|
119
|
+
mimeTypes: string[];
|
|
120
|
+
extensions: string[];
|
|
121
|
+
parse: typeof import("modules/images/src/lib/parsers/parse-image").default;
|
|
122
|
+
tests: ((arrayBuffer: any) => boolean)[];
|
|
123
|
+
options: import("@loaders.gl/images").ImageLoaderOptions;
|
|
121
124
|
} | {
|
|
122
125
|
id: string;
|
|
123
126
|
name: string;
|
|
124
|
-
parse: (arrayBuffer: ArrayBuffer, options?: import("
|
|
125
|
-
parseTextSync: (text: string, options?: import("
|
|
127
|
+
parse: (arrayBuffer: ArrayBuffer, options?: import("../../../wms-capabilities-loader").WMSLoaderOptions | undefined) => Promise<WMSFeatureInfo>;
|
|
128
|
+
parseTextSync: (text: string, options?: import("../../../wms-capabilities-loader").WMSLoaderOptions | undefined) => WMSFeatureInfo;
|
|
126
129
|
module: string;
|
|
127
130
|
version: any;
|
|
128
131
|
worker: boolean;
|
|
@@ -135,8 +138,8 @@ export declare class WMSService extends ImageSource {
|
|
|
135
138
|
} | {
|
|
136
139
|
id: string;
|
|
137
140
|
name: string;
|
|
138
|
-
parse: (arrayBuffer: ArrayBuffer, options?: import("
|
|
139
|
-
parseTextSync: (text: string, options?: import("
|
|
141
|
+
parse: (arrayBuffer: ArrayBuffer, options?: import("../../../wms-capabilities-loader").WMSLoaderOptions | undefined) => Promise<WMSLayerDescription>;
|
|
142
|
+
parseTextSync: (text: string, options?: import("../../../wms-capabilities-loader").WMSLoaderOptions | undefined) => WMSLayerDescription;
|
|
140
143
|
module: string;
|
|
141
144
|
version: any;
|
|
142
145
|
worker: boolean;
|
|
@@ -146,19 +149,9 @@ export declare class WMSService extends ImageSource {
|
|
|
146
149
|
options: {
|
|
147
150
|
wms: {};
|
|
148
151
|
};
|
|
149
|
-
} | {
|
|
150
|
-
id: string;
|
|
151
|
-
module: string;
|
|
152
|
-
name: string;
|
|
153
|
-
version: any;
|
|
154
|
-
mimeTypes: string[];
|
|
155
|
-
extensions: string[];
|
|
156
|
-
parse: typeof import("modules/images/src/lib/parsers/parse-image").default;
|
|
157
|
-
tests: ((arrayBuffer: any) => boolean)[];
|
|
158
|
-
options: import("@loaders.gl/images").ImageLoaderOptions;
|
|
159
152
|
})[];
|
|
160
153
|
/** Create a WMSService */
|
|
161
|
-
constructor(props:
|
|
154
|
+
constructor(props: ImageServiceProps);
|
|
162
155
|
getMetadata(): Promise<ImageSourceMetadata>;
|
|
163
156
|
getImage(parameters: GetImageParameters): Promise<ImageType>;
|
|
164
157
|
/** Get Capabilities */
|
|
@@ -167,6 +160,8 @@ export declare class WMSService extends ImageSource {
|
|
|
167
160
|
getMap(options: WMSGetMapParameters, vendorParameters?: Record<string, unknown>): Promise<ImageType>;
|
|
168
161
|
/** Get Feature Info for a coordinate */
|
|
169
162
|
getFeatureInfo(options: WMSGetFeatureInfoParameters, vendorParameters?: Record<string, unknown>): Promise<WMSFeatureInfo>;
|
|
163
|
+
/** Get Feature Info for a coordinate */
|
|
164
|
+
getFeatureInfoText(options: WMSGetFeatureInfoParameters, vendorParameters?: Record<string, unknown>): Promise<string>;
|
|
170
165
|
/** Get more information about a layer */
|
|
171
166
|
describeLayer(options: WMSDescribeLayerParameters, vendorParameters?: Record<string, unknown>): Promise<WMSLayerDescription>;
|
|
172
167
|
/** Get an image with a semantic legend */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wms-service.d.ts","sourceRoot":"","sources":["../../../../src/lib/data-sources/image-services/wms-service.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,SAAS,E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AAS,CACP,aAAa,EAAE,mBAAmB,EAClC,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACzC,MAAM;IAkBT,oDAAoD;IACpD,iBAAiB,CACf,aAAa,EAAE,2BAA2B,EAC1C,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACzC,MAAM;IAsBT,oDAAoD;IACpD,gBAAgB,CACd,aAAa,EAAE,0BAA0B,EACzC,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACzC,MAAM;IAWT,mBAAmB,CACjB,aAAa,EAAE,6BAA6B,EAC5C,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACzC,MAAM;IAaT;;SAEK;IACL,SAAS,CAAC,UAAU,CAClB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACzC,MAAM;IAeT,qFAAqF;IACrF,SAAS,CAAC,cAAc,CAAC,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,GAAG,IAAI;IAQ5E,+BAA+B;IAC/B,SAAS,CAAC,WAAW,CAAC,WAAW,EAAE,WAAW,GAAG,KAAK;CAIvD"}
|
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.WMSService = void 0;
|
|
5
5
|
const images_1 = require("@loaders.gl/images");
|
|
6
|
-
const image_source_1 = require("
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
6
|
+
const image_source_1 = require("../image-source");
|
|
7
|
+
const image_service_1 = require("./image-service");
|
|
8
|
+
const wms_capabilities_loader_1 = require("../../../wms-capabilities-loader");
|
|
9
|
+
const wms_feature_info_loader_1 = require("../../../wip/wms-feature-info-loader");
|
|
10
|
+
const wms_layer_description_loader_1 = require("../../../wip/wms-layer-description-loader");
|
|
11
|
+
const wms_error_loader_1 = require("../../../wms-error-loader");
|
|
11
12
|
/**
|
|
12
13
|
* The WMSService class provides
|
|
13
14
|
* - provides type safe methods to form URLs to a WMS service
|
|
@@ -19,10 +20,7 @@ class WMSService extends image_source_1.ImageSource {
|
|
|
19
20
|
/** Create a WMSService */
|
|
20
21
|
constructor(props) {
|
|
21
22
|
super();
|
|
22
|
-
this.
|
|
23
|
-
// We want error responses to throw exceptions, the WMSErrorLoader can do this
|
|
24
|
-
wms: { throwOnError: true }
|
|
25
|
-
};
|
|
23
|
+
this.capabilities = null;
|
|
26
24
|
/** A list of loaders used by the WMSService methods */
|
|
27
25
|
this.loaders = [
|
|
28
26
|
images_1.ImageLoader,
|
|
@@ -31,10 +29,13 @@ class WMSService extends image_source_1.ImageSource {
|
|
|
31
29
|
wms_feature_info_loader_1.WMSFeatureInfoLoader,
|
|
32
30
|
wms_layer_description_loader_1.WMSLayerDescriptionLoader
|
|
33
31
|
];
|
|
34
|
-
this.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
this.props = (0, image_service_1.mergeImageServiceProps)(props);
|
|
33
|
+
this.fetch = (0, image_service_1.getFetchFunction)(this.props);
|
|
34
|
+
this.props.loadOptions = {
|
|
35
|
+
...this.props.loadOptions,
|
|
36
|
+
// We want error responses to throw exceptions, the WMSErrorLoader can do this
|
|
37
|
+
wms: { ...this.props.loadOptions?.wms, throwOnError: true }
|
|
38
|
+
};
|
|
38
39
|
}
|
|
39
40
|
// ImageSource implementation
|
|
40
41
|
getMetadata() {
|
|
@@ -47,21 +48,21 @@ class WMSService extends image_source_1.ImageSource {
|
|
|
47
48
|
/** Get Capabilities */
|
|
48
49
|
async getCapabilities(wmsParameters, vendorParameters) {
|
|
49
50
|
const url = this.getCapabilitiesURL(wmsParameters, vendorParameters);
|
|
50
|
-
const
|
|
51
|
-
const response = await fetch(url, this.loadOptions);
|
|
51
|
+
const response = await this.fetch(url);
|
|
52
52
|
const arrayBuffer = await response.arrayBuffer();
|
|
53
53
|
this._checkResponse(response, arrayBuffer);
|
|
54
|
-
|
|
54
|
+
const capabilities = await wms_capabilities_loader_1.WMSCapabilitiesLoader.parse(arrayBuffer, this.props.loadOptions);
|
|
55
|
+
this.capabilities = capabilities;
|
|
56
|
+
return capabilities;
|
|
55
57
|
}
|
|
56
58
|
/** Get a map image */
|
|
57
59
|
async getMap(options, vendorParameters) {
|
|
58
60
|
const url = this.getMapURL(options, vendorParameters);
|
|
59
|
-
const
|
|
60
|
-
const response = await fetch(url, this.loadOptions);
|
|
61
|
+
const response = await this.fetch(url);
|
|
61
62
|
const arrayBuffer = await response.arrayBuffer();
|
|
62
63
|
this._checkResponse(response, arrayBuffer);
|
|
63
64
|
try {
|
|
64
|
-
return await images_1.ImageLoader.parse(arrayBuffer, this.loadOptions);
|
|
65
|
+
return await images_1.ImageLoader.parse(arrayBuffer, this.props.loadOptions);
|
|
65
66
|
}
|
|
66
67
|
catch {
|
|
67
68
|
throw this._parseError(arrayBuffer);
|
|
@@ -70,27 +71,36 @@ class WMSService extends image_source_1.ImageSource {
|
|
|
70
71
|
/** Get Feature Info for a coordinate */
|
|
71
72
|
async getFeatureInfo(options, vendorParameters) {
|
|
72
73
|
const url = this.getFeatureInfoURL(options, vendorParameters);
|
|
73
|
-
const response = await this.fetch(url
|
|
74
|
+
const response = await this.fetch(url);
|
|
75
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
76
|
+
this._checkResponse(response, arrayBuffer);
|
|
77
|
+
return await wms_feature_info_loader_1.WMSFeatureInfoLoader.parse(arrayBuffer, this.props.loadOptions);
|
|
78
|
+
}
|
|
79
|
+
/** Get Feature Info for a coordinate */
|
|
80
|
+
async getFeatureInfoText(options, vendorParameters) {
|
|
81
|
+
options = { ...options, info_format: 'text/plain' };
|
|
82
|
+
const url = this.getFeatureInfoURL(options, vendorParameters);
|
|
83
|
+
const response = await this.fetch(url);
|
|
74
84
|
const arrayBuffer = await response.arrayBuffer();
|
|
75
85
|
this._checkResponse(response, arrayBuffer);
|
|
76
|
-
return
|
|
86
|
+
return new TextDecoder().decode(arrayBuffer);
|
|
77
87
|
}
|
|
78
88
|
/** Get more information about a layer */
|
|
79
89
|
async describeLayer(options, vendorParameters) {
|
|
80
90
|
const url = this.describeLayerURL(options, vendorParameters);
|
|
81
|
-
const response = await this.fetch(url
|
|
91
|
+
const response = await this.fetch(url);
|
|
82
92
|
const arrayBuffer = await response.arrayBuffer();
|
|
83
93
|
this._checkResponse(response, arrayBuffer);
|
|
84
|
-
return await wms_layer_description_loader_1.WMSLayerDescriptionLoader.parse(arrayBuffer, this.loadOptions);
|
|
94
|
+
return await wms_layer_description_loader_1.WMSLayerDescriptionLoader.parse(arrayBuffer, this.props.loadOptions);
|
|
85
95
|
}
|
|
86
96
|
/** Get an image with a semantic legend */
|
|
87
97
|
async getLegendGraphic(options, vendorParameters) {
|
|
88
98
|
const url = this.getLegendGraphicURL(options, vendorParameters);
|
|
89
|
-
const response = await this.fetch(url
|
|
99
|
+
const response = await this.fetch(url);
|
|
90
100
|
const arrayBuffer = await response.arrayBuffer();
|
|
91
101
|
this._checkResponse(response, arrayBuffer);
|
|
92
102
|
try {
|
|
93
|
-
return await images_1.ImageLoader.parse(arrayBuffer, this.loadOptions);
|
|
103
|
+
return await images_1.ImageLoader.parse(arrayBuffer, this.props.loadOptions);
|
|
94
104
|
}
|
|
95
105
|
catch {
|
|
96
106
|
throw this._parseError(arrayBuffer);
|
|
@@ -175,7 +185,7 @@ class WMSService extends image_source_1.ImageSource {
|
|
|
175
185
|
* @note case _getWMSUrl may need to be overridden to handle certain backends?
|
|
176
186
|
* */
|
|
177
187
|
_getWMSUrl(options, vendorParameters) {
|
|
178
|
-
let url =
|
|
188
|
+
let url = this.props.url;
|
|
179
189
|
let first = true;
|
|
180
190
|
for (const [key, value] of Object.entries(options)) {
|
|
181
191
|
url += first ? '?' : '&';
|
|
@@ -193,14 +203,16 @@ class WMSService extends image_source_1.ImageSource {
|
|
|
193
203
|
_checkResponse(response, arrayBuffer) {
|
|
194
204
|
const contentType = response.headers['content-type'];
|
|
195
205
|
if (!response.ok || wms_error_loader_1.WMSErrorLoader.mimeTypes.includes(contentType)) {
|
|
196
|
-
const error = wms_error_loader_1.WMSErrorLoader.parseSync(arrayBuffer, this.loadOptions);
|
|
206
|
+
const error = wms_error_loader_1.WMSErrorLoader.parseSync(arrayBuffer, this.props.loadOptions);
|
|
197
207
|
throw new Error(error);
|
|
198
208
|
}
|
|
199
209
|
}
|
|
200
210
|
/** Error situation detected */
|
|
201
211
|
_parseError(arrayBuffer) {
|
|
202
|
-
const error = wms_error_loader_1.WMSErrorLoader.parseSync(arrayBuffer, this.loadOptions);
|
|
212
|
+
const error = wms_error_loader_1.WMSErrorLoader.parseSync(arrayBuffer, this.props.loadOptions);
|
|
203
213
|
return new Error(error);
|
|
204
214
|
}
|
|
205
215
|
}
|
|
206
216
|
exports.WMSService = WMSService;
|
|
217
|
+
WMSService.type = 'wms';
|
|
218
|
+
WMSService.testURL = (url) => url.toLowerCase().includes('wms');
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { LoaderOptions } from '@loaders.gl/loader-utils';
|
|
2
|
+
type FetchLike = (url: string, options?: RequestInit) => Promise<Response>;
|
|
3
|
+
export type ArcGISImageServiceQueryOptions = {
|
|
4
|
+
returnGeometry: boolean;
|
|
5
|
+
where: '1%3D1';
|
|
6
|
+
outSR: 4326;
|
|
7
|
+
outFields: string | '*';
|
|
8
|
+
inSR: 4326;
|
|
9
|
+
geometry: `${-90}%2C+${30}%2C+${-70}%2C+${50}`;
|
|
10
|
+
geometryType: 'esriGeometryEnvelope';
|
|
11
|
+
spatialRel: 'esriSpatialRelIntersects';
|
|
12
|
+
geometryPrecision: number;
|
|
13
|
+
resultType: 'tile';
|
|
14
|
+
f?: 'geojson';
|
|
15
|
+
};
|
|
16
|
+
export type ArcGISFeatureServiceProps = ArcGISImageServiceQueryOptions & {
|
|
17
|
+
url: string;
|
|
18
|
+
loadOptions?: LoaderOptions;
|
|
19
|
+
fetch?: typeof fetch | FetchLike;
|
|
20
|
+
};
|
|
21
|
+
export declare class ArcGISFeatureService {
|
|
22
|
+
url: string;
|
|
23
|
+
loadOptions: LoaderOptions;
|
|
24
|
+
fetch: typeof fetch | FetchLike;
|
|
25
|
+
constructor(props: ArcGISFeatureServiceProps);
|
|
26
|
+
metadataURL(options: {
|
|
27
|
+
parameters?: Record<string, unknown>;
|
|
28
|
+
}): string;
|
|
29
|
+
/**
|
|
30
|
+
* Form a URL to an ESRI FeatureServer
|
|
31
|
+
// https://services2.arcgis.com/CcI36Pduqd0OR4W9/ArcGIS/rest/services/Bicycle_Routes_Public/FeatureServer/0/query?
|
|
32
|
+
// returnGeometry=true&where=1%3D1&outSR=4326&outFields=*&inSR=4326&geometry=${-90}%2C+${30}%2C+${-70}%2C+${50}&
|
|
33
|
+
// geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&geometryPrecision=6&resultType=tile&f=geojson`
|
|
34
|
+
*/
|
|
35
|
+
exportImageURL(options: {
|
|
36
|
+
boundingBox: [number, number, number, number];
|
|
37
|
+
boundingBoxSR?: string;
|
|
38
|
+
width: number;
|
|
39
|
+
height: number;
|
|
40
|
+
imageSR?: string;
|
|
41
|
+
time?: never;
|
|
42
|
+
f?: 'geojson';
|
|
43
|
+
resultType?: 'tile';
|
|
44
|
+
noData?: never;
|
|
45
|
+
noDataInterpretation?: 'esriNoDataMatchAny';
|
|
46
|
+
interpolation?: '+RSP_NearestNeighbor';
|
|
47
|
+
compression?: never;
|
|
48
|
+
compressionQuality?: never;
|
|
49
|
+
bandIds?: never;
|
|
50
|
+
mosaicRule?: never;
|
|
51
|
+
renderingRule?: never;
|
|
52
|
+
f?: 'image';
|
|
53
|
+
}): string;
|
|
54
|
+
}
|
|
55
|
+
export {};
|
|
56
|
+
//# sourceMappingURL=arcgis-feature-service.d.ts.map
|
|
@@ -0,0 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AAO,EAAE;QACtB,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAC9C,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,KAAK,CAAC;QACb,CAAC,CAAC,EAAE,SAAS,CAAC;QACd,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,MAAM,CAAC,EAAE,KAAK,CAAC;QACf,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;QAC5C,aAAa,CAAC,EAAE,sBAAsB,CAAC;QACvC,WAAW,CAAC,EAAE,KAAK,CAAA;QACnB,kBAAkB,CAAC,EAAE,KAAK,CAAC;QAC3B,OAAO,CAAC,EAAE,KAAK,CAAC;QAChB,UAAU,CAAC,EAAE,KAAK,CAAC;QACnB,aAAa,CAAC,EAAE,KAAK,CAAC;QACtB,CAAC,CAAC,EAAE,OAAO,CAAC;KACb,GAAG,MAAM;CAMX"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ArcGISFeatureService = void 0;
|
|
5
|
+
class ArcGISFeatureService {
|
|
6
|
+
constructor(props) {
|
|
7
|
+
this.url = props.url;
|
|
8
|
+
this.loadOptions = props.loadOptions || {};
|
|
9
|
+
this.fetch = props.fetch || fetch;
|
|
10
|
+
}
|
|
11
|
+
// URL creators
|
|
12
|
+
metadataURL(options) {
|
|
13
|
+
return this.getUrl({ ...options });
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Form a URL to an ESRI FeatureServer
|
|
17
|
+
// https://services2.arcgis.com/CcI36Pduqd0OR4W9/ArcGIS/rest/services/Bicycle_Routes_Public/FeatureServer/0/query?
|
|
18
|
+
// returnGeometry=true&where=1%3D1&outSR=4326&outFields=*&inSR=4326&geometry=${-90}%2C+${30}%2C+${-70}%2C+${50}&
|
|
19
|
+
// geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&geometryPrecision=6&resultType=tile&f=geojson`
|
|
20
|
+
*/
|
|
21
|
+
exportImageURL(options) {
|
|
22
|
+
const { boundingBox } = options;
|
|
23
|
+
// const bbox = `bbox=${boundingBox[0]},${boundingBox[1]},${boundingBox[2]},${boundingBox[3]}`;
|
|
24
|
+
// const size = `size=${width},${height}`
|
|
25
|
+
return this.getUrl({ path: 'exportImage', });
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.ArcGISFeatureService = ArcGISFeatureService;
|
|
@@ -2,19 +2,6 @@
|
|
|
2
2
|
/** Data source that serves data by tile index *
|
|
3
3
|
export abstract class TileDataSource extends DataSource {};
|
|
4
4
|
|
|
5
|
-
// Vector Tile Source
|
|
6
|
-
|
|
7
|
-
export type VectorTileDataSourceCapabilities = {
|
|
8
|
-
// check tile.json
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export type VectorTile = Record<string, any>;
|
|
12
|
-
|
|
13
|
-
export abstract class VectorTileDataSource extends TileDataSource {
|
|
14
|
-
abstract getCapabilities(): Promise<VectorTileDataSourceCapabilities>;
|
|
15
|
-
abstract getTile({x, y, z, width, height, layers, parameters}): Promise<VectorTile>;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
5
|
// Image Tile Data Source
|
|
19
6
|
|
|
20
7
|
export type ImageTileDataSourceCapabilities = {
|
|
@@ -49,5 +36,19 @@ export abstract class ImageTileDataSource extends TileDataSource {
|
|
|
49
36
|
return [0, 0, 1, 1];
|
|
50
37
|
}
|
|
51
38
|
}
|
|
39
|
+
|
|
40
|
+
// Vector Tile Source
|
|
41
|
+
|
|
42
|
+
export type VectorTileDataSourceCapabilities = {
|
|
43
|
+
// check tile.json
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export type VectorTile = Record<string, any>;
|
|
47
|
+
|
|
48
|
+
export abstract class VectorTileDataSource extends TileDataSource {
|
|
49
|
+
abstract getCapabilities(): Promise<VectorTileDataSourceCapabilities>;
|
|
50
|
+
abstract getTile({x, y, z, width, height, layers, parameters}): Promise<VectorTile>;
|
|
51
|
+
}
|
|
52
|
+
|
|
52
53
|
*/
|
|
53
54
|
//# sourceMappingURL=data-source.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-source.d.ts","sourceRoot":"","sources":["../../src/wip/data-source.ts"],"names":[],"mappings":"AAEA,gCAAgC;
|
|
1
|
+
{"version":3,"file":"data-source.d.ts","sourceRoot":"","sources":["../../src/wip/data-source.ts"],"names":[],"mappings":"AAEA,gCAAgC;AAQhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmDE"}
|