@loaders.gl/wms 4.0.0 → 4.0.2
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/index.cjs +13 -1
- package/dist/lib/services/image-service.d.ts +1 -1
- package/dist/lib/services/image-service.d.ts.map +1 -1
- package/dist/lib/services/image-service.js +1 -1
- package/dist/lib/services/image-service.js.map +1 -1
- package/dist/services/arcgis/arcgis-image-service.d.ts +1 -0
- package/dist/services/arcgis/arcgis-image-service.d.ts.map +1 -1
- package/dist/services/arcgis/arcgis-image-service.js +2 -0
- package/dist/services/arcgis/arcgis-image-service.js.map +1 -1
- package/dist/services/ogc/csw-service.d.ts +2 -0
- package/dist/services/ogc/csw-service.d.ts.map +1 -1
- package/dist/services/ogc/csw-service.js +4 -0
- package/dist/services/ogc/csw-service.js.map +1 -1
- package/dist/services/ogc/wms-service.d.ts +3 -12
- package/dist/services/ogc/wms-service.d.ts.map +1 -1
- package/dist/services/ogc/wms-service.js +10 -0
- package/dist/services/ogc/wms-service.js.map +1 -1
- package/package.json +6 -6
- package/src/lib/services/image-service.ts +2 -2
- package/src/services/arcgis/arcgis-image-service.ts +3 -0
- package/src/services/ogc/csw-service.ts +4 -0
- package/src/services/ogc/wms-service.ts +27 -12
package/dist/index.cjs
CHANGED
|
@@ -1065,6 +1065,7 @@ var WMSSource = class extends import_loader_utils2.ImageSource {
|
|
|
1065
1065
|
super(props);
|
|
1066
1066
|
this.capabilities = null;
|
|
1067
1067
|
this.url = props.url;
|
|
1068
|
+
this.data = props.url;
|
|
1068
1069
|
this.substituteCRS84 = props.substituteCRS84 ?? false;
|
|
1069
1070
|
this.flipCRS = ["EPSG:4326"];
|
|
1070
1071
|
this.wmsParameters = {
|
|
@@ -1278,6 +1279,14 @@ var WMSSource = class extends import_loader_utils2.ImageSource {
|
|
|
1278
1279
|
key = "crs";
|
|
1279
1280
|
}
|
|
1280
1281
|
break;
|
|
1282
|
+
case "boundingBox":
|
|
1283
|
+
const boundingBox = value;
|
|
1284
|
+
let bbox2 = [...boundingBox[0], ...boundingBox[1]];
|
|
1285
|
+
bbox2 = this._flipBoundingBox(boundingBox, wmsParameters);
|
|
1286
|
+
if (bbox2) {
|
|
1287
|
+
value = bbox2;
|
|
1288
|
+
}
|
|
1289
|
+
break;
|
|
1281
1290
|
case "bbox":
|
|
1282
1291
|
const bbox = this._flipBoundingBox(value, wmsParameters);
|
|
1283
1292
|
if (bbox) {
|
|
@@ -1351,7 +1360,7 @@ var ImageService = class extends import_loader_utils3.ImageSource {
|
|
|
1351
1360
|
// HELPERS
|
|
1352
1361
|
/** Break up bounding box in east, north, south, west */
|
|
1353
1362
|
getGranularParameters(parameters) {
|
|
1354
|
-
const [east, north, west, south] = parameters.
|
|
1363
|
+
const [[east, north], [west, south]] = parameters.boundingBox;
|
|
1355
1364
|
return { ...parameters, east, north, south, west };
|
|
1356
1365
|
}
|
|
1357
1366
|
/** Supports both ${} and {} notations */
|
|
@@ -1371,6 +1380,7 @@ ImageService.testURL = (url) => url.toLowerCase().includes("{");
|
|
|
1371
1380
|
var ArcGISImageSource = class extends ImageService {
|
|
1372
1381
|
constructor(props) {
|
|
1373
1382
|
super(props);
|
|
1383
|
+
this.data = props.url;
|
|
1374
1384
|
}
|
|
1375
1385
|
// ImageSource (normalized endpoints)
|
|
1376
1386
|
async getMetadata() {
|
|
@@ -1458,6 +1468,8 @@ var CSWService = class extends import_loader_utils4.DataSource {
|
|
|
1458
1468
|
this.capabilities = null;
|
|
1459
1469
|
/** A list of loaders used by the CSWService methods */
|
|
1460
1470
|
this.loaders = [WMSErrorLoader, CSWCapabilitiesLoader];
|
|
1471
|
+
this.url = props.url;
|
|
1472
|
+
this.data = props.url;
|
|
1461
1473
|
}
|
|
1462
1474
|
async getMetadata() {
|
|
1463
1475
|
const capabilities = await this.getCapabilities();
|
|
@@ -14,7 +14,7 @@ export type ImageServiceProps = {
|
|
|
14
14
|
* ImageSource allows template url strings to be used to ad hoc connect to arbitrary image data sources
|
|
15
15
|
* Accepts a template url string and builds requests URLs
|
|
16
16
|
*/
|
|
17
|
-
export declare class ImageService<PropsT extends ImageServiceProps = ImageServiceProps> extends ImageSource<PropsT> {
|
|
17
|
+
export declare abstract class ImageService<PropsT extends ImageServiceProps = ImageServiceProps> extends ImageSource<PropsT> {
|
|
18
18
|
static type: string;
|
|
19
19
|
static testURL: (url: string) => boolean;
|
|
20
20
|
constructor(props: PropsT);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-service.d.ts","sourceRoot":"","sources":["../../../src/lib/services/image-service.ts"],"names":[],"mappings":"AAGA,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,0BAA0B,CAAC;AACtF,OAAO,EAAC,WAAW,EAAC,MAAM,0BAA0B,CAAC;AAErD,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,
|
|
1
|
+
{"version":3,"file":"image-service.d.ts","sourceRoot":"","sources":["../../../src/lib/services/image-service.ts"],"names":[],"mappings":"AAGA,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,0BAA0B,CAAC;AACtF,OAAO,EAAC,WAAW,EAAC,MAAM,0BAA0B,CAAC;AAErD,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,8BAAsB,YAAY,CAChC,MAAM,SAAS,iBAAiB,GAAG,iBAAiB,CACpD,SAAQ,WAAW,CAAC,MAAM,CAAC;IAC3B,MAAM,CAAC,IAAI,EAAE,MAAM,CAAc;IACjC,MAAM,CAAC,OAAO,QAAS,MAAM,KAAG,OAAO,CAAoC;gBAE/D,KAAK,EAAE,MAAM;IAMnB,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"}
|
|
@@ -15,7 +15,7 @@ export class ImageService extends ImageSource {
|
|
|
15
15
|
return await ImageLoader.parse(arrayBuffer);
|
|
16
16
|
}
|
|
17
17
|
getGranularParameters(parameters) {
|
|
18
|
-
const [east, north, west, south] = parameters.
|
|
18
|
+
const [[east, north], [west, south]] = parameters.boundingBox;
|
|
19
19
|
return {
|
|
20
20
|
...parameters,
|
|
21
21
|
east,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-service.js","names":["ImageLoader","ImageSource","ImageService","constructor","props","getMetadata","Error","getImage","parameters","granularParameters","getGranularParameters","url","getURLFromTemplate","response","fetch","arrayBuffer","parse","east","north","west","south","
|
|
1
|
+
{"version":3,"file":"image-service.js","names":["ImageLoader","ImageSource","ImageService","constructor","props","getMetadata","Error","getImage","parameters","granularParameters","getGranularParameters","url","getURLFromTemplate","response","fetch","arrayBuffer","parse","east","north","west","south","boundingBox","key","value","Object","entries","replace","String","type","testURL","toLowerCase","includes"],"sources":["../../../src/lib/services/image-service.ts"],"sourcesContent":["// loaders.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport {LoaderOptions} from '@loaders.gl/loader-utils';\nimport type {ImageType} from '@loaders.gl/images';\nimport {ImageLoader} from '@loaders.gl/images';\n\nimport type {ImageSourceMetadata, GetImageParameters} from '@loaders.gl/loader-utils';\nimport {ImageSource} from '@loaders.gl/loader-utils';\n\n/** Template URL string should contain `${width}` etc which will be substituted. */\nexport type ImageServiceProps = {\n /** Base URL to the service */\n url: string;\n /** Any load options to the loaders.gl Loaders used by the WMSService methods */\n loadOptions?: LoaderOptions;\n};\n\n/**\n * Quickly connect to \"ad hoc\" image sources without subclassing ImageSource.\n * ImageSource allows template url strings to be used to ad hoc connect to arbitrary image data sources\n * Accepts a template url string and builds requests URLs\n */\nexport abstract class ImageService<\n PropsT extends ImageServiceProps = ImageServiceProps\n> extends ImageSource<PropsT> {\n static type: string = 'template';\n static testURL = (url: string): boolean => url.toLowerCase().includes('{');\n\n constructor(props: PropsT) {\n super(props);\n }\n\n // IMAGE SOURCE API\n\n async getMetadata(): Promise<ImageSourceMetadata> {\n throw new Error('ImageSource.getMetadata not implemented');\n }\n\n async getImage(parameters: GetImageParameters): Promise<ImageType> {\n const granularParameters = this.getGranularParameters(parameters);\n const url = this.getURLFromTemplate(granularParameters);\n const response = await this.fetch(url);\n const arrayBuffer = await response.arrayBuffer();\n return await ImageLoader.parse(arrayBuffer);\n }\n\n // HELPERS\n\n /** Break up bounding box in east, north, south, west */\n protected getGranularParameters(parameters: GetImageParameters): Record<string, unknown> {\n const [[east, north], [west, south]] = parameters.boundingBox;\n return {...parameters, east, north, south, west};\n }\n\n /** Supports both ${} and {} notations */\n protected getURLFromTemplate(parameters: Record<string, unknown>): string {\n let url = this.props.url;\n for (const [key, value] of Object.entries(parameters)) {\n // TODO - parameter could be repeated\n // const regex = new RegExp(`\\${${key}}`, 'g');\n url = url.replace(`\\${${key}}`, String(value));\n url = url.replace(`{${key}}`, String(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,GAAGA,GAAG,CAACe,OAAO,CAAE,IAAGJ,GAAI,GAAE,EAAEK,MAAM,CAACJ,KAAK,CAAC,CAAC;IAC9C;IACA,OAAOZ,GAAG;EACZ;AACF;AA3CsBT,YAAY,CAGzB0B,IAAI,GAAW,UAAU;AAHZ1B,YAAY,CAIzB2B,OAAO,GAAIlB,GAAW,IAAcA,GAAG,CAACmB,WAAW,CAAC,CAAC,CAACC,QAAQ,CAAC,GAAG,CAAC"}
|
|
@@ -11,6 +11,7 @@ export type ArcGISImageServerProps = ImageServiceProps & {
|
|
|
11
11
|
* @see https://developers.arcgis.com/rest/services-reference/enterprise/image-service.htm
|
|
12
12
|
*/
|
|
13
13
|
export declare class ArcGISImageSource extends ImageService<ArcGISImageServerProps> {
|
|
14
|
+
data: string;
|
|
14
15
|
constructor(props: ArcGISImageServerProps);
|
|
15
16
|
getMetadata(): Promise<ImageSourceMetadata>;
|
|
16
17
|
getImage(parameters: GetImageParameters): Promise<ImageType>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arcgis-image-service.d.ts","sourceRoot":"","sources":["../../../src/services/arcgis/arcgis-image-service.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAC7C,OAAO,KAAK,EAAC,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAC,MAAM,0BAA0B,CAAC;AAE/F,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAC,YAAY,EAAC,MAAM,kCAAkC,CAAC;AAK9D,MAAM,MAAM,sBAAsB,GAAG,iBAAiB,GAAG;IACvD,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF;;;;GAIG;AACH,qBAAa,iBAAkB,SAAQ,YAAY,CAAC,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"arcgis-image-service.d.ts","sourceRoot":"","sources":["../../../src/services/arcgis/arcgis-image-service.ts"],"names":[],"m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AAkB,EAAE,OAIhC,CAAC"}
|
|
@@ -2,6 +2,8 @@ import { ImageService } from "../../lib/services/image-service.js";
|
|
|
2
2
|
export class ArcGISImageSource extends ImageService {
|
|
3
3
|
constructor(props) {
|
|
4
4
|
super(props);
|
|
5
|
+
this.data = void 0;
|
|
6
|
+
this.data = props.url;
|
|
5
7
|
}
|
|
6
8
|
async getMetadata() {
|
|
7
9
|
return await this.metadata();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arcgis-image-service.js","names":["ImageService","ArcGISImageSource","constructor","props","getMetadata","metadata","getImage","parameters","Error","exportImage","options","metadataURL","
|
|
1
|
+
{"version":3,"file":"arcgis-image-service.js","names":["ImageService","ArcGISImageSource","constructor","props","data","url","getMetadata","metadata","getImage","parameters","Error","exportImage","options","metadataURL","exportImageURL","bbox","size","width","height","arcgisOptions","getUrl","path","extra","first","key","value","Object","entries","Array","isArray","toUpperCase","join","String","checkResponse","response","ok","ArcGISImageService","type","testURL","toLowerCase","includes","create"],"sources":["../../../src/services/arcgis/arcgis-image-service.ts"],"sourcesContent":["// loaders.gl, MIT license\n// Copyright (c) vis.gl contributors\n\nimport {ImageType} from '@loaders.gl/images';\nimport type {Service, ImageSourceMetadata, GetImageParameters} from '@loaders.gl/loader-utils';\n\nimport type {ImageServiceProps} from '../../lib/services/image-service';\nimport {ImageService} from '../../lib/services/image-service';\n\n// import type {ImageSourceProps} from '@loaders.gl/loader-utils';\n// import {ImageSource} from '@loaders.gl/loader-utils';\n\nexport type ArcGISImageServerProps = ImageServiceProps & {\n url: string;\n};\n\n/**\n * ArcGIS ImageServer\n * Note - exports a big API, that could be exposed here if there is a use case\n * @see https://developers.arcgis.com/rest/services-reference/enterprise/image-service.htm\n */\nexport class ArcGISImageSource extends ImageService<ArcGISImageServerProps> {\n data: string;\n\n constructor(props: ArcGISImageServerProps) {\n super(props);\n this.data = props.url;\n }\n\n // ImageSource (normalized endpoints)\n\n async getMetadata(): Promise<ImageSourceMetadata> {\n return (await this.metadata()) as ImageSourceMetadata;\n // TODO - normalize metadata\n }\n\n async getImage(parameters: GetImageParameters): Promise<ImageType> {\n throw new Error('not implemented');\n // TODO - Map generic parameters to ArcGIS specific parameters\n // return await this.exportImage(parameters);\n }\n\n // ImageServer endpoints\n\n async metadata(): Promise<unknown> {\n // We just need a JSON parsing...\n // return this.getUrl({path: '', ...options});\n throw new Error('not implemented');\n }\n\n /** \n * Form a URL to an ESRI ImageServer\n // 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`,\n */\n exportImage(options: {\n boundingBox: [number, number, number, number];\n boundingBoxSR?: string;\n width: number;\n height: number;\n imageSR?: string;\n time?: never;\n format?: 'jpgpng';\n pixelType?: 'U8';\n noData?: never;\n noDataInterpretation?: 'esriNoDataMatchAny';\n interpolation?: '+RSP_NearestNeighbor';\n compression?: never;\n compressionQuality?: never;\n bandIds?: never;\n mosaicRule?: never;\n renderingRule?: never;\n f?: 'image';\n }): Promise<ImageType> {\n // See WMSService.getMap()\n throw new Error('not implemented');\n }\n\n // URL creators\n\n metadataURL(options: {parameters?: Record<string, unknown>}): string {\n return `${this.props.url}?f=pjson`;\n }\n\n /** \n * Form a URL to an ESRI ImageServer\n // https://sampleserver6.arcgisonline.com/arcgis/rest/services/NLCDLandCover2001/ImageServer/exportImage?\n // bbox=${bounds[0]},${bounds[1]},${bounds[2]},${bounds[3]}&bboxSR=4326&\n // size=${width},${height}&imageSR=102100&time=&format=jpgpng&pixelType=U8&\n // noData=&noDataInterpretation=esriNoDataMatchAny&interpolation=+RSP_NearestNeighbor&compression=&\n // compressionQuality=&bandIds=&mosaicRule=&renderingRule=&\n // f=image\n */\n exportImageURL(options: {\n bbox: [number, number, number, number];\n boxSR?: string;\n width: number;\n height: number;\n imageSR?: string;\n time?: never;\n format?: 'jpgpng';\n pixelType?: 'U8';\n noData?: never;\n noDataInterpretation?: 'esriNoDataMatchAny';\n interpolation?: '+RSP_NearestNeighbor';\n compression?: never;\n compressionQuality?: never;\n bandIds?: never;\n mosaicRule?: never;\n renderingRule?: never;\n f?: 'image';\n }): string {\n const bbox = `bbox=${options.bbox[0]},${options.bbox[1]},${options.bbox[2]},${options.bbox[3]}`;\n const size = `size=${options.width},${options.height}`;\n const arcgisOptions = {...options, bbox, size};\n // @ts-expect-error\n delete arcgisOptions.width;\n // @ts-expect-error\n delete arcgisOptions.height;\n return this.getUrl('exportImage', arcgisOptions);\n }\n\n // INTERNAL METHODS\n\n /**\n * @note protected, since perhaps getWMSUrl may need to be overridden to handle certain backends?\n * @note if override is common, maybe add a callback prop?\n * */\n protected getUrl(\n path: string,\n options: Record<string, unknown>,\n extra?: Record<string, unknown>\n ): string {\n let url = `${this.props.url}/${path}`;\n let first = true;\n for (const [key, value] of Object.entries(options)) {\n url += first ? '?' : '&';\n first = false;\n if (Array.isArray(value)) {\n url += `${key.toUpperCase()}=${value.join(',')}`;\n } else {\n url += `${key.toUpperCase()}=${value ? String(value) : ''}`;\n }\n }\n return url;\n }\n\n /** Checks for and parses a WMS XML formatted ServiceError and throws an exception */\n protected async checkResponse(response: Response) {\n if (!response.ok) {\n // } || response.headers['content-type'] === WMSErrorLoader.mimeTypes[0]) {\n // const arrayBuffer = await response.arrayBuffer();\n // const error = await WMSErrorLoader.parse(arrayBuffer, this.loadOptions);\n throw new Error('error');\n }\n }\n}\n\nexport const ArcGISImageService: Service = {\n type: 'arcgis-image-server',\n testURL: (url: string): boolean => url.toLowerCase().includes('ImageServer'),\n create: (props: ArcGISImageServerProps): ArcGISImageSource => new ArcGISImageSource(props)\n};\n"],"mappings":"SAOQA,YAAY;AAcpB,OAAO,MAAMC,iBAAiB,S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,IAAI,CAACF,KAAK,CAACE,GAAI,IAAGgB,IAAK,EAAC;IACrC,IAAIE,KAAK,GAAG,IAAI;IAChB,KAAK,MAAM,CAACC,GAAG,EAAEC,KAAK,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACf,OAAO,CAAC,EAAE;MAClDP,GAAG,IAAIkB,KAAK,GAAG,GAAG,GAAG,GAAG;MACxBA,KAAK,GAAG,KAAK;MACb,IAAIK,KAAK,CAACC,OAAO,CAACJ,KAAK,CAAC,EAAE;QACxBpB,GAAG,IAAK,GAAEmB,GAAG,CAACM,WAAW,CAAC,CAAE,IAAGL,KAAK,CAACM,IAAI,CAAC,GAAG,CAAE,EAAC;MAClD,CAAC,MAAM;QACL1B,GAAG,IAAK,GAAEmB,GAAG,CAACM,WAAW,CAAC,CAAE,IAAGL,KAAK,GAAGO,MAAM,CAACP,KAAK,CAAC,GAAG,EAAG,EAAC;MAC7D;IACF;IACA,OAAOpB,GAAG;EACZ;EAGA,MAAgB4B,aAAaA,CAACC,QAAkB,EAAE;IAChD,IAAI,CAACA,QAAQ,CAACC,EAAE,EAAE;MAIhB,MAAM,IAAIzB,KAAK,CAAC,OAAO,CAAC;IAC1B;EACF;AACF;AAEA,OAAO,MAAM0B,kBAA2B,GAAG;EACzCC,IAAI,EAAE,qBAAqB;EAC3BC,OAAO,EAAGjC,GAAW,IAAcA,GAAG,CAACkC,WAAW,CAAC,CAAC,CAACC,QAAQ,CAAC,aAAa,CAAC;EAC5EC,MAAM,EAAGtC,KAA6B,IAAwB,IAAIF,iBAAiB,CAACE,KAAK;AAC3F,CAAC"}
|
|
@@ -46,6 +46,8 @@ export declare class CSWService extends DataSource<CSWServiceProps> {
|
|
|
46
46
|
static readonly type = "csw";
|
|
47
47
|
static testURL: (url: string) => boolean;
|
|
48
48
|
capabilities: CSWCapabilities | null;
|
|
49
|
+
data: string;
|
|
50
|
+
url: string;
|
|
49
51
|
/** A list of loaders used by the CSWService methods */
|
|
50
52
|
readonly loaders: (import("@loaders.gl/loader-utils").LoaderWithParser<CSWCapabilities, never, import("../../csw-capabilities-loader").CSWLoaderOptions> | import("@loaders.gl/loader-utils").LoaderWithParser<string, never, import("../../wms-error-loader").WMSLoaderOptions>)[];
|
|
51
53
|
/** Create a CSWService */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"csw-service.d.ts","sourceRoot":"","sources":["../../../src/services/ogc/csw-service.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AAEpD,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,+BAA+B,CAAC;AAGnE,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AAGzD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,yBAAyB,CAAC;AAKvD,KAAK,mBAAmB,GAAG;IACzB,sDAAsD;IACtD,OAAO,CAAC,EAAE,KAAK,CAAC;IAChB,0DAA0D;IAC1D,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;CACjD,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG,mBAAmB,GAAG;IAC/D,mBAAmB;IACnB,OAAO,CAAC,EAAE,iBAAiB,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,mBAAmB,GAAG;IAC1D,mBAAmB;IACnB,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,sBAAsB;IACtB,SAAS,EAAE,YAAY,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,mBAAmB,GAAG;IACzD,mBAAmB;IACnB,OAAO,CAAC,EAAE,WAAW,CAAC;CAEvB,CAAC;AAEF,6DAA6D;AAC7D,MAAM,MAAM,OAAO,GAAG;IACpB,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,IAAI,EA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
+
this.data = void 0;
|
|
11
|
+
this.url = void 0;
|
|
10
12
|
this.loaders = [CSWErrorLoader, CSWCapabilitiesLoader];
|
|
13
|
+
this.url = props.url;
|
|
14
|
+
this.data = props.url;
|
|
11
15
|
}
|
|
12
16
|
async getMetadata() {
|
|
13
17
|
const capabilities = await this.getCapabilities();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"csw-service.js","names":["DataSource","CSWCapabilitiesLoader","CSWRecordsLoader","CSWDomainLoader","WMSErrorLoader","CSWErrorLoader","CSWService","constructor","props","capabilities","loaders","getMetadata","getCapabilities","normalizeMetadata","getServiceDirectory","options","services","unknownServices","records","getRecords","record","reference","references","url","value","scheme","push","name","title","type","_parseOGCUrl","includeUnknown","concat","parts","split","params","wmsParameters","vendorParameters","getCapabilitiesURL","response","fetch","arrayBuffer","_checkResponse","parse","loadOptions","getRecordsURL","getDomain","getDomainURL","version","service","request","_getCSWUrl","typenames","first","key","Object","entries","Array","isArray","toUpperCase","join","String","encodeURI","contentType","headers","ok","mimeTypes","includes","_CSWErrorLoader$parse","error","parseSync","call","Error","_parseError","_CSWErrorLoader$parse2","testURL","toLowerCase"],"sources":["../../../src/services/ogc/csw-service.ts"],"sourcesContent":["// loaders.gl, MIT license\n// Copyright (c) vis.gl contributors\n\n/* eslint-disable camelcase */\n\nimport type {DataSourceProps} from '@loaders.gl/loader-utils';\nimport {DataSource} from '@loaders.gl/loader-utils';\n\nimport type {CSWCapabilities} from '../../csw-capabilities-loader';\nimport {CSWCapabilitiesLoader} from '../../csw-capabilities-loader';\n\nimport type {CSWRecords} from '../../csw-records-loader';\nimport {CSWRecordsLoader} from '../../csw-records-loader';\n\nimport type {CSWDomain} from '../../csw-domain-loader';\nimport {CSWDomainLoader} from '../../csw-domain-loader';\n\nimport {WMSErrorLoader as CSWErrorLoader} from '../../wms-error-loader';\n\ntype CSWCommonParameters = {\n /** In case the endpoint supports multiple services */\n service?: 'CSW';\n /** In case the endpoint supports multiple CSW versions */\n version?: '1.1.1' | '2.0.0' | '2.0.1' | '3.0.0';\n};\n\nexport type CSWGetCapabilitiesParameters = CSWCommonParameters & {\n /** Request type */\n request?: 'GetCapabilities';\n};\n\nexport type CSWGetRecordsParameters = CSWCommonParameters & {\n /** Request type */\n request?: 'GetRecords';\n /** type of records */\n typenames: 'csw:Record';\n};\n\nexport type CSWGetDomainParameters = CSWCommonParameters & {\n /** Request type */\n request?: 'GetDomain';\n // TBA\n};\n\n/** Describes a service or resource exposed by the catalog */\nexport type Service = {\n /** name of service or resource */\n name: string;\n /** type of service or resource */\n type: string;\n url: string;\n params?: string;\n scheme?: string;\n};\n\nexport type CSWServiceProps = DataSourceProps & {\n url: string;\n};\n\n/**\n * The CSWService class\n * - provides type safe methods to form URLs to a CSW service\n * - provides type safe methods to query and parse results (and errors) from a CSW service\n * @note Only the URL parameter conversion is supported. XML posts are not supported.\n */\nexport class CSWService extends DataSource<CSWServiceProps> {\n static readonly type = 'csw';\n static testURL = (url: string): boolean => url.toLowerCase().includes('csw');\n\n capabilities: CSWCapabilities | null = null;\n\n /** A list of loaders used by the CSWService methods */\n readonly loaders = [CSWErrorLoader, CSWCapabilitiesLoader];\n\n /** Create a CSWService */\n constructor(props: CSWServiceProps) {\n super(props);\n }\n\n async getMetadata(): Promise<CSWCapabilities> {\n const capabilities = await this.getCapabilities();\n return this.normalizeMetadata(capabilities);\n }\n\n normalizeMetadata(capabilities: CSWCapabilities): CSWCapabilities {\n return capabilities;\n }\n\n async getServiceDirectory(options?: {includeUnknown?: boolean}): Promise<Service[]> {\n const services: Service[] = [];\n const unknownServices: Service[] = [];\n\n const records = await this.getRecords();\n for (const record of records.records) {\n for (const reference of record.references) {\n const url = reference.value;\n switch (reference.scheme) {\n case 'OGC:WMS':\n services.push({name: record.title, type: 'ogc-wms-service', ...this._parseOGCUrl(url)});\n break;\n case 'OGC:WMTS':\n services.push({\n name: record.title,\n type: 'ogc-wmts-service',\n ...this._parseOGCUrl(url)\n });\n break;\n case 'OGC:WFS':\n services.push({name: record.title, type: 'ogc-wfs-service', ...this._parseOGCUrl(url)});\n break;\n default:\n unknownServices.push({\n name: record.title,\n type: 'unknown',\n url: reference.value,\n scheme: reference.scheme\n });\n }\n }\n }\n\n return options?.includeUnknown ? services.concat(unknownServices) : services;\n }\n\n _parseOGCUrl(url: string): {url: string; params: string} {\n const parts = url.split('?');\n return {\n url: parts[0],\n params: parts[1] || ''\n };\n }\n\n // CSW Service API Stubs\n\n /** Get Capabilities */\n async getCapabilities(\n wmsParameters?: CSWGetCapabilitiesParameters,\n vendorParameters?: Record<string, unknown>\n ): Promise<CSWCapabilities> {\n const url = this.getCapabilitiesURL(wmsParameters, vendorParameters);\n const response = await this.fetch(url);\n const arrayBuffer = await response.arrayBuffer();\n this._checkResponse(response, arrayBuffer);\n const capabilities = await CSWCapabilitiesLoader.parse(arrayBuffer, this.props.loadOptions);\n return capabilities;\n }\n\n /** Get Records */\n async getRecords(\n wmsParameters?: CSWGetRecordsParameters,\n vendorParameters?: Record<string, unknown>\n ): Promise<CSWRecords> {\n const url = this.getRecordsURL(wmsParameters, vendorParameters);\n const response = await this.fetch(url);\n const arrayBuffer = await response.arrayBuffer();\n this._checkResponse(response, arrayBuffer);\n return await CSWRecordsLoader.parse(arrayBuffer, this.props.loadOptions);\n }\n\n /** Get Domain */\n async getDomain(\n wmsParameters?: CSWGetDomainParameters,\n vendorParameters?: Record<string, unknown>\n ): Promise<CSWDomain> {\n const url = this.getDomainURL(wmsParameters, vendorParameters);\n const response = await this.fetch(url);\n const arrayBuffer = await response.arrayBuffer();\n this._checkResponse(response, arrayBuffer);\n return await CSWDomainLoader.parse(arrayBuffer, this.props.loadOptions);\n }\n\n // Typed URL creators\n // For applications that want full control of fetching and parsing\n\n /** Generate a URL for the GetCapabilities request */\n getCapabilitiesURL(\n wmsParameters?: CSWGetCapabilitiesParameters,\n vendorParameters?: Record<string, unknown>\n ): string {\n const options: Required<CSWGetCapabilitiesParameters> = {\n version: '3.0.0',\n ...wmsParameters,\n ...vendorParameters,\n service: 'CSW',\n request: 'GetCapabilities'\n };\n return this._getCSWUrl(options, vendorParameters);\n }\n\n /** Generate a URL for the GetCapabilities request */\n getRecordsURL(\n wmsParameters?: CSWGetRecordsParameters,\n vendorParameters?: Record<string, unknown>\n ): string {\n const options: Required<CSWGetRecordsParameters> = {\n version: '3.0.0',\n typenames: 'csw:Record',\n ...wmsParameters,\n ...vendorParameters,\n service: 'CSW',\n request: 'GetRecords'\n };\n return this._getCSWUrl(options, vendorParameters);\n }\n\n /** Generate a URL for the GetCapabilities request */\n getDomainURL(\n wmsParameters?: CSWGetDomainParameters,\n vendorParameters?: Record<string, unknown>\n ): string {\n const options: Required<CSWGetDomainParameters> = {\n version: '3.0.0',\n ...wmsParameters,\n ...vendorParameters,\n service: 'CSW',\n request: 'GetDomain'\n };\n return this._getCSWUrl(options, vendorParameters);\n }\n\n // INTERNAL METHODS\n\n /**\n * @note case _getCSWUrl may need to be overridden to handle certain backends?\n * */\n protected _getCSWUrl(\n options: Record<string, unknown>,\n vendorParameters?: Record<string, unknown>\n ): string {\n let url = this.props.url;\n let first = true;\n for (const [key, value] of Object.entries(options)) {\n url += first ? '?' : '&';\n first = false;\n if (Array.isArray(value)) {\n url += `${key.toUpperCase()}=${value.join(',')}`;\n } else {\n url += `${key.toUpperCase()}=${value ? String(value) : ''}`;\n }\n }\n return encodeURI(url);\n }\n\n /** Checks for and parses a CSW XML formatted ServiceError and throws an exception */\n protected _checkResponse(response: Response, arrayBuffer: ArrayBuffer): void {\n const contentType = response.headers['content-type'];\n if (!response.ok || CSWErrorLoader.mimeTypes.includes(contentType)) {\n const error = CSWErrorLoader.parseSync?.(arrayBuffer, this.props.loadOptions);\n throw new Error(error);\n }\n }\n\n /** Error situation detected */\n protected _parseError(arrayBuffer: ArrayBuffer): Error {\n const error = CSWErrorLoader.parseSync?.(arrayBuffer, this.props.loadOptions);\n return new Error(error);\n }\n}\n"],"mappings":"AAMA,SAAQA,UAAU,QAAO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AQ,CAACyB,OAAO,CAAC,cAAc,CAAC;IACpD,IAAI,CAACzB,QAAQ,CAAC0B,EAAE,IAAI5D,cAAc,CAAC6D,SAAS,CAACC,QAAQ,CAACJ,WAAW,CAAC,EAAE;MAAA,IAAAK,qBAAA;MAClE,MAAMC,KAAK,IAAAD,qBAAA,GAAG/D,cAAc,CAACiE,SAAS,cAAAF,qBAAA,uBAAxBA,qBAAA,CAAAG,IAAA,CAAAlE,cAAc,EAAaoC,WAAW,EAAE,IAAI,CAACjC,KAAK,CAACoC,WAAW,CAAC;MAC7E,MAAM,IAAI4B,KAAK,CAACH,KAAK,CAAC;IACxB;EACF;EAGUI,WAAWA,CAAChC,WAAwB,EAAS;IAAA,IAAAiC,sBAAA;IACrD,MAAML,KAAK,IAAAK,sBAAA,GAAGrE,cAAc,CAACiE,SAAS,cAAAI,sBAAA,uBAAxBA,sBAAA,CAAAH,IAAA,CAAAlE,cAAc,EAAaoC,WAAW,EAAE,IAAI,CAACjC,KAAK,CAACoC,WAAW,CAAC;IAC7E,OAAO,IAAI4B,KAAK,CAACH,KAAK,CAAC;EACzB;AACF;AAhMa/D,UAAU,CACLuB,IAAI,GAAG,KAAK;AADjBvB,UAAU,CAEdqE,OAAO,GAAIpD,GAAW,IAAcA,GAAG,CAACqD,WAAW,CAAC,CAAC,CAACT,QAAQ,CAAC,KAAK,CAAC"}
|
|
1
|
+
{"version":3,"file":"csw-service.js","names":["DataSource","CSWCapabilitiesLoader","CSWRecordsLoader","CSWDomainLoader","WMSErrorLoader","CSWErrorLoader","CSWService","constructor","props","capabilities","data","url","loaders","getMetadata","getCapabilities","normalizeMetadata","getServiceDirectory","options","services","unknownServices","records","getRecords","record","reference","references","value","scheme","push","name","title","type","_parseOGCUrl","includeUnknown","concat","parts","split","params","wmsParameters","vendorParameters","getCapabilitiesURL","response","fetch","arrayBuffer","_checkResponse","parse","loadOptions","getRecordsURL","getDomain","getDomainURL","version","service","request","_getCSWUrl","typenames","first","key","Object","entries","Array","isArray","toUpperCase","join","String","encodeURI","contentType","headers","ok","mimeTypes","includes","_CSWErrorLoader$parse","error","parseSync","call","Error","_parseError","_CSWErrorLoader$parse2","testURL","toLowerCase"],"sources":["../../../src/services/ogc/csw-service.ts"],"sourcesContent":["// loaders.gl, MIT license\n// Copyright (c) vis.gl contributors\n\n/* eslint-disable camelcase */\n\nimport type {DataSourceProps} from '@loaders.gl/loader-utils';\nimport {DataSource} from '@loaders.gl/loader-utils';\n\nimport type {CSWCapabilities} from '../../csw-capabilities-loader';\nimport {CSWCapabilitiesLoader} from '../../csw-capabilities-loader';\n\nimport type {CSWRecords} from '../../csw-records-loader';\nimport {CSWRecordsLoader} from '../../csw-records-loader';\n\nimport type {CSWDomain} from '../../csw-domain-loader';\nimport {CSWDomainLoader} from '../../csw-domain-loader';\n\nimport {WMSErrorLoader as CSWErrorLoader} from '../../wms-error-loader';\n\ntype CSWCommonParameters = {\n /** In case the endpoint supports multiple services */\n service?: 'CSW';\n /** In case the endpoint supports multiple CSW versions */\n version?: '1.1.1' | '2.0.0' | '2.0.1' | '3.0.0';\n};\n\nexport type CSWGetCapabilitiesParameters = CSWCommonParameters & {\n /** Request type */\n request?: 'GetCapabilities';\n};\n\nexport type CSWGetRecordsParameters = CSWCommonParameters & {\n /** Request type */\n request?: 'GetRecords';\n /** type of records */\n typenames: 'csw:Record';\n};\n\nexport type CSWGetDomainParameters = CSWCommonParameters & {\n /** Request type */\n request?: 'GetDomain';\n // TBA\n};\n\n/** Describes a service or resource exposed by the catalog */\nexport type Service = {\n /** name of service or resource */\n name: string;\n /** type of service or resource */\n type: string;\n url: string;\n params?: string;\n scheme?: string;\n};\n\nexport type CSWServiceProps = DataSourceProps & {\n url: string;\n};\n\n/**\n * The CSWService class\n * - provides type safe methods to form URLs to a CSW service\n * - provides type safe methods to query and parse results (and errors) from a CSW service\n * @note Only the URL parameter conversion is supported. XML posts are not supported.\n */\nexport class CSWService extends DataSource<CSWServiceProps> {\n static readonly type = 'csw';\n static testURL = (url: string): boolean => url.toLowerCase().includes('csw');\n\n capabilities: CSWCapabilities | null = null;\n data: string;\n url: string;\n\n /** A list of loaders used by the CSWService methods */\n readonly loaders = [CSWErrorLoader, CSWCapabilitiesLoader];\n\n /** Create a CSWService */\n constructor(props: CSWServiceProps) {\n super(props);\n this.url = props.url;\n this.data = props.url;\n }\n\n async getMetadata(): Promise<CSWCapabilities> {\n const capabilities = await this.getCapabilities();\n return this.normalizeMetadata(capabilities);\n }\n\n normalizeMetadata(capabilities: CSWCapabilities): CSWCapabilities {\n return capabilities;\n }\n\n async getServiceDirectory(options?: {includeUnknown?: boolean}): Promise<Service[]> {\n const services: Service[] = [];\n const unknownServices: Service[] = [];\n\n const records = await this.getRecords();\n for (const record of records.records) {\n for (const reference of record.references) {\n const url = reference.value;\n switch (reference.scheme) {\n case 'OGC:WMS':\n services.push({name: record.title, type: 'ogc-wms-service', ...this._parseOGCUrl(url)});\n break;\n case 'OGC:WMTS':\n services.push({\n name: record.title,\n type: 'ogc-wmts-service',\n ...this._parseOGCUrl(url)\n });\n break;\n case 'OGC:WFS':\n services.push({name: record.title, type: 'ogc-wfs-service', ...this._parseOGCUrl(url)});\n break;\n default:\n unknownServices.push({\n name: record.title,\n type: 'unknown',\n url: reference.value,\n scheme: reference.scheme\n });\n }\n }\n }\n\n return options?.includeUnknown ? services.concat(unknownServices) : services;\n }\n\n _parseOGCUrl(url: string): {url: string; params: string} {\n const parts = url.split('?');\n return {\n url: parts[0],\n params: parts[1] || ''\n };\n }\n\n // CSW Service API Stubs\n\n /** Get Capabilities */\n async getCapabilities(\n wmsParameters?: CSWGetCapabilitiesParameters,\n vendorParameters?: Record<string, unknown>\n ): Promise<CSWCapabilities> {\n const url = this.getCapabilitiesURL(wmsParameters, vendorParameters);\n const response = await this.fetch(url);\n const arrayBuffer = await response.arrayBuffer();\n this._checkResponse(response, arrayBuffer);\n const capabilities = await CSWCapabilitiesLoader.parse(arrayBuffer, this.props.loadOptions);\n return capabilities;\n }\n\n /** Get Records */\n async getRecords(\n wmsParameters?: CSWGetRecordsParameters,\n vendorParameters?: Record<string, unknown>\n ): Promise<CSWRecords> {\n const url = this.getRecordsURL(wmsParameters, vendorParameters);\n const response = await this.fetch(url);\n const arrayBuffer = await response.arrayBuffer();\n this._checkResponse(response, arrayBuffer);\n return await CSWRecordsLoader.parse(arrayBuffer, this.props.loadOptions);\n }\n\n /** Get Domain */\n async getDomain(\n wmsParameters?: CSWGetDomainParameters,\n vendorParameters?: Record<string, unknown>\n ): Promise<CSWDomain> {\n const url = this.getDomainURL(wmsParameters, vendorParameters);\n const response = await this.fetch(url);\n const arrayBuffer = await response.arrayBuffer();\n this._checkResponse(response, arrayBuffer);\n return await CSWDomainLoader.parse(arrayBuffer, this.props.loadOptions);\n }\n\n // Typed URL creators\n // For applications that want full control of fetching and parsing\n\n /** Generate a URL for the GetCapabilities request */\n getCapabilitiesURL(\n wmsParameters?: CSWGetCapabilitiesParameters,\n vendorParameters?: Record<string, unknown>\n ): string {\n const options: Required<CSWGetCapabilitiesParameters> = {\n version: '3.0.0',\n ...wmsParameters,\n ...vendorParameters,\n service: 'CSW',\n request: 'GetCapabilities'\n };\n return this._getCSWUrl(options, vendorParameters);\n }\n\n /** Generate a URL for the GetCapabilities request */\n getRecordsURL(\n wmsParameters?: CSWGetRecordsParameters,\n vendorParameters?: Record<string, unknown>\n ): string {\n const options: Required<CSWGetRecordsParameters> = {\n version: '3.0.0',\n typenames: 'csw:Record',\n ...wmsParameters,\n ...vendorParameters,\n service: 'CSW',\n request: 'GetRecords'\n };\n return this._getCSWUrl(options, vendorParameters);\n }\n\n /** Generate a URL for the GetCapabilities request */\n getDomainURL(\n wmsParameters?: CSWGetDomainParameters,\n vendorParameters?: Record<string, unknown>\n ): string {\n const options: Required<CSWGetDomainParameters> = {\n version: '3.0.0',\n ...wmsParameters,\n ...vendorParameters,\n service: 'CSW',\n request: 'GetDomain'\n };\n return this._getCSWUrl(options, vendorParameters);\n }\n\n // INTERNAL METHODS\n\n /**\n * @note case _getCSWUrl may need to be overridden to handle certain backends?\n * */\n protected _getCSWUrl(\n options: Record<string, unknown>,\n vendorParameters?: Record<string, unknown>\n ): string {\n let url = this.props.url;\n let first = true;\n for (const [key, value] of Object.entries(options)) {\n url += first ? '?' : '&';\n first = false;\n if (Array.isArray(value)) {\n url += `${key.toUpperCase()}=${value.join(',')}`;\n } else {\n url += `${key.toUpperCase()}=${value ? String(value) : ''}`;\n }\n }\n return encodeURI(url);\n }\n\n /** Checks for and parses a CSW XML formatted ServiceError and throws an exception */\n protected _checkResponse(response: Response, arrayBuffer: ArrayBuffer): void {\n const contentType = response.headers['content-type'];\n if (!response.ok || CSWErrorLoader.mimeTypes.includes(contentType)) {\n const error = CSWErrorLoader.parseSync?.(arrayBuffer, this.props.loadOptions);\n throw new Error(error);\n }\n }\n\n /** Error situation detected */\n protected _parseError(arrayBuffer: ArrayBuffer): Error {\n const error = CSWErrorLoader.parseSync?.(arrayBuffer, this.props.loadOptions);\n return new Error(error);\n }\n}\n"],"mappings":"AAMA,SAAQA,UAAU,QAAO,0BAA0B;AAAC,SAG5CC,qBAAqB;AAAA,SAGrBC,gBAAgB;AAAA,SAGhBC,eAAe;AAAA,SAEfC,cAAc,IAAIC,cAAc;AAgDxC,OAAO,MAAMC,UAAU,SAASN,UAAU,CAAkB;EAY1DO,WAAWA,CAACC,KAAsB,EAAE;IAClC,KAAK,CAACA,KAAK,CAAC;IAAC,KATfC,YAAY,GAA2B,IAAI;IAAA,KAC3CC,IAAI;IAAA,KACJC,GAAG;IAAA,KAGMC,OAAO,GAAG,CAACP,cAAc,EAAEJ,qBAAqB,CAAC;IAKxD,IAAI,CAACU,GAAG,GAAGH,KAAK,CAACG,GAAG;IACpB,IAAI,CAACD,IAAI,GAAGF,KAAK,CAACG,GAAG;EACvB;EAEA,MAAME,WAAWA,CAAA,EAA6B;IAC5C,MAAMJ,YAAY,GAAG,MAAM,IAAI,CAACK,eAAe,CAAC,CAAC;IACjD,OAAO,IAA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AChC,WAAwB,EAAS;IAAA,IAAAiC,sBAAA;IACrD,MAAML,KAAK,IAAAK,sBAAA,GAAGtE,cAAc,CAACkE,SAAS,cAAAI,sBAAA,uBAAxBA,sBAAA,CAAAH,IAAA,CAAAnE,cAAc,EAAaqC,WAAW,EAAE,IAAI,CAAClC,KAAK,CAACqC,WAAW,CAAC;IAC7E,OAAO,IAAI4B,KAAK,CAACH,KAAK,CAAC;EACzB;AACF;AApMahE,UAAU,CACLwB,IAAI,GAAG,KAAK;AADjBxB,UAAU,CAEdsE,OAAO,GAAIjE,GAAW,IAAcA,GAAG,CAACkE,WAAW,CAAC,CAAC,CAACT,QAAQ,CAAC,KAAK,CAAC"}
|
|
@@ -41,7 +41,8 @@ export type WMSGetCapabilitiesParameters = {
|
|
|
41
41
|
export type WMSGetMapParameters = {
|
|
42
42
|
/** In case the endpoint supports multiple WMS versions */
|
|
43
43
|
version?: '1.3.0' | '1.1.1';
|
|
44
|
-
/** bounding box of the requested map image */
|
|
44
|
+
/** bounding box of the requested map image `[[w, s], [e, n]]` */
|
|
45
|
+
/** bounding box of the requested map image @deprecated Use .boundingBox */
|
|
45
46
|
bbox: [number, number, number, number];
|
|
46
47
|
/** pixel width of returned image */
|
|
47
48
|
width: number;
|
|
@@ -62,17 +63,6 @@ export type WMSGetMapParameters = {
|
|
|
62
63
|
/** If layer supports elevation dimension */
|
|
63
64
|
elevation?: string;
|
|
64
65
|
};
|
|
65
|
-
/** GetMap parameters that are specific to the current view */
|
|
66
|
-
export type WMSGetMapViewParameters = {
|
|
67
|
-
/** pixel width of returned image */
|
|
68
|
-
width: number;
|
|
69
|
-
/** pixels */
|
|
70
|
-
height: number;
|
|
71
|
-
/** bounding box of the requested map image */
|
|
72
|
-
bbox: [number, number, number, number];
|
|
73
|
-
/** Coordinate Reference System for the image (not bounding box). can be provided in service constructor. */
|
|
74
|
-
crs?: string;
|
|
75
|
-
};
|
|
76
66
|
/**
|
|
77
67
|
* Parameters for GetFeatureInfo
|
|
78
68
|
* @see https://imagery.pasda.psu.edu/arcgis/services/pasda/UrbanTreeCanopy_Landcover/MapServer/WmsServer?SERVICE=WMS&
|
|
@@ -147,6 +137,7 @@ export type WMSSourceProps = ImageServiceProps & {
|
|
|
147
137
|
export declare class WMSSource extends ImageSource<WMSSourceProps> {
|
|
148
138
|
/** Base URL to the service */
|
|
149
139
|
readonly url: string;
|
|
140
|
+
readonly data: string;
|
|
150
141
|
/** In WMS 1.3.0, replaces references to EPSG:4326 with CRS:84. But not always supported. Default: false */
|
|
151
142
|
substituteCRS84: boolean;
|
|
152
143
|
/** In WMS 1.3.0, flips x,y (lng, lat) coordinates for the supplied coordinate systems. Default: ['ESPG:4326'] */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wms-service.d.ts","sourceRoot":"","sources":["../../../src/services/ogc/wms-service.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAIlD,OAAO,KAAK,EAAC,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAC,MAAM,0BAA0B,CAAC;AAC/F,OAAO,EAAC,WAAW,EAAC,MAAM,0BAA0B,CAAC;AACrD,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,kCAAkC,CAAC;AAExE,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,mCAAmC,CAAC;AACtE,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,wCAAwC,CAAC;AAShF,eAAO,MAAM,UAAU,EAAE,OAAO,CAAC,SAAS,EAAE,cAAc,CAIzD,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,iCAAiC;IACjC,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IAC5B,gDAAgD;IAChD,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,iDAAiD;IACjD,YAAY,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C;IAOpE,qFAAqF;IACrF,SAAS,CAAC,cAAc,CAAC,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,GAAG,IAAI;IAY5E,+BAA+B;IAC/B,SAAS,CAAC,WAAW,CAAC,WAAW,EAAE,WAAW,GAAG,KAAK;CAIvD"}
|
|
@@ -15,12 +15,14 @@ export class WMSSource extends ImageSource {
|
|
|
15
15
|
var _props$substituteCRS;
|
|
16
16
|
super(props);
|
|
17
17
|
this.url = void 0;
|
|
18
|
+
this.data = void 0;
|
|
18
19
|
this.substituteCRS84 = void 0;
|
|
19
20
|
this.flipCRS = void 0;
|
|
20
21
|
this.wmsParameters = void 0;
|
|
21
22
|
this.vendorParameters = void 0;
|
|
22
23
|
this.capabilities = null;
|
|
23
24
|
this.url = props.url;
|
|
25
|
+
this.data = props.url;
|
|
24
26
|
this.substituteCRS84 = (_props$substituteCRS = props.substituteCRS84) !== null && _props$substituteCRS !== void 0 ? _props$substituteCRS : false;
|
|
25
27
|
this.flipCRS = ['EPSG:4326'];
|
|
26
28
|
this.wmsParameters = {
|
|
@@ -207,6 +209,14 @@ export class WMSSource extends ImageSource {
|
|
|
207
209
|
key = 'crs';
|
|
208
210
|
}
|
|
209
211
|
break;
|
|
212
|
+
case 'boundingBox':
|
|
213
|
+
const boundingBox = value;
|
|
214
|
+
let bbox2 = [...boundingBox[0], ...boundingBox[1]];
|
|
215
|
+
bbox2 = this._flipBoundingBox(boundingBox, wmsParameters);
|
|
216
|
+
if (bbox2) {
|
|
217
|
+
value = bbox2;
|
|
218
|
+
}
|
|
219
|
+
break;
|
|
210
220
|
case 'bbox':
|
|
211
221
|
const bbox = this._flipBoundingBox(value, wmsParameters);
|
|
212
222
|
if (bbox) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wms-service.js","names":["ImageLoader","mergeLoaderOptions","ImageSource","WMSCapabilitiesLoader","WMSFeatureInfoLoader","WMSLayerDescriptionLoader","WMSErrorLoader","WMSService","type","testURL","url","toLowerCase","includes","create","props","WMSSource","constructor","_props$substituteCRS","substituteCRS84","flipCRS","wmsParameters","vendorParameters","capabilities","layers","undefined","query_layers","styles","version","crs","format","info_format","transparent","time","elevation","getMetadata","getCapabilities","normalizeMetadata","getImage","parameters","getMap","getCapabilitiesURL","response","fetch","arrayBuffer","_checkResponse","parse","loadOptions","getMapURL","_parseError","getFeatureInfo","getFeatureInfoURL","getFeatureInfoText","TextDecoder","decode","describeLayer","describeLayerURL","getLegendGraphic","getLegendGraphicURL","options","_getWMSUrl","_getWMS130Parameters","_parseWMSUrl","baseUrl","search","split","searchParams","parameter","key","value","request","first","allParameters","service","IGNORE_EMPTY_KEYS","Object","entries","_getURLParameter","encodeURI","newParameters","srs","bbox","_flipBoundingBox","toUpperCase","Array","isArray","join","String","bboxValue","length","flipCoordinates","_fetchArrayBuffer","contentType","headers","ok","mimeTypes","_WMSErrorLoader$parse","wms","throwOnError","error","parseSync","call","Error","_WMSErrorLoader$parse2"],"sources":["../../../src/services/ogc/wms-service.ts"],"sourcesContent":["// loaders.gl, MIT license\n// Copyright (c) vis.gl contributors\n\n/* eslint-disable camelcase */\nimport type {ImageType} from '@loaders.gl/images';\nimport {ImageLoader} from '@loaders.gl/images';\nimport {mergeLoaderOptions} from '@loaders.gl/loader-utils';\n\nimport type {Service, ImageSourceMetadata, GetImageParameters} from '@loaders.gl/loader-utils';\nimport {ImageSource} from '@loaders.gl/loader-utils';\nimport type {ImageServiceProps} from '../../lib/services/image-service';\n\nimport type {WMSCapabilities} from '../../wms-capabilities-loader';\nimport type {WMSFeatureInfo} from '../../wip/wms-feature-info-loader';\nimport type {WMSLayerDescription} from '../../wip/wms-layer-description-loader';\n\nimport {WMSCapabilitiesLoader} from '../../wms-capabilities-loader';\nimport {WMSFeatureInfoLoader} from '../../wip/wms-feature-info-loader';\nimport {WMSLayerDescriptionLoader} from '../../wip/wms-layer-description-loader';\n\nimport type {WMSLoaderOptions} from '../../wms-error-loader';\nimport {WMSErrorLoader} from '../../wms-error-loader';\n\nexport const WMSService: Service<WMSSource, WMSSourceProps> = {\n type: 'wms',\n testURL: (url: string): boolean => url.toLowerCase().includes('wms'),\n create: (props: WMSSourceProps) => new WMSSource(props)\n};\n\n/**\n * \"Static\" WMS parameters (not viewport or selected pixel dependent)\n * These can be provided as defaults in the WMSSource constructor\n */\nexport type WMSParameters = {\n /** WMS version (all requests) */\n version?: '1.3.0' | '1.1.1';\n /** Layers to render (GetMap, GetFeatureInfo) */\n layers?: string[];\n /** list of layers to query.. (GetFeatureInfo) */\n query_layers?: string[];\n\n /** Coordinate Reference System (CRS) for the image (not the bounding box) */\n crs?: string;\n /** Requested format for the return image (GetMap, GetLegendGraphic) */\n format?: 'image/png';\n /** Requested MIME type of returned feature info (GetFeatureInfo) */\n info_format?: 'text/plain' | 'application/geojson' | 'application/vnd.ogc.gml';\n /** Styling - Not yet supported */\n styles?: unknown;\n /** Any additional parameters specific to this WMSSource (GetMap) */\n transparent?: boolean;\n /** If layer supports time dimension */\n time?: string;\n /** If layer supports elevation dimension */\n elevation?: string;\n};\n\n/** Parameters for GetCapabilities */\nexport type WMSGetCapabilitiesParameters = {\n /** In case the endpoint supports multiple WMS versions */\n version?: '1.3.0' | '1.1.1';\n};\n\n/** Parameters for GetMap */\nexport type WMSGetMapParameters = {\n /** In case the endpoint supports multiple WMS versions */\n version?: '1.3.0' | '1.1.1';\n /** bounding box of the requested map image */\n bbox: [number, number, number, number];\n /** pixel width of returned image */\n width: number;\n /** pixels */\n height: number;\n /** requested format for the return image. can be provided in service constructor */\n format?: 'image/png';\n /** Layers to render - can be provided in service constructor */\n layers?: string | string[];\n /** Coordinate Reference System for the image (not bounding box). can be provided in service constructor. */\n crs?: string;\n /** Styling. can be provided in service constructor */\n styles?: unknown;\n /** Don't render background when no data. can be provided in service constructor */\n transparent?: boolean;\n /** If layer supports time dimension */\n time?: string;\n /** If layer supports elevation dimension */\n elevation?: string;\n};\n\n/** GetMap parameters that are specific to the current view */\nexport type WMSGetMapViewParameters = {\n /** pixel width of returned image */\n width: number;\n /** pixels */\n height: number;\n /** bounding box of the requested map image */\n bbox: [number, number, number, number];\n /** Coordinate Reference System for the image (not bounding box). can be provided in service constructor. */\n crs?: string;\n};\n\n/**\n * Parameters for GetFeatureInfo\n * @see https://imagery.pasda.psu.edu/arcgis/services/pasda/UrbanTreeCanopy_Landcover/MapServer/WmsServer?SERVICE=WMS&\n */\nexport type WMSGetFeatureInfoParameters = {\n /** In case the endpoint supports multiple WMS versions */\n version?: '1.3.0' | '1.1.1';\n /** x coordinate for the feature info request */\n x: number;\n /** y coordinate for the feature info request */\n y: number;\n /** MIME type of returned feature info. Can be specified in service constructor */\n info_format?: 'text/plain' | 'application/geojson' | 'application/vnd.ogc.gml';\n /** list of layers to query. Required but can be specified in service constructor. */\n query_layers?: string[];\n /** Layers to render. Required, but can be specified in service constructor */\n layers?: string[];\n /** Styling */\n styles?: unknown;\n /** bounding box of the requested map image */\n bbox: [number, number, number, number];\n /** pixel width of returned image */\n width: number;\n /** pixels */\n height: number;\n /** srs for the image (not the bounding box) */\n crs?: string;\n};\n\n/** GetMap parameters that are specific to the current view */\nexport type WMSGetFeatureInfoViewParameters = {\n /** x coordinate for the feature info request */\n x: number;\n /** y coordinate for the feature info request */\n y: number;\n /** pixel width of returned image */\n width: number;\n /** pixels */\n height: number;\n /** bounding box of the requested map image */\n bbox: [number, number, number, number];\n /** srs for the image (not the bounding box) */\n crs?: string;\n};\n\n/** Parameters for DescribeLayer */\nexport type WMSDescribeLayerParameters = {\n /** In case the endpoint supports multiple WMS versions */\n version?: '1.3.0' | '1.1.1';\n};\n\n/** Parameters for GetLegendGraphic */\nexport type WMSGetLegendGraphicParameters = {\n /** In case the endpoint supports multiple WMS versions */\n version?: '1.3.0' | '1.1.1';\n};\n\n//\n\n/** Properties for creating a enw WMS service */\nexport type WMSSourceProps = ImageServiceProps & {\n /** Base URL to the service */\n url: string;\n /** In 1.3.0, replaces references to EPSG:4326 with CRS:84 */\n substituteCRS84?: boolean;\n /** Default WMS parameters. If not provided here, must be provided in the various request */\n wmsParameters?: WMSParameters;\n /** Any additional service specific parameters */\n vendorParameters?: Record<string, unknown>;\n};\n\n/**\n * The WMSSource class provides\n * - provides type safe methods to form URLs to a WMS service\n * - provides type safe methods to query and parse results (and errors) from a WMS service\n * - implements the ImageService interface\n * @note Only the URL parameter conversion is supported. XML posts are not supported.\n */\nexport class WMSSource extends ImageSource<WMSSourceProps> {\n /** Base URL to the service */\n readonly url: string;\n\n /** In WMS 1.3.0, replaces references to EPSG:4326 with CRS:84. But not always supported. Default: false */\n substituteCRS84: boolean;\n /** In WMS 1.3.0, flips x,y (lng, lat) coordinates for the supplied coordinate systems. Default: ['ESPG:4326'] */\n flipCRS: string[];\n\n /** Default static WMS parameters */\n wmsParameters: Required<WMSParameters>;\n /** Default static vendor parameters */\n vendorParameters?: Record<string, unknown>;\n\n capabilities: WMSCapabilities | null = null;\n\n /** Create a WMSSource */\n constructor(props: WMSSourceProps) {\n super(props);\n\n // TODO - defaults such as version, layers etc could be extracted from a base URL with parameters\n // This would make pasting in any WMS URL more likely to make this class just work.\n // const {baseUrl, parameters} = this._parseWMSUrl(props.url);\n\n this.url = props.url;\n\n this.substituteCRS84 = props.substituteCRS84 ?? false;\n this.flipCRS = ['EPSG:4326'];\n\n this.wmsParameters = {\n layers: undefined!,\n query_layers: undefined!,\n styles: undefined,\n version: '1.3.0',\n crs: 'EPSG:4326',\n format: 'image/png',\n info_format: 'text/plain',\n transparent: undefined!,\n time: undefined!,\n elevation: undefined!,\n ...props.wmsParameters\n };\n\n this.vendorParameters = props.vendorParameters || {};\n }\n\n // ImageService implementation\n async getMetadata(): Promise<ImageSourceMetadata> {\n const capabilities = await this.getCapabilities();\n return this.normalizeMetadata(capabilities);\n }\n\n async getImage(parameters: GetImageParameters): Promise<ImageType> {\n return await this.getMap(parameters);\n }\n\n normalizeMetadata(capabilities: WMSCapabilities): ImageSourceMetadata {\n return capabilities;\n }\n\n // WMS Service API Stubs\n\n /** Get Capabilities */\n async getCapabilities(\n wmsParameters?: WMSGetCapabilitiesParameters,\n vendorParameters?: Record<string, unknown>\n ): Promise<WMSCapabilities> {\n const url = this.getCapabilitiesURL(wmsParameters, vendorParameters);\n const response = await this.fetch(url);\n const arrayBuffer = await response.arrayBuffer();\n this._checkResponse(response, arrayBuffer);\n const capabilities = await WMSCapabilitiesLoader.parse(arrayBuffer, this.loadOptions);\n this.capabilities = capabilities;\n return capabilities;\n }\n\n /** Get a map image */\n async getMap(\n wmsParameters: WMSGetMapParameters,\n vendorParameters?: Record<string, unknown>\n ): Promise<ImageType> {\n const url = this.getMapURL(wmsParameters, vendorParameters);\n const response = await this.fetch(url);\n const arrayBuffer = await response.arrayBuffer();\n this._checkResponse(response, arrayBuffer);\n try {\n return await ImageLoader.parse(arrayBuffer, this.loadOptions);\n } catch {\n throw this._parseError(arrayBuffer);\n }\n }\n\n /** Get Feature Info for a coordinate */\n async getFeatureInfo(\n wmsParameters: WMSGetFeatureInfoParameters,\n vendorParameters?: Record<string, unknown>\n ): Promise<WMSFeatureInfo> {\n const url = this.getFeatureInfoURL(wmsParameters, vendorParameters);\n const response = await this.fetch(url);\n const arrayBuffer = await response.arrayBuffer();\n this._checkResponse(response, arrayBuffer);\n return await WMSFeatureInfoLoader.parse(arrayBuffer, this.loadOptions);\n }\n\n /** Get Feature Info for a coordinate */\n async getFeatureInfoText(\n wmsParameters: WMSGetFeatureInfoParameters,\n vendorParameters?: Record<string, unknown>\n ): Promise<string> {\n const url = this.getFeatureInfoURL(wmsParameters, vendorParameters);\n const response = await this.fetch(url);\n const arrayBuffer = await response.arrayBuffer();\n this._checkResponse(response, arrayBuffer);\n return new TextDecoder().decode(arrayBuffer);\n }\n\n /** Get more information about a layer */\n async describeLayer(\n wmsParameters: WMSDescribeLayerParameters,\n vendorParameters?: Record<string, unknown>\n ): Promise<WMSLayerDescription> {\n const url = this.describeLayerURL(wmsParameters, vendorParameters);\n const response = await this.fetch(url);\n const arrayBuffer = await response.arrayBuffer();\n this._checkResponse(response, arrayBuffer);\n return await WMSLayerDescriptionLoader.parse(arrayBuffer, this.loadOptions);\n }\n\n /** Get an image with a semantic legend */\n async getLegendGraphic(\n wmsParameters: WMSGetLegendGraphicParameters,\n vendorParameters?: Record<string, unknown>\n ): Promise<ImageType> {\n const url = this.getLegendGraphicURL(wmsParameters, vendorParameters);\n const response = await this.fetch(url);\n const arrayBuffer = await response.arrayBuffer();\n this._checkResponse(response, arrayBuffer);\n try {\n return await ImageLoader.parse(arrayBuffer, this.loadOptions);\n } catch {\n throw this._parseError(arrayBuffer);\n }\n }\n\n // Typed URL creators\n // For applications that want full control of fetching and parsing\n\n /** Generate a URL for the GetCapabilities request */\n getCapabilitiesURL(\n wmsParameters?: WMSGetCapabilitiesParameters,\n vendorParameters?: Record<string, unknown>\n ): string {\n const options: Required<WMSGetCapabilitiesParameters> = {\n version: this.wmsParameters.version,\n ...wmsParameters\n };\n return this._getWMSUrl('GetCapabilities', options, vendorParameters);\n }\n\n /** Generate a URL for the GetMap request */\n getMapURL(\n wmsParameters: WMSGetMapParameters,\n vendorParameters?: Record<string, unknown>\n ): string {\n wmsParameters = this._getWMS130Parameters(wmsParameters);\n const options: Required<WMSGetMapParameters> = {\n version: this.wmsParameters.version,\n format: this.wmsParameters.format,\n transparent: this.wmsParameters.transparent,\n time: this.wmsParameters.time,\n elevation: this.wmsParameters.elevation,\n layers: this.wmsParameters.layers,\n styles: this.wmsParameters.styles,\n crs: this.wmsParameters.crs,\n // bbox: [-77.87304, 40.78975, -77.85828, 40.80228],\n // width: 1200,\n // height: 900,\n ...wmsParameters\n };\n return this._getWMSUrl('GetMap', options, vendorParameters);\n }\n\n /** Generate a URL for the GetFeatureInfo request */\n getFeatureInfoURL(\n wmsParameters: WMSGetFeatureInfoParameters,\n vendorParameters?: Record<string, unknown>\n ): string {\n wmsParameters = this._getWMS130Parameters(wmsParameters);\n const options: Required<WMSGetFeatureInfoParameters> = {\n version: this.wmsParameters.version,\n // query_layers: [],\n // format: this.wmsParameters.format,\n info_format: this.wmsParameters.info_format,\n layers: this.wmsParameters.layers,\n query_layers: this.wmsParameters.query_layers,\n styles: this.wmsParameters.styles,\n crs: this.wmsParameters.crs,\n // bbox: [-77.87304, 40.78975, -77.85828, 40.80228],\n // width: 1200,\n // height: 900,\n // x: undefined!,\n // y: undefined!,\n ...wmsParameters\n };\n return this._getWMSUrl('GetFeatureInfo', options, vendorParameters);\n }\n\n /** Generate a URL for the GetFeatureInfo request */\n describeLayerURL(\n wmsParameters: WMSDescribeLayerParameters,\n vendorParameters?: Record<string, unknown>\n ): string {\n const options: Required<WMSDescribeLayerParameters> = {\n version: this.wmsParameters.version,\n ...wmsParameters\n };\n return this._getWMSUrl('DescribeLayer', options, vendorParameters);\n }\n\n getLegendGraphicURL(\n wmsParameters: WMSGetLegendGraphicParameters,\n vendorParameters?: Record<string, unknown>\n ): string {\n const options: Required<WMSGetLegendGraphicParameters> = {\n version: this.wmsParameters.version,\n // format?\n ...wmsParameters\n };\n return this._getWMSUrl('GetLegendGraphic', options, vendorParameters);\n }\n\n // INTERNAL METHODS\n\n _parseWMSUrl(url: string): {url: string; parameters: Record<string, unknown>} {\n const [baseUrl, search] = url.split('?');\n const searchParams = search.split('&');\n\n const parameters: Record<string, unknown> = {};\n for (const parameter of searchParams) {\n const [key, value] = parameter.split('=');\n parameters[key] = value;\n }\n\n return {url: baseUrl, parameters};\n }\n\n /**\n * Generate a URL with parameters\n * @note case _getWMSUrl may need to be overridden to handle certain backends?\n * @note at the moment, only URLs with parameters are supported (no XML payloads)\n * */\n protected _getWMSUrl(\n request: string,\n wmsParameters: {version?: '1.3.0' | '1.1.1'; [key: string]: unknown},\n vendorParameters?: Record<string, unknown>\n ): string {\n let url = this.url;\n let first = true;\n\n // Add any vendor searchParams\n const allParameters = {\n service: 'WMS',\n version: wmsParameters.version,\n request,\n ...wmsParameters,\n ...this.vendorParameters,\n ...vendorParameters\n };\n\n // Encode the keys\n const IGNORE_EMPTY_KEYS = ['transparent', 'time', 'elevation'];\n for (const [key, value] of Object.entries(allParameters)) {\n // hack to preserve test cases. Not super clear if keys should be included when values are undefined\n if (!IGNORE_EMPTY_KEYS.includes(key) || value) {\n url += first ? '?' : '&';\n first = false;\n url += this._getURLParameter(key, value, wmsParameters);\n }\n }\n\n return encodeURI(url);\n }\n\n _getWMS130Parameters<ParametersT extends {crs?: string; srs?: string}>(\n wmsParameters: ParametersT\n ): ParametersT {\n const newParameters = {...wmsParameters};\n if (newParameters.srs) {\n newParameters.crs = newParameters.crs || newParameters.srs;\n delete newParameters.srs;\n }\n return newParameters;\n }\n\n // eslint-disable-complexity\n _getURLParameter(key: string, value: unknown, wmsParameters: WMSParameters): string {\n // Substitute by key\n switch (key) {\n case 'crs':\n // CRS was called SRS before WMS 1.3.0\n if (wmsParameters.version !== '1.3.0') {\n key = 'srs';\n } else if (this.substituteCRS84 && value === 'EPSG:4326') {\n /** In 1.3.0, replaces references to 'EPSG:4326' with the new backwards compatible CRS:84 */\n // Substitute by value\n value = 'CRS:84';\n }\n break;\n\n case 'srs':\n // CRS was called SRS before WMS 1.3.0\n if (wmsParameters.version === '1.3.0') {\n key = 'crs';\n }\n break;\n\n case 'bbox':\n // Coordinate order is flipped for certain CRS in WMS 1.3.0\n const bbox = this._flipBoundingBox(value, wmsParameters);\n if (bbox) {\n value = bbox;\n }\n break;\n\n default:\n // do nothing\n }\n\n key = key.toUpperCase();\n\n return Array.isArray(value)\n ? `${key}=${value.join(',')}`\n : `${key}=${value ? String(value) : ''}`;\n }\n\n /** Coordinate order is flipped for certain CRS in WMS 1.3.0 */\n _flipBoundingBox(\n bboxValue: unknown,\n wmsParameters: WMSParameters\n ): [number, number, number, number] | null {\n // Sanity checks\n if (!Array.isArray(bboxValue) || bboxValue.length !== 4) {\n return null;\n }\n\n const flipCoordinates =\n // Only affects WMS 1.3.0\n wmsParameters.version === '1.3.0' &&\n // Flip if we are dealing with a CRS that was flipped in 1.3.0\n this.flipCRS.includes(wmsParameters.crs || '') &&\n // Don't flip if we are subsituting EPSG:4326 with CRS:84\n !(this.substituteCRS84 && wmsParameters.crs === 'EPSG:4326');\n\n const bbox = bboxValue as [number, number, number, number];\n return flipCoordinates ? [bbox[1], bbox[0], bbox[3], bbox[2]] : bbox;\n }\n\n /** Fetches an array buffer and checks the response (boilerplate reduction) */\n protected async _fetchArrayBuffer(url: string): Promise<ArrayBuffer> {\n const response = await this.fetch(url);\n const arrayBuffer = await response.arrayBuffer();\n this._checkResponse(response, arrayBuffer);\n return arrayBuffer;\n }\n\n /** Checks for and parses a WMS XML formatted ServiceError and throws an exception */\n protected _checkResponse(response: Response, arrayBuffer: ArrayBuffer): void {\n const contentType = response.headers['content-type'];\n if (!response.ok || WMSErrorLoader.mimeTypes.includes(contentType)) {\n // We want error responses to throw exceptions, the WMSErrorLoader can do this\n const loadOptions = mergeLoaderOptions<WMSLoaderOptions>(this.loadOptions, {\n wms: {throwOnError: true}\n });\n const error = WMSErrorLoader.parseSync?.(arrayBuffer, loadOptions);\n throw new Error(error);\n }\n }\n\n /** Error situation detected */\n protected _parseError(arrayBuffer: ArrayBuffer): Error {\n const error = WMSErrorLoader.parseSync?.(arrayBuffer, this.loadOptions);\n return new Error(error);\n }\n}\n"],"mappings":"AAKA,SAAQA,WAAW,QAAO,oBAAoB;AAC9C,SAAQC,kBAAkB,QAAO,0BAA0B;AAG3D,SAAQC,WAAW,QAAO,0BAA0B;AAAC,SAO7CC,qBAAqB;AAAA,SACrBC,oBAAoB;AAAA,SACpBC,yBAAyB;AAAA,SAGzBC,cAAc;AAEtB,OAAO,MAAMC,UAA8C,GAAG;EAC5DC,IAAI,EAAE,KAAK;EACXC,OAAO,EAAGC,GAAW,IAAcA,GAAG,CAACC,WAAW,CAAC,CAAC,CAACC,QAAQ,CAAC,KAAK,CAAC;EACpEC,MAAM,EAAGC,KAAqB,IAAK,IAAIC,SAAS,CAACD,KAAK;AACxD,CAAC;AAwJD,OAAO,MAAMC,SAAS,S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uBAAxBA,sBAAA,CAAAF,IAAA,CAAA9F,cAAc,EAAaqC,WAAW,EAAE,IAAI,CAACG,WAAW,CAAC;IACvE,OAAO,IAAIuD,KAAK,CAACH,KAAK,CAAC;EACzB;AACF"}
|
|
1
|
+
{"version":3,"file":"wms-service.js","names":["ImageLoader","mergeLoaderOptions","ImageSource","WMSCapabilitiesLoader","WMSFeatureInfoLoader","WMSLayerDescriptionLoader","WMSErrorLoader","WMSService","type","testURL","url","toLowerCase","includes","create","props","WMSSource","constructor","_props$substituteCRS","data","substituteCRS84","flipCRS","wmsParameters","vendorParameters","capabilities","layers","undefined","query_layers","styles","version","crs","format","info_format","transparent","time","elevation","getMetadata","getCapabilities","normalizeMetadata","getImage","parameters","getMap","getCapabilitiesURL","response","fetch","arrayBuffer","_checkResponse","parse","loadOptions","getMapURL","_parseError","getFeatureInfo","getFeatureInfoURL","getFeatureInfoText","TextDecoder","decode","describeLayer","describeLayerURL","getLegendGraphic","getLegendGraphicURL","options","_getWMSUrl","_getWMS130Parameters","_parseWMSUrl","baseUrl","search","split","searchParams","parameter","key","value","request","first","allParameters","service","IGNORE_EMPTY_KEYS","Object","entries","_getURLParameter","encodeURI","newParameters","srs","boundingBox","bbox2","_flipBoundingBox","bbox","toUpperCase","Array","isArray","join","String","bboxValue","length","flipCoordinates","_fetchArrayBuffer","contentType","headers","ok","mimeTypes","_WMSErrorLoader$parse","wms","throwOnError","error","parseSync","call","Error","_WMSErrorLoader$parse2"],"sources":["../../../src/services/ogc/wms-service.ts"],"sourcesContent":["// loaders.gl, MIT license\n// Copyright (c) vis.gl contributors\n\n/* eslint-disable camelcase */\nimport type {ImageType} from '@loaders.gl/images';\nimport {ImageLoader} from '@loaders.gl/images';\nimport {mergeLoaderOptions} from '@loaders.gl/loader-utils';\n\nimport type {Service, ImageSourceMetadata, GetImageParameters} from '@loaders.gl/loader-utils';\nimport {ImageSource} from '@loaders.gl/loader-utils';\nimport type {ImageServiceProps} from '../../lib/services/image-service';\n\nimport type {WMSCapabilities} from '../../wms-capabilities-loader';\nimport type {WMSFeatureInfo} from '../../wip/wms-feature-info-loader';\nimport type {WMSLayerDescription} from '../../wip/wms-layer-description-loader';\n\nimport {WMSCapabilitiesLoader} from '../../wms-capabilities-loader';\nimport {WMSFeatureInfoLoader} from '../../wip/wms-feature-info-loader';\nimport {WMSLayerDescriptionLoader} from '../../wip/wms-layer-description-loader';\n\nimport type {WMSLoaderOptions} from '../../wms-error-loader';\nimport {WMSErrorLoader} from '../../wms-error-loader';\n\nexport const WMSService: Service<WMSSource, WMSSourceProps> = {\n type: 'wms',\n testURL: (url: string): boolean => url.toLowerCase().includes('wms'),\n create: (props: WMSSourceProps) => new WMSSource(props)\n};\n\n/**\n * \"Static\" WMS parameters (not viewport or selected pixel dependent)\n * These can be provided as defaults in the WMSSource constructor\n */\nexport type WMSParameters = {\n /** WMS version (all requests) */\n version?: '1.3.0' | '1.1.1';\n /** Layers to render (GetMap, GetFeatureInfo) */\n layers?: string[];\n /** list of layers to query.. (GetFeatureInfo) */\n query_layers?: string[];\n\n /** Coordinate Reference System (CRS) for the image (not the bounding box) */\n crs?: string;\n /** Requested format for the return image (GetMap, GetLegendGraphic) */\n format?: 'image/png';\n /** Requested MIME type of returned feature info (GetFeatureInfo) */\n info_format?: 'text/plain' | 'application/geojson' | 'application/vnd.ogc.gml';\n /** Styling - Not yet supported */\n styles?: unknown;\n /** Any additional parameters specific to this WMSSource (GetMap) */\n transparent?: boolean;\n /** If layer supports time dimension */\n time?: string;\n /** If layer supports elevation dimension */\n elevation?: string;\n};\n\n/** Parameters for GetCapabilities */\nexport type WMSGetCapabilitiesParameters = {\n /** In case the endpoint supports multiple WMS versions */\n version?: '1.3.0' | '1.1.1';\n};\n\n/** Parameters for GetMap */\nexport type WMSGetMapParameters = {\n /** In case the endpoint supports multiple WMS versions */\n version?: '1.3.0' | '1.1.1';\n /** bounding box of the requested map image `[[w, s], [e, n]]` */\n // boundingBox: [min: [x: number, y: number], max: [x: number, y: number]];\n /** bounding box of the requested map image @deprecated Use .boundingBox */\n bbox: [number, number, number, number];\n /** pixel width of returned image */\n width: number;\n /** pixels */\n height: number;\n /** requested format for the return image. can be provided in service constructor */\n format?: 'image/png';\n /** Layers to render - can be provided in service constructor */\n layers?: string | string[];\n /** Coordinate Reference System for the image (not bounding box). can be provided in service constructor. */\n crs?: string;\n /** Styling. can be provided in service constructor */\n styles?: unknown;\n /** Don't render background when no data. can be provided in service constructor */\n transparent?: boolean;\n /** If layer supports time dimension */\n time?: string;\n /** If layer supports elevation dimension */\n elevation?: string;\n};\n\n// /** GetMap parameters that are specific to the current view */\n// export type WMSGetMapViewParameters = {\n// /** pixel width of returned image */\n// width: number;\n// /** pixels */\n// height: number;\n// /** bounding box of the requested map image */\n// bbox: [number, number, number, number];\n// /** Coordinate Reference System for the image (not bounding box). can be provided in service constructor. */\n// crs?: string;\n// };\n\n/**\n * Parameters for GetFeatureInfo\n * @see https://imagery.pasda.psu.edu/arcgis/services/pasda/UrbanTreeCanopy_Landcover/MapServer/WmsServer?SERVICE=WMS&\n */\nexport type WMSGetFeatureInfoParameters = {\n /** In case the endpoint supports multiple WMS versions */\n version?: '1.3.0' | '1.1.1';\n /** x coordinate for the feature info request */\n x: number;\n /** y coordinate for the feature info request */\n y: number;\n /** MIME type of returned feature info. Can be specified in service constructor */\n info_format?: 'text/plain' | 'application/geojson' | 'application/vnd.ogc.gml';\n /** list of layers to query. Required but can be specified in service constructor. */\n query_layers?: string[];\n /** Layers to render. Required, but can be specified in service constructor */\n layers?: string[];\n /** Styling */\n styles?: unknown;\n /** bounding box of the requested map image */\n bbox: [number, number, number, number];\n /** pixel width of returned image */\n width: number;\n /** pixels */\n height: number;\n /** srs for the image (not the bounding box) */\n crs?: string;\n};\n\n/** GetMap parameters that are specific to the current view */\nexport type WMSGetFeatureInfoViewParameters = {\n /** x coordinate for the feature info request */\n x: number;\n /** y coordinate for the feature info request */\n y: number;\n /** pixel width of returned image */\n width: number;\n /** pixels */\n height: number;\n /** bounding box of the requested map image */\n bbox: [number, number, number, number];\n /** srs for the image (not the bounding box) */\n crs?: string;\n};\n\n/** Parameters for DescribeLayer */\nexport type WMSDescribeLayerParameters = {\n /** In case the endpoint supports multiple WMS versions */\n version?: '1.3.0' | '1.1.1';\n};\n\n/** Parameters for GetLegendGraphic */\nexport type WMSGetLegendGraphicParameters = {\n /** In case the endpoint supports multiple WMS versions */\n version?: '1.3.0' | '1.1.1';\n};\n\n//\n\n/** Properties for creating a enw WMS service */\nexport type WMSSourceProps = ImageServiceProps & {\n /** Base URL to the service */\n url: string;\n /** In 1.3.0, replaces references to EPSG:4326 with CRS:84 */\n substituteCRS84?: boolean;\n /** Default WMS parameters. If not provided here, must be provided in the various request */\n wmsParameters?: WMSParameters;\n /** Any additional service specific parameters */\n vendorParameters?: Record<string, unknown>;\n};\n\n/**\n * The WMSSource class provides\n * - provides type safe methods to form URLs to a WMS service\n * - provides type safe methods to query and parse results (and errors) from a WMS service\n * - implements the ImageService interface\n * @note Only the URL parameter conversion is supported. XML posts are not supported.\n */\nexport class WMSSource extends ImageSource<WMSSourceProps> {\n /** Base URL to the service */\n readonly url: string;\n readonly data: string;\n\n /** In WMS 1.3.0, replaces references to EPSG:4326 with CRS:84. But not always supported. Default: false */\n substituteCRS84: boolean;\n /** In WMS 1.3.0, flips x,y (lng, lat) coordinates for the supplied coordinate systems. Default: ['ESPG:4326'] */\n flipCRS: string[];\n\n /** Default static WMS parameters */\n wmsParameters: Required<WMSParameters>;\n /** Default static vendor parameters */\n vendorParameters?: Record<string, unknown>;\n\n capabilities: WMSCapabilities | null = null;\n\n /** Create a WMSSource */\n constructor(props: WMSSourceProps) {\n super(props);\n\n // TODO - defaults such as version, layers etc could be extracted from a base URL with parameters\n // This would make pasting in any WMS URL more likely to make this class just work.\n // const {baseUrl, parameters} = this._parseWMSUrl(props.url);\n\n this.url = props.url;\n this.data = props.url;\n\n this.substituteCRS84 = props.substituteCRS84 ?? false;\n this.flipCRS = ['EPSG:4326'];\n\n this.wmsParameters = {\n layers: undefined!,\n query_layers: undefined!,\n styles: undefined,\n version: '1.3.0',\n crs: 'EPSG:4326',\n format: 'image/png',\n info_format: 'text/plain',\n transparent: undefined!,\n time: undefined!,\n elevation: undefined!,\n ...props.wmsParameters\n };\n\n this.vendorParameters = props.vendorParameters || {};\n }\n\n // ImageService implementation\n async getMetadata(): Promise<ImageSourceMetadata> {\n const capabilities = await this.getCapabilities();\n return this.normalizeMetadata(capabilities);\n }\n\n async getImage(parameters: GetImageParameters): Promise<ImageType> {\n // @ts-expect-error\n return await this.getMap(parameters);\n }\n\n normalizeMetadata(capabilities: WMSCapabilities): ImageSourceMetadata {\n return capabilities;\n }\n\n // WMS Service API Stubs\n\n /** Get Capabilities */\n async getCapabilities(\n wmsParameters?: WMSGetCapabilitiesParameters,\n vendorParameters?: Record<string, unknown>\n ): Promise<WMSCapabilities> {\n const url = this.getCapabilitiesURL(wmsParameters, vendorParameters);\n const response = await this.fetch(url);\n const arrayBuffer = await response.arrayBuffer();\n this._checkResponse(response, arrayBuffer);\n const capabilities = await WMSCapabilitiesLoader.parse(arrayBuffer, this.loadOptions);\n this.capabilities = capabilities;\n return capabilities;\n }\n\n /** Get a map image */\n async getMap(\n wmsParameters: WMSGetMapParameters,\n vendorParameters?: Record<string, unknown>\n ): Promise<ImageType> {\n const url = this.getMapURL(wmsParameters, vendorParameters);\n const response = await this.fetch(url);\n const arrayBuffer = await response.arrayBuffer();\n this._checkResponse(response, arrayBuffer);\n try {\n return await ImageLoader.parse(arrayBuffer, this.loadOptions);\n } catch {\n throw this._parseError(arrayBuffer);\n }\n }\n\n /** Get Feature Info for a coordinate */\n async getFeatureInfo(\n wmsParameters: WMSGetFeatureInfoParameters,\n vendorParameters?: Record<string, unknown>\n ): Promise<WMSFeatureInfo> {\n const url = this.getFeatureInfoURL(wmsParameters, vendorParameters);\n const response = await this.fetch(url);\n const arrayBuffer = await response.arrayBuffer();\n this._checkResponse(response, arrayBuffer);\n return await WMSFeatureInfoLoader.parse(arrayBuffer, this.loadOptions);\n }\n\n /** Get Feature Info for a coordinate */\n async getFeatureInfoText(\n wmsParameters: WMSGetFeatureInfoParameters,\n vendorParameters?: Record<string, unknown>\n ): Promise<string> {\n const url = this.getFeatureInfoURL(wmsParameters, vendorParameters);\n const response = await this.fetch(url);\n const arrayBuffer = await response.arrayBuffer();\n this._checkResponse(response, arrayBuffer);\n return new TextDecoder().decode(arrayBuffer);\n }\n\n /** Get more information about a layer */\n async describeLayer(\n wmsParameters: WMSDescribeLayerParameters,\n vendorParameters?: Record<string, unknown>\n ): Promise<WMSLayerDescription> {\n const url = this.describeLayerURL(wmsParameters, vendorParameters);\n const response = await this.fetch(url);\n const arrayBuffer = await response.arrayBuffer();\n this._checkResponse(response, arrayBuffer);\n return await WMSLayerDescriptionLoader.parse(arrayBuffer, this.loadOptions);\n }\n\n /** Get an image with a semantic legend */\n async getLegendGraphic(\n wmsParameters: WMSGetLegendGraphicParameters,\n vendorParameters?: Record<string, unknown>\n ): Promise<ImageType> {\n const url = this.getLegendGraphicURL(wmsParameters, vendorParameters);\n const response = await this.fetch(url);\n const arrayBuffer = await response.arrayBuffer();\n this._checkResponse(response, arrayBuffer);\n try {\n return await ImageLoader.parse(arrayBuffer, this.loadOptions);\n } catch {\n throw this._parseError(arrayBuffer);\n }\n }\n\n // Typed URL creators\n // For applications that want full control of fetching and parsing\n\n /** Generate a URL for the GetCapabilities request */\n getCapabilitiesURL(\n wmsParameters?: WMSGetCapabilitiesParameters,\n vendorParameters?: Record<string, unknown>\n ): string {\n const options: Required<WMSGetCapabilitiesParameters> = {\n version: this.wmsParameters.version,\n ...wmsParameters\n };\n return this._getWMSUrl('GetCapabilities', options, vendorParameters);\n }\n\n /** Generate a URL for the GetMap request */\n getMapURL(\n wmsParameters: WMSGetMapParameters,\n vendorParameters?: Record<string, unknown>\n ): string {\n wmsParameters = this._getWMS130Parameters(wmsParameters);\n const options: Required<WMSGetMapParameters> = {\n version: this.wmsParameters.version,\n format: this.wmsParameters.format,\n transparent: this.wmsParameters.transparent,\n time: this.wmsParameters.time,\n elevation: this.wmsParameters.elevation,\n layers: this.wmsParameters.layers,\n styles: this.wmsParameters.styles,\n crs: this.wmsParameters.crs,\n // bbox: [-77.87304, 40.78975, -77.85828, 40.80228],\n // width: 1200,\n // height: 900,\n ...wmsParameters\n };\n return this._getWMSUrl('GetMap', options, vendorParameters);\n }\n\n /** Generate a URL for the GetFeatureInfo request */\n getFeatureInfoURL(\n wmsParameters: WMSGetFeatureInfoParameters,\n vendorParameters?: Record<string, unknown>\n ): string {\n wmsParameters = this._getWMS130Parameters(wmsParameters);\n const options: Required<WMSGetFeatureInfoParameters> = {\n version: this.wmsParameters.version,\n // query_layers: [],\n // format: this.wmsParameters.format,\n info_format: this.wmsParameters.info_format,\n layers: this.wmsParameters.layers,\n query_layers: this.wmsParameters.query_layers,\n styles: this.wmsParameters.styles,\n crs: this.wmsParameters.crs,\n // bbox: [-77.87304, 40.78975, -77.85828, 40.80228],\n // width: 1200,\n // height: 900,\n // x: undefined!,\n // y: undefined!,\n ...wmsParameters\n };\n return this._getWMSUrl('GetFeatureInfo', options, vendorParameters);\n }\n\n /** Generate a URL for the GetFeatureInfo request */\n describeLayerURL(\n wmsParameters: WMSDescribeLayerParameters,\n vendorParameters?: Record<string, unknown>\n ): string {\n const options: Required<WMSDescribeLayerParameters> = {\n version: this.wmsParameters.version,\n ...wmsParameters\n };\n return this._getWMSUrl('DescribeLayer', options, vendorParameters);\n }\n\n getLegendGraphicURL(\n wmsParameters: WMSGetLegendGraphicParameters,\n vendorParameters?: Record<string, unknown>\n ): string {\n const options: Required<WMSGetLegendGraphicParameters> = {\n version: this.wmsParameters.version,\n // format?\n ...wmsParameters\n };\n return this._getWMSUrl('GetLegendGraphic', options, vendorParameters);\n }\n\n // INTERNAL METHODS\n\n _parseWMSUrl(url: string): {url: string; parameters: Record<string, unknown>} {\n const [baseUrl, search] = url.split('?');\n const searchParams = search.split('&');\n\n const parameters: Record<string, unknown> = {};\n for (const parameter of searchParams) {\n const [key, value] = parameter.split('=');\n parameters[key] = value;\n }\n\n return {url: baseUrl, parameters};\n }\n\n /**\n * Generate a URL with parameters\n * @note case _getWMSUrl may need to be overridden to handle certain backends?\n * @note at the moment, only URLs with parameters are supported (no XML payloads)\n * */\n protected _getWMSUrl(\n request: string,\n wmsParameters: {version?: '1.3.0' | '1.1.1'; [key: string]: unknown},\n vendorParameters?: Record<string, unknown>\n ): string {\n let url = this.url;\n let first = true;\n\n // Add any vendor searchParams\n const allParameters = {\n service: 'WMS',\n version: wmsParameters.version,\n request,\n ...wmsParameters,\n ...this.vendorParameters,\n ...vendorParameters\n };\n\n // Encode the keys\n const IGNORE_EMPTY_KEYS = ['transparent', 'time', 'elevation'];\n for (const [key, value] of Object.entries(allParameters)) {\n // hack to preserve test cases. Not super clear if keys should be included when values are undefined\n if (!IGNORE_EMPTY_KEYS.includes(key) || value) {\n url += first ? '?' : '&';\n first = false;\n url += this._getURLParameter(key, value, wmsParameters);\n }\n }\n\n return encodeURI(url);\n }\n\n _getWMS130Parameters<ParametersT extends {crs?: string; srs?: string}>(\n wmsParameters: ParametersT\n ): ParametersT {\n const newParameters = {...wmsParameters};\n if (newParameters.srs) {\n newParameters.crs = newParameters.crs || newParameters.srs;\n delete newParameters.srs;\n }\n return newParameters;\n }\n\n // eslint-disable-complexity\n _getURLParameter(key: string, value: unknown, wmsParameters: WMSParameters): string {\n // Substitute by key\n switch (key) {\n case 'crs':\n // CRS was called SRS before WMS 1.3.0\n if (wmsParameters.version !== '1.3.0') {\n key = 'srs';\n } else if (this.substituteCRS84 && value === 'EPSG:4326') {\n /** In 1.3.0, replaces references to 'EPSG:4326' with the new backwards compatible CRS:84 */\n // Substitute by value\n value = 'CRS:84';\n }\n break;\n\n case 'srs':\n // CRS was called SRS before WMS 1.3.0\n if (wmsParameters.version === '1.3.0') {\n key = 'crs';\n }\n break;\n\n case 'boundingBox':\n // Coordinate order is flipped for certain CRS in WMS 1.3.0\n const boundingBox = value as [[number, number], [number, number]];\n let bbox2: number[] | null = [...boundingBox[0], ...boundingBox[1]];\n bbox2 = this._flipBoundingBox(boundingBox, wmsParameters);\n if (bbox2) {\n value = bbox2;\n }\n break;\n\n case 'bbox':\n // Coordinate order is flipped for certain CRS in WMS 1.3.0\n const bbox = this._flipBoundingBox(value, wmsParameters);\n if (bbox) {\n value = bbox;\n }\n break;\n\n default:\n // do nothing\n }\n\n key = key.toUpperCase();\n\n return Array.isArray(value)\n ? `${key}=${value.join(',')}`\n : `${key}=${value ? String(value) : ''}`;\n }\n\n /** Coordinate order is flipped for certain CRS in WMS 1.3.0 */\n _flipBoundingBox(\n bboxValue: unknown,\n wmsParameters: WMSParameters\n ): [number, number, number, number] | null {\n // Sanity checks\n if (!Array.isArray(bboxValue) || bboxValue.length !== 4) {\n return null;\n }\n\n const flipCoordinates =\n // Only affects WMS 1.3.0\n wmsParameters.version === '1.3.0' &&\n // Flip if we are dealing with a CRS that was flipped in 1.3.0\n this.flipCRS.includes(wmsParameters.crs || '') &&\n // Don't flip if we are subsituting EPSG:4326 with CRS:84\n !(this.substituteCRS84 && wmsParameters.crs === 'EPSG:4326');\n\n const bbox = bboxValue as [number, number, number, number];\n return flipCoordinates ? [bbox[1], bbox[0], bbox[3], bbox[2]] : bbox;\n }\n\n /** Fetches an array buffer and checks the response (boilerplate reduction) */\n protected async _fetchArrayBuffer(url: string): Promise<ArrayBuffer> {\n const response = await this.fetch(url);\n const arrayBuffer = await response.arrayBuffer();\n this._checkResponse(response, arrayBuffer);\n return arrayBuffer;\n }\n\n /** Checks for and parses a WMS XML formatted ServiceError and throws an exception */\n protected _checkResponse(response: Response, arrayBuffer: ArrayBuffer): void {\n const contentType = response.headers['content-type'];\n if (!response.ok || WMSErrorLoader.mimeTypes.includes(contentType)) {\n // We want error responses to throw exceptions, the WMSErrorLoader can do this\n const loadOptions = mergeLoaderOptions<WMSLoaderOptions>(this.loadOptions, {\n wms: {throwOnError: true}\n });\n const error = WMSErrorLoader.parseSync?.(arrayBuffer, loadOptions);\n throw new Error(error);\n }\n }\n\n /** Error situation detected */\n protected _parseError(arrayBuffer: ArrayBuffer): Error {\n const error = WMSErrorLoader.parseSync?.(arrayBuffer, this.loadOptions);\n return new Error(error);\n }\n}\n"],"mappings":"AAKA,SAAQA,WAAW,QAAO,oBAAoB;AAC9C,SAAQC,kBAAkB,QAAO,0BAA0B;AAG3D,SAAQC,WAAW,QAAO,0BAA0B;AAAC,SAO7CC,qBAAqB;AAAA,SACrBC,oBAAoB;AAAA,SACpBC,yBAAyB;AAAA,SAGzBC,cAAc;AAEtB,OAAO,MAAMC,UAA8C,GAAG;EAC5DC,IAAI,EAAE,KAAK;EACXC,OAAO,EAAGC,GAAW,IAAcA,GAAG,CAACC,WAAW,CAAC,CAAC,CAACC,QAAQ,CAAC,KAAK,CAAC;EACpEC,MAAM,EAAGC,KAAqB,IAAK,IAAIC,SAAS,CAACD,KAAK;AACxD,CAAC;AA0JD,OAAO,MAAMC,SAAS,SAASb,WAAW,CAAiB;EAkBzDc,WAAWA,CAACF,KAAqB,EAAE;IAAA,IAAAG,oBAAA;IACjC,KAAK,CAACH,KAAK,CAAC;IAAC,KAjBNJ,GAAG;IAAA,KACHQ,IAAI;IAAA,KAGbC,eAAe;IAAA,KAEfC,OAAO;IAAA,KAGPC,aAAa;IAAA,KAEbC,gBAAgB;IAAA,KAEhBC,YAAY,GAA2B,IAAI;IAUzC,IAAI,CAACb,GAAG,GAAGI,KAAK,CAACJ,GAAG;IACpB,IAAI,CAACQ,IAAI,GAAGJ,KAAK,CAACJ,GAAG;IAErB,IAAI,CAACS,eAAe,IAAAF,oBAAA,GAAGH,KAAK,CAACK,eAAe,cAAAF,oBAAA,cAAAA,oBAAA,GAAI,KAAK;IACrD,IAAI,CAACG,OAAO,GAAG,CAAC,WAAW,CAAC;IAE5B,IAAI,CAACC,aAAa,GAAG;MACnBG,MAAM,EAAEC,SAAU;MAClBC,YAAY,EAAED,SAAU;M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|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"description": "Framework-independent loaders for the WMS (Web Map Service) standard",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -51,12 +51,12 @@
|
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@babel/runtime": "^7.3.1",
|
|
54
|
-
"@loaders.gl/images": "4.0.
|
|
55
|
-
"@loaders.gl/loader-utils": "4.0.
|
|
56
|
-
"@loaders.gl/schema": "4.0.
|
|
57
|
-
"@loaders.gl/xml": "4.0.
|
|
54
|
+
"@loaders.gl/images": "4.0.2",
|
|
55
|
+
"@loaders.gl/loader-utils": "4.0.2",
|
|
56
|
+
"@loaders.gl/schema": "4.0.2",
|
|
57
|
+
"@loaders.gl/xml": "4.0.2",
|
|
58
58
|
"@turf/rewind": "^5.1.5",
|
|
59
59
|
"deep-strict-equal": "^0.2.0"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "471058d109d5652f28c32c1f296fd632f9a5c806"
|
|
62
62
|
}
|
|
@@ -21,7 +21,7 @@ export type ImageServiceProps = {
|
|
|
21
21
|
* ImageSource allows template url strings to be used to ad hoc connect to arbitrary image data sources
|
|
22
22
|
* Accepts a template url string and builds requests URLs
|
|
23
23
|
*/
|
|
24
|
-
export class ImageService<
|
|
24
|
+
export abstract class ImageService<
|
|
25
25
|
PropsT extends ImageServiceProps = ImageServiceProps
|
|
26
26
|
> extends ImageSource<PropsT> {
|
|
27
27
|
static type: string = 'template';
|
|
@@ -49,7 +49,7 @@ export class ImageService<
|
|
|
49
49
|
|
|
50
50
|
/** Break up bounding box in east, north, south, west */
|
|
51
51
|
protected getGranularParameters(parameters: GetImageParameters): Record<string, unknown> {
|
|
52
|
-
const [east, north, west, south] = parameters.
|
|
52
|
+
const [[east, north], [west, south]] = parameters.boundingBox;
|
|
53
53
|
return {...parameters, east, north, south, west};
|
|
54
54
|
}
|
|
55
55
|
|
|
@@ -20,8 +20,11 @@ export type ArcGISImageServerProps = ImageServiceProps & {
|
|
|
20
20
|
* @see https://developers.arcgis.com/rest/services-reference/enterprise/image-service.htm
|
|
21
21
|
*/
|
|
22
22
|
export class ArcGISImageSource extends ImageService<ArcGISImageServerProps> {
|
|
23
|
+
data: string;
|
|
24
|
+
|
|
23
25
|
constructor(props: ArcGISImageServerProps) {
|
|
24
26
|
super(props);
|
|
27
|
+
this.data = props.url;
|
|
25
28
|
}
|
|
26
29
|
|
|
27
30
|
// ImageSource (normalized endpoints)
|
|
@@ -68,6 +68,8 @@ export class CSWService extends DataSource<CSWServiceProps> {
|
|
|
68
68
|
static testURL = (url: string): boolean => url.toLowerCase().includes('csw');
|
|
69
69
|
|
|
70
70
|
capabilities: CSWCapabilities | null = null;
|
|
71
|
+
data: string;
|
|
72
|
+
url: string;
|
|
71
73
|
|
|
72
74
|
/** A list of loaders used by the CSWService methods */
|
|
73
75
|
readonly loaders = [CSWErrorLoader, CSWCapabilitiesLoader];
|
|
@@ -75,6 +77,8 @@ export class CSWService extends DataSource<CSWServiceProps> {
|
|
|
75
77
|
/** Create a CSWService */
|
|
76
78
|
constructor(props: CSWServiceProps) {
|
|
77
79
|
super(props);
|
|
80
|
+
this.url = props.url;
|
|
81
|
+
this.data = props.url;
|
|
78
82
|
}
|
|
79
83
|
|
|
80
84
|
async getMetadata(): Promise<CSWCapabilities> {
|
|
@@ -65,7 +65,9 @@ export type WMSGetCapabilitiesParameters = {
|
|
|
65
65
|
export type WMSGetMapParameters = {
|
|
66
66
|
/** In case the endpoint supports multiple WMS versions */
|
|
67
67
|
version?: '1.3.0' | '1.1.1';
|
|
68
|
-
/** bounding box of the requested map image */
|
|
68
|
+
/** bounding box of the requested map image `[[w, s], [e, n]]` */
|
|
69
|
+
// boundingBox: [min: [x: number, y: number], max: [x: number, y: number]];
|
|
70
|
+
/** bounding box of the requested map image @deprecated Use .boundingBox */
|
|
69
71
|
bbox: [number, number, number, number];
|
|
70
72
|
/** pixel width of returned image */
|
|
71
73
|
width: number;
|
|
@@ -87,17 +89,17 @@ export type WMSGetMapParameters = {
|
|
|
87
89
|
elevation?: string;
|
|
88
90
|
};
|
|
89
91
|
|
|
90
|
-
/** GetMap parameters that are specific to the current view */
|
|
91
|
-
export type WMSGetMapViewParameters = {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
};
|
|
92
|
+
// /** GetMap parameters that are specific to the current view */
|
|
93
|
+
// export type WMSGetMapViewParameters = {
|
|
94
|
+
// /** pixel width of returned image */
|
|
95
|
+
// width: number;
|
|
96
|
+
// /** pixels */
|
|
97
|
+
// height: number;
|
|
98
|
+
// /** bounding box of the requested map image */
|
|
99
|
+
// bbox: [number, number, number, number];
|
|
100
|
+
// /** Coordinate Reference System for the image (not bounding box). can be provided in service constructor. */
|
|
101
|
+
// crs?: string;
|
|
102
|
+
// };
|
|
101
103
|
|
|
102
104
|
/**
|
|
103
105
|
* Parameters for GetFeatureInfo
|
|
@@ -180,6 +182,7 @@ export type WMSSourceProps = ImageServiceProps & {
|
|
|
180
182
|
export class WMSSource extends ImageSource<WMSSourceProps> {
|
|
181
183
|
/** Base URL to the service */
|
|
182
184
|
readonly url: string;
|
|
185
|
+
readonly data: string;
|
|
183
186
|
|
|
184
187
|
/** In WMS 1.3.0, replaces references to EPSG:4326 with CRS:84. But not always supported. Default: false */
|
|
185
188
|
substituteCRS84: boolean;
|
|
@@ -202,6 +205,7 @@ export class WMSSource extends ImageSource<WMSSourceProps> {
|
|
|
202
205
|
// const {baseUrl, parameters} = this._parseWMSUrl(props.url);
|
|
203
206
|
|
|
204
207
|
this.url = props.url;
|
|
208
|
+
this.data = props.url;
|
|
205
209
|
|
|
206
210
|
this.substituteCRS84 = props.substituteCRS84 ?? false;
|
|
207
211
|
this.flipCRS = ['EPSG:4326'];
|
|
@@ -230,6 +234,7 @@ export class WMSSource extends ImageSource<WMSSourceProps> {
|
|
|
230
234
|
}
|
|
231
235
|
|
|
232
236
|
async getImage(parameters: GetImageParameters): Promise<ImageType> {
|
|
237
|
+
// @ts-expect-error
|
|
233
238
|
return await this.getMap(parameters);
|
|
234
239
|
}
|
|
235
240
|
|
|
@@ -493,6 +498,16 @@ export class WMSSource extends ImageSource<WMSSourceProps> {
|
|
|
493
498
|
}
|
|
494
499
|
break;
|
|
495
500
|
|
|
501
|
+
case 'boundingBox':
|
|
502
|
+
// Coordinate order is flipped for certain CRS in WMS 1.3.0
|
|
503
|
+
const boundingBox = value as [[number, number], [number, number]];
|
|
504
|
+
let bbox2: number[] | null = [...boundingBox[0], ...boundingBox[1]];
|
|
505
|
+
bbox2 = this._flipBoundingBox(boundingBox, wmsParameters);
|
|
506
|
+
if (bbox2) {
|
|
507
|
+
value = bbox2;
|
|
508
|
+
}
|
|
509
|
+
break;
|
|
510
|
+
|
|
496
511
|
case 'bbox':
|
|
497
512
|
// Coordinate order is flipped for certain CRS in WMS 1.3.0
|
|
498
513
|
const bbox = this._flipBoundingBox(value, wmsParameters);
|