@loaders.gl/wms 3.3.0-alpha.13 → 3.3.0-alpha.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/dist/dist.min.js +182 -1046
  2. package/dist/es5/index.js +20 -13
  3. package/dist/es5/index.js.map +1 -1
  4. package/dist/es5/lerc-loader.js +1 -1
  5. package/dist/es5/lib/data-sources/adhoc-image-service.js +4 -0
  6. package/dist/es5/lib/data-sources/adhoc-image-service.js.map +1 -1
  7. package/dist/es5/lib/data-sources/arcgis-image-service.js +180 -0
  8. package/dist/es5/lib/data-sources/arcgis-image-service.js.map +1 -0
  9. package/dist/es5/lib/data-sources/create-image-source.js +45 -0
  10. package/dist/es5/lib/data-sources/create-image-source.js.map +1 -0
  11. package/dist/es5/lib/data-sources/image-services/arcgis-image-service.js +179 -0
  12. package/dist/es5/lib/data-sources/image-services/arcgis-image-service.js.map +1 -0
  13. package/dist/es5/lib/data-sources/image-services/image-service.js +163 -0
  14. package/dist/es5/lib/data-sources/image-services/image-service.js.map +1 -0
  15. package/dist/es5/lib/data-sources/{wms-service.js → image-services/wms-service.js} +116 -75
  16. package/dist/es5/lib/data-sources/image-services/wms-service.js.map +1 -0
  17. package/dist/es5/wip/arcgis-feature-service.js +45 -0
  18. package/dist/es5/wip/arcgis-feature-service.js.map +1 -0
  19. package/dist/es5/wip/data-source.js.map +1 -1
  20. package/dist/es5/wip/gml-loader.js +1 -1
  21. package/dist/es5/wip/wcs-capabilities-loader.js +1 -1
  22. package/dist/es5/wip/wfs-capabilities-loader.js +1 -1
  23. package/dist/es5/wip/wmts-capabilities-loader.js +1 -1
  24. package/dist/es5/wms-capabilities-loader.js +1 -1
  25. package/dist/es5/wms-error-loader.js +1 -1
  26. package/dist/esm/index.js +5 -5
  27. package/dist/esm/index.js.map +1 -1
  28. package/dist/esm/lerc-loader.js +1 -1
  29. package/dist/esm/lib/data-sources/adhoc-image-service.js +2 -0
  30. package/dist/esm/lib/data-sources/adhoc-image-service.js.map +1 -1
  31. package/dist/esm/lib/data-sources/arcgis-image-service.js +62 -0
  32. package/dist/esm/lib/data-sources/arcgis-image-service.js.map +1 -0
  33. package/dist/esm/lib/data-sources/create-image-source.js +30 -0
  34. package/dist/esm/lib/data-sources/create-image-source.js.map +1 -0
  35. package/dist/esm/lib/data-sources/image-services/arcgis-image-service.js +61 -0
  36. package/dist/esm/lib/data-sources/image-services/arcgis-image-service.js.map +1 -0
  37. package/dist/esm/lib/data-sources/image-services/image-service.js +72 -0
  38. package/dist/esm/lib/data-sources/image-services/image-service.js.map +1 -0
  39. package/dist/esm/lib/data-sources/{wms-service.js → image-services/wms-service.js} +46 -32
  40. package/dist/esm/lib/data-sources/image-services/wms-service.js.map +1 -0
  41. package/dist/esm/wip/arcgis-feature-service.js +28 -0
  42. package/dist/esm/wip/arcgis-feature-service.js.map +1 -0
  43. package/dist/esm/wip/data-source.js.map +1 -1
  44. package/dist/esm/wip/gml-loader.js +1 -1
  45. package/dist/esm/wip/wcs-capabilities-loader.js +1 -1
  46. package/dist/esm/wip/wfs-capabilities-loader.js +1 -1
  47. package/dist/esm/wip/wmts-capabilities-loader.js +1 -1
  48. package/dist/esm/wms-capabilities-loader.js +1 -1
  49. package/dist/esm/wms-error-loader.js +1 -1
  50. package/dist/index.d.ts +9 -7
  51. package/dist/index.d.ts.map +1 -1
  52. package/dist/index.js +14 -8
  53. package/dist/lib/data-sources/adhoc-image-service.d.ts +2 -0
  54. package/dist/lib/data-sources/adhoc-image-service.d.ts.map +1 -1
  55. package/dist/lib/data-sources/adhoc-image-service.js +2 -0
  56. package/dist/lib/data-sources/arcgis-image-service.d.ts +79 -0
  57. package/dist/lib/data-sources/arcgis-image-service.d.ts.map +1 -0
  58. package/dist/lib/data-sources/arcgis-image-service.js +85 -0
  59. package/dist/lib/data-sources/create-image-source.d.ts +16 -0
  60. package/dist/lib/data-sources/create-image-source.d.ts.map +1 -0
  61. package/dist/lib/data-sources/create-image-source.js +39 -0
  62. package/dist/lib/data-sources/image-services/arcgis-image-service.d.ts +71 -0
  63. package/dist/lib/data-sources/image-services/arcgis-image-service.d.ts.map +1 -0
  64. package/dist/lib/data-sources/image-services/arcgis-image-service.js +85 -0
  65. package/dist/lib/data-sources/image-services/image-service.d.ts +39 -0
  66. package/dist/lib/data-sources/image-services/image-service.d.ts.map +1 -0
  67. package/dist/lib/data-sources/image-services/image-service.js +82 -0
  68. package/dist/lib/data-sources/{wms-service.d.ts → image-services/wms-service.d.ts} +33 -38
  69. package/dist/lib/data-sources/image-services/wms-service.d.ts.map +1 -0
  70. package/dist/lib/data-sources/{wms-service.js → image-services/wms-service.js} +40 -28
  71. package/dist/wip/arcgis-feature-service.d.ts +56 -0
  72. package/dist/wip/arcgis-feature-service.d.ts.map +1 -0
  73. package/dist/wip/arcgis-feature-service.js +28 -0
  74. package/dist/wip/data-source.d.ts +14 -13
  75. package/dist/wip/data-source.d.ts.map +1 -1
  76. package/dist/wip/data-source.js +15 -13
  77. package/package.json +6 -6
  78. package/src/index.ts +13 -8
  79. package/src/lib/data-sources/adhoc-image-service.ts +3 -0
  80. package/src/lib/data-sources/arcgis-image-service.ts +146 -0
  81. package/src/lib/data-sources/create-image-source.ts +46 -0
  82. package/src/lib/data-sources/image-services/arcgis-image-service.ts +136 -0
  83. package/src/lib/data-sources/image-services/image-service.ts +105 -0
  84. package/src/lib/data-sources/{wms-service.ts → image-services/wms-service.ts} +51 -47
  85. package/src/wip/arcgis-feature-service.ts +89 -0
  86. package/src/wip/data-source.ts +15 -13
  87. package/dist/es5/lib/data-sources/wms-service.js.map +0 -1
  88. package/dist/esm/lib/data-sources/wms-service.js.map +0 -1
  89. package/dist/lib/data-sources/wms-service.d.ts.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wms-service.js","names":["ImageLoader","ImageSource","getFetchFunction","mergeImageServiceProps","WMSCapabilitiesLoader","WMSFeatureInfoLoader","WMSLayerDescriptionLoader","WMSErrorLoader","WMSService","constructor","props","fetch","loadOptions","wms","throwOnError","getMetadata","getCapabilities","getImage","parameters","getMap","wmsParameters","vendorParameters","url","getCapabilitiesURL","response","arrayBuffer","_checkResponse","capabilities","parse","options","getMapURL","_parseError","getFeatureInfo","getFeatureInfoURL","getFeatureInfoText","info_format","TextDecoder","decode","describeLayer","describeLayerURL","getLegendGraphic","getLegendGraphicURL","service","version","request","_getWMSUrl","styles","undefined","srs","format","first","key","value","Object","entries","Array","isArray","toUpperCase","join","String","encodeURI","contentType","headers","ok","mimeTypes","includes","error","parseSync","Error","toLowerCase"],"sources":["../../../../../src/lib/data-sources/image-services/wms-service.ts"],"sourcesContent":["// loaders.gl, MIT license\n\n/* eslint-disable camelcase */\n\nimport type {ImageType} from '@loaders.gl/images';\nimport {ImageLoader} from '@loaders.gl/images';\n\nimport type {ImageSourceMetadata, GetImageParameters} from '../image-source';\nimport {ImageSource} from '../image-source';\nimport {ImageServiceProps, getFetchFunction, mergeImageServiceProps} from './image-service';\n\nimport type {WMSCapabilities, WMSFeatureInfo, WMSLayerDescription} from '../../wms/wms-types';\nimport {WMSCapabilitiesLoader} from '../../../wms-capabilities-loader';\nimport {WMSFeatureInfoLoader} from '../../../wip/wms-feature-info-loader';\nimport {WMSLayerDescriptionLoader} from '../../../wip/wms-layer-description-loader';\nimport {WMSErrorLoader} from '../../../wms-error-loader';\n\ntype WMSCommonParameters = {\n /** In case the endpoint supports multiple services */\n service?: 'WMS';\n /** In case the endpoint supports multiple WMS versions */\n version?: '1.1.1' | '1.3.0';\n};\n\nexport type WMSGetCapabilitiesParameters = WMSCommonParameters & {\n /** Request type */\n request?: 'GetCapabilities';\n};\n\nexport type WMSGetMapParameters = WMSCommonParameters & {\n /** Request type */\n request?: 'GetMap';\n /** Layers to render */\n layers: string | 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 srs?: string;\n /** requested format for the return image */\n format?: 'image/png';\n};\n\n// https://imagery.pasda.psu.edu/arcgis/services/pasda/UrbanTreeCanopy_Landcover/MapServer/WmsServer?SERVICE=WMS&\nexport type WMSGetFeatureInfoParameters = WMSCommonParameters & {\n /** Request type */\n request?: 'GetFeatureInfo';\n\n /** x coordinate for the feature info request */\n x: number;\n /** y coordinate for the feature info request */\n y: number;\n /** list of layers to query (could be different from rendered layers) */\n query_layers: string[];\n /** MIME type of returned feature info */\n info_format?: 'text/plain' | 'application/vnd.ogc.gml';\n\n /** Layers to render */\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 srs?: string;\n /** requested format for the return image */\n format?: 'image/png';\n};\n\nexport type WMSDescribeLayerParameters = WMSCommonParameters & {\n /** Request type */\n request?: 'DescribeLayer';\n};\n\nexport type WMSGetLegendGraphicParameters = WMSCommonParameters & {\n /** Request type */\n request?: 'GetLegendGraphic';\n};\n\n/**\n * The WMSService 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 WMSService extends ImageSource {\n static type: 'wms' = 'wms';\n static testURL = (url: string): boolean => url.toLowerCase().includes('wms');\n\n props: Required<ImageServiceProps>;\n fetch: (url: string, options?: RequestInit) => Promise<Response>;\n capabilities: WMSCapabilities | null = null;\n\n /** A list of loaders used by the WMSService methods */\n readonly loaders = [\n ImageLoader,\n WMSErrorLoader,\n WMSCapabilitiesLoader,\n WMSFeatureInfoLoader,\n WMSLayerDescriptionLoader\n ];\n\n /** Create a WMSService */\n constructor(props: ImageServiceProps) {\n super();\n this.props = mergeImageServiceProps(props);\n this.fetch = getFetchFunction(this.props);\n this.props.loadOptions = {\n ...this.props.loadOptions,\n // We want error responses to throw exceptions, the WMSErrorLoader can do this\n wms: {...this.props.loadOptions?.wms, throwOnError: true}\n };\n }\n\n // ImageSource implementation\n getMetadata(): Promise<ImageSourceMetadata> {\n return this.getCapabilities();\n }\n\n getImage(parameters: GetImageParameters): Promise<ImageType> {\n return this.getMap(parameters);\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.props.loadOptions);\n this.capabilities = capabilities;\n return capabilities;\n }\n\n /** Get a map image */\n async getMap(\n options: WMSGetMapParameters,\n vendorParameters?: Record<string, unknown>\n ): Promise<ImageType> {\n const url = this.getMapURL(options, 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.props.loadOptions);\n } catch {\n throw this._parseError(arrayBuffer);\n }\n }\n\n /** Get Feature Info for a coordinate */\n async getFeatureInfo(\n options: WMSGetFeatureInfoParameters,\n vendorParameters?: Record<string, unknown>\n ): Promise<WMSFeatureInfo> {\n const url = this.getFeatureInfoURL(options, 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.props.loadOptions);\n }\n\n /** Get Feature Info for a coordinate */\n async getFeatureInfoText(\n options: WMSGetFeatureInfoParameters,\n vendorParameters?: Record<string, unknown>\n ): Promise<string> {\n options = {...options, info_format: 'text/plain'};\n const url = this.getFeatureInfoURL(options, 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 options: WMSDescribeLayerParameters,\n vendorParameters?: Record<string, unknown>\n ): Promise<WMSLayerDescription> {\n const url = this.describeLayerURL(options, 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.props.loadOptions);\n }\n\n /** Get an image with a semantic legend */\n async getLegendGraphic(\n options: WMSGetLegendGraphicParameters,\n vendorParameters?: Record<string, unknown>\n ): Promise<ImageType> {\n const url = this.getLegendGraphicURL(options, 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.props.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 service: 'WMS',\n version: '1.1.1',\n request: 'GetCapabilities',\n ...wmsParameters,\n ...vendorParameters\n };\n return this._getWMSUrl(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 const options: Required<WMSGetMapParameters> = {\n service: 'WMS',\n version: '1.1.1',\n request: 'GetMap',\n // layers: [],\n // bbox: [-77.87304, 40.78975, -77.85828, 40.80228],\n // width: 1200,\n // height: 900,\n styles: undefined,\n srs: 'EPSG:4326',\n format: 'image/png',\n ...wmsParameters,\n ...vendorParameters\n };\n return this._getWMSUrl(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 const options: Required<WMSGetFeatureInfoParameters> = {\n service: 'WMS',\n version: '1.1.1',\n request: 'GetFeatureInfo',\n // layers: [],\n // bbox: [-77.87304, 40.78975, -77.85828, 40.80228],\n // width: 1200,\n // height: 900,\n // x: undefined!,\n // y: undefined!,\n // query_layers: [],\n srs: 'EPSG:4326',\n format: 'image/png',\n info_format: 'text/plain',\n styles: undefined,\n ...wmsParameters,\n ...vendorParameters\n };\n return this._getWMSUrl(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 service: 'WMS',\n version: '1.1.1',\n request: 'DescribeLayer',\n ...wmsParameters,\n ...vendorParameters\n };\n return this._getWMSUrl(options, vendorParameters);\n }\n\n getLegendGraphicURL(\n wmsParameters: WMSGetLegendGraphicParameters,\n vendorParameters?: Record<string, unknown>\n ): string {\n const options: Required<WMSGetLegendGraphicParameters> = {\n service: 'WMS',\n version: '1.1.1',\n request: 'GetLegendGraphic',\n ...wmsParameters,\n ...vendorParameters\n };\n return this._getWMSUrl(options, vendorParameters);\n }\n\n // INTERNAL METHODS\n\n /**\n * @note case _getWMSUrl may need to be overridden to handle certain backends?\n * */\n protected _getWMSUrl(\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 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 const error = WMSErrorLoader.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 = WMSErrorLoader.parseSync(arrayBuffer, this.props.loadOptions);\n return new Error(error);\n }\n}\n"],"mappings":";;AAKA,SAAQA,WAAW,QAAO,oBAAoB;AAG9C,SAAQC,WAAW,QAAO,iBAAiB;AAC3C,SAA2BC,gBAAgB,EAAEC,sBAAsB,QAAO,iBAAiB;AAG3F,SAAQC,qBAAqB,QAAO,kCAAkC;AACtE,SAAQC,oBAAoB,QAAO,sCAAsC;AACzE,SAAQC,yBAAyB,QAAO,2CAA2C;AACnF,SAAQC,cAAc,QAAO,2BAA2B;AAgFxD,OAAO,MAAMC,UAAU,SAASP,WAAW,CAAC;;EAkB1CQ,WAAW,CAACC,KAAwB,EAAE;IAAA;IACpC,KAAK,EAAE;IAAC;IAAA;IAAA,sCAb6B,IAAI;IAAA,iCAGxB,CACjBV,WAAW,EACXO,cAAc,EACdH,qBAAqB,EACrBC,oBAAoB,EACpBC,yBAAyB,CAC1B;IAKC,IAAI,CAACI,KAAK,GAAGP,sBAAsB,CAACO,KAAK,CAAC;IAC1C,IAAI,CAACC,KAAK,GAAGT,gBAAgB,CAAC,IAAI,CAACQ,KAAK,CAAC;IACzC,IAAI,CAACA,KAAK,CAACE,WAAW,GAAG;MACvB,GAAG,IAAI,CAACF,KAAK,CAACE,WAAW;MAEzBC,GAAG,EAAE;QAAC,6BAAG,IAAI,CAACH,KAAK,CAACE,WAAW,0DAAtB,sBAAwBC,GAAG;QAAEC,YAAY,EAAE;MAAI;IAC1D,CAAC;EACH;;EAGAC,WAAW,GAAiC;IAC1C,OAAO,IAAI,CAACC,eAAe,EAAE;EAC/B;EAEAC,QAAQ,CAACC,UAA8B,EAAsB;IAC3D,OAAO,IAAI,CAACC,MAAM,CAACD,UAAU,CAAC;EAChC;;EAKA,MAAMF,eAAe,CACnBI,aAA4C,EAC5CC,gBAA0C,EAChB;IA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,SAAS,CAACtC,GAAG,CAAC;EACvB;;EAGUI,cAAc,CAACF,QAAkB,EAAEC,WAAwB,EAAQ;IAC3E,MAAMoC,WAAW,GAAGrC,QAAQ,CAACsC,OAAO,CAAC,cAAc,CAAC;IACpD,IAAI,CAACtC,QAAQ,CAACuC,EAAE,IAAIxD,cAAc,CAACyD,SAAS,CAACC,QAAQ,CAACJ,WAAW,CAAC,EAAE;MAClE,MAAMK,KAAK,GAAG3D,cAAc,CAAC4D,SAAS,CAAC1C,WAAW,EAAE,IAAI,CAACf,KAAK,CAACE,WAAW,CAAC;MAC3E,MAAM,IAAIwD,KAAK,CAACF,KAAK,CAAC;IACxB;EACF;;EAGUnC,WAAW,CAACN,WAAwB,EAAS;IACrD,MAAMyC,KAAK,GAAG3D,cAAc,CAAC4D,SAAS,CAAC1C,WAAW,EAAE,IAAI,CAACf,KAAK,CAACE,WAAW,CAAC;IAC3E,OAAO,IAAIwD,KAAK,CAACF,KAAK,CAAC;EACzB;AACF;AAAC,gBA/PY1D,UAAU,UACA,KAAK;AAAA,gBADfA,UAAU,aAEHc,GAAW,IAAcA,GAAG,CAAC+C,WAAW,EAAE,CAACJ,QAAQ,CAAC,KAAK,CAAC"}
@@ -0,0 +1,28 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+
3
+ export class ArcGISFeatureService {
4
+ constructor(props) {
5
+ _defineProperty(this, "url", void 0);
6
+ _defineProperty(this, "loadOptions", void 0);
7
+ _defineProperty(this, "fetch", void 0);
8
+ this.url = props.url;
9
+ this.loadOptions = props.loadOptions || {};
10
+ this.fetch = props.fetch || fetch;
11
+ }
12
+
13
+ metadataURL(options) {
14
+ return this.getUrl({
15
+ ...options
16
+ });
17
+ }
18
+
19
+ exportImageURL(options) {
20
+ const {
21
+ boundingBox
22
+ } = options;
23
+ return this.getUrl({
24
+ path: 'exportImage'
25
+ });
26
+ }
27
+ }
28
+ //# sourceMappingURL=arcgis-feature-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arcgis-feature-service.js","names":["ArcGISFeatureService","constructor","props","url","loadOptions","fetch","metadataURL","options","getUrl","exportImageURL","boundingBox","path"],"sources":["../../../src/wip/arcgis-feature-service.ts"],"sourcesContent":["// @ts-nocheck\n\nimport {LoaderOptions} from '@loaders.gl/loader-utils';\n// import {GeoJSONLoader} from '@loaders.gl/geojson';\n\ntype FetchLike = (url: string, options?: RequestInit) => Promise<Response>;\n\nexport type ArcGISImageServiceQueryOptions = {\n returnGeometry: boolean;\n where: '1%3D1';\n outSR: 4326;\n outFields: string | '*';\n inSR: 4326;\n geometry: `${-90}%2C+${30}%2C+${-70}%2C+${50}`;\n geometryType: 'esriGeometryEnvelope'; // TODO - look up valid values in Esri docs\n spatialRel: 'esriSpatialRelIntersects'; // TODO - look up valid values in Esri docs\n geometryPrecision: number; // TODO - look up valid values in Esri docs\n resultType: 'tile'; // TODO - look up valid values in Esri docs\n f?: 'geojson'; // TODO - look up valid values in Esri docs\n}\n\n// const DEFAULT_QUERY_OPTIONS: Required<ArcGISImageServiceQueryOptions> = {\n// returnGeometry:true,\n// where: '1%3D1',\n// outSR: 4326,\n// outFields: '*',\n// inSR: 4326,\n// geometry: `${-90}%2C+${30}%2C+${-70}%2C+${50}`,\n// geometryType: 'esriGeometryEnvelope',\n// spatialRel: 'esriSpatialRelIntersects',\n// geometryPrecision: 6,\n// resultType: 'tile',\n// f: 'geojson'\n// };\n\nexport type ArcGISFeatureServiceProps = ArcGISImageServiceQueryOptions & {\n url: string;\n loadOptions?: LoaderOptions;\n fetch?: typeof fetch | FetchLike;\n};\n\nexport class ArcGISFeatureService {\n url: string;\n loadOptions: LoaderOptions;\n fetch: typeof fetch | FetchLike;\n\n constructor(props: ArcGISFeatureServiceProps) {\n this.url = props.url;\n this.loadOptions = props.loadOptions || {};\n this.fetch = props.fetch || fetch;\n }\n\n // URL creators\n\n metadataURL(options: {parameters?: Record<string, unknown>}): string {\n return this.getUrl({...options});\n }\n\n /** \n * Form a URL to an ESRI FeatureServer\n// https://services2.arcgis.com/CcI36Pduqd0OR4W9/ArcGIS/rest/services/Bicycle_Routes_Public/FeatureServer/0/query?\n// returnGeometry=true&where=1%3D1&outSR=4326&outFields=*&inSR=4326&geometry=${-90}%2C+${30}%2C+${-70}%2C+${50}&\n// geometryType=esriGeometryEnvelope&spatialRel=esriSpatialRelIntersects&geometryPrecision=6&resultType=tile&f=geojson`\n */\n exportImageURL(options: {\n boundingBox: [number, number, number, number];\n boundingBoxSR?: string;\n width: number;\n height: number;\n imageSR?: string;\n time?: never;\n f?: 'geojson';\n resultType?: 'tile';\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 {boundingBox} = options;\n // const bbox = `bbox=${boundingBox[0]},${boundingBox[1]},${boundingBox[2]},${boundingBox[3]}`;\n // const size = `size=${width},${height}`\n return this.getUrl({path: 'exportImage', });\n }\n}\n"],"mappings":";;AAyCA,OAAO,MAAMA,oBAAoB,CAAC;EAKhCC,WAAW,CAACC,KAAgC,EAAE;IAAA;IAAA;IAAA;IAC5C,IAAI,CAACC,GAAG,GAAGD,KAAK,CAACC,GAAG;IACpB,IAAI,CAACC,WAAW,GAAGF,KAAK,CAACE,WAAW,IAAI,CAAC,CAAC;IAC1C,IAAI,CAACC,KAAK,GAAGH,KAAK,CAACG,KAAK,IAAIA,KAAK;EACnC;;EAIAC,WAAW,CAACC,OAA+C,EAAU;IACnE,OAAO,IAAI,CAACC,MAAM,CAAC;MAAC,GAAGD;IAAO,CAAC,CAAC;EAClC;;EAQAE,cAAc,CAACF,OAkBd,EAAU;IACT,MAAM;MAACG;IAAW,CAAC,GAAGH,OAAO;IAG7B,OAAO,IAAI,CAACC,MAAM,CAAC;MAACG,IAAI,EAAE;IAAe,CAAC,CAAC;EAC7C;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"data-source.js","names":[],"sources":["../../../src/wip/data-source.ts"],"sourcesContent":["// loaders.gl, MIT license\n\n/** General data source class */\n// export abstract class DataSource {};\n// export type DataSourceMetadata = {};\n\n// ImageSource\n\n\n/** Data source that serves data by tile index *\nexport abstract class TileDataSource extends DataSource {};\n\n// Vector Tile Source\n\nexport type VectorTileDataSourceCapabilities = {\n // check tile.json\n}\n\nexport type VectorTile = Record<string, any>;\n\nexport abstract class VectorTileDataSource extends TileDataSource {\n abstract getCapabilities(): Promise<VectorTileDataSourceCapabilities>;\n abstract getTile({x, y, z, width, height, layers, parameters}): Promise<VectorTile>;\n}\n\n// Image Tile Data Source\n\nexport type ImageTileDataSourceCapabilities = {\n}\n\nexport type ImageTile = Record<string, any>;\n\nexport type FeatureInfo = {};\n\nexport abstract class ImageTileDataSource extends TileDataSource {\n source: ImageDataSource;\n \n constructor(source: ImageDataSource) {\n super();\n this.source = source;\n }\n\n getCapabilities(): Promise<ImageTileDataSourceCapabilities> {\n return this.source.getCapabilities();\n }\n\n getTile({x, y, z, width, height, layers, parameters}): Promise<ImageType> {\n const boundingBox = this.getBoundingBoxFromTileIndex(x, y, z);\n return this.source.getImage({boundingBox, width, height, layers, parameters});\n }\n\n getFeatureInfo(): FeatureInfo | null {\n return null;\n }\n\n getBoundingBoxFromTileIndex(x: number, y: number, z: number): [number, number, number, number] {\n return [0, 0, 1, 1];\n }\n}\n*/\n"],"mappings":""}
1
+ {"version":3,"file":"data-source.js","names":[],"sources":["../../../src/wip/data-source.ts"],"sourcesContent":["// loaders.gl, MIT license\n\n/** General data source class */\n// export abstract class DataSource {};\n// export type DataSourceMetadata = {};\n\n// ImageSource\n\n// Tile Source\n\n/** Data source that serves data by tile index *\nexport abstract class TileDataSource extends DataSource {};\n\n// Image Tile Data Source\n\nexport type ImageTileDataSourceCapabilities = {\n}\n\nexport type ImageTile = Record<string, any>;\n\nexport type FeatureInfo = {};\n\nexport abstract class ImageTileDataSource extends TileDataSource {\n source: ImageDataSource;\n \n constructor(source: ImageDataSource) {\n super();\n this.source = source;\n }\n\n getCapabilities(): Promise<ImageTileDataSourceCapabilities> {\n return this.source.getCapabilities();\n }\n\n getTile({x, y, z, width, height, layers, parameters}): Promise<ImageType> {\n const boundingBox = this.getBoundingBoxFromTileIndex(x, y, z);\n return this.source.getImage({boundingBox, width, height, layers, parameters});\n }\n\n getFeatureInfo(): FeatureInfo | null {\n return null;\n }\n\n getBoundingBoxFromTileIndex(x: number, y: number, z: number): [number, number, number, number] {\n return [0, 0, 1, 1];\n }\n}\n\n// Vector Tile Source\n\nexport type VectorTileDataSourceCapabilities = {\n // check tile.json\n}\n\nexport type VectorTile = Record<string, any>;\n\nexport abstract class VectorTileDataSource extends TileDataSource {\n abstract getCapabilities(): Promise<VectorTileDataSourceCapabilities>;\n abstract getTile({x, y, z, width, height, layers, parameters}): Promise<VectorTile>;\n}\n\n*/\n"],"mappings":""}
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { parseGML } from '../lib/gml/parse-gml';
4
4
 
5
- const VERSION = typeof "3.3.0-alpha.13" !== 'undefined' ? "3.3.0-alpha.13" : 'latest';
5
+ const VERSION = typeof "3.3.0-alpha.14" !== 'undefined' ? "3.3.0-alpha.14" : 'latest';
6
6
  export const GMLLoader = {
7
7
  name: 'GML',
8
8
  id: 'gml',
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { parseWFSCapabilities } from '../lib/wcs/parse-wcs';
4
4
 
5
- const VERSION = typeof "3.3.0-alpha.13" !== 'undefined' ? "3.3.0-alpha.13" : 'latest';
5
+ const VERSION = typeof "3.3.0-alpha.14" !== 'undefined' ? "3.3.0-alpha.14" : 'latest';
6
6
  export const WCSCapabilitiesLoader = {
7
7
  id: 'wcs-capabilities',
8
8
  name: 'WFS Capabilities',
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { parseWFSCapabilities } from '../lib/wfs/parse-wfs';
4
4
 
5
- const VERSION = typeof "3.3.0-alpha.13" !== 'undefined' ? "3.3.0-alpha.13" : 'latest';
5
+ const VERSION = typeof "3.3.0-alpha.14" !== 'undefined' ? "3.3.0-alpha.14" : 'latest';
6
6
  export const WFSCapabilitiesLoader = {
7
7
  id: 'wfs-capabilities',
8
8
  name: 'WFS Capabilities',
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { parseWMTSCapabilities } from '../lib/wmts/parse-wmts';
4
4
 
5
- const VERSION = typeof "3.3.0-alpha.13" !== 'undefined' ? "3.3.0-alpha.13" : 'latest';
5
+ const VERSION = typeof "3.3.0-alpha.14" !== 'undefined' ? "3.3.0-alpha.14" : 'latest';
6
6
  export const WMTSCapabilitiesLoader = {
7
7
  id: 'wmts-capabilities',
8
8
  name: 'WMTS Capabilities',
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { parseWMSCapabilities } from './lib/wms/parse-wms';
4
4
 
5
- const VERSION = typeof "3.3.0-alpha.13" !== 'undefined' ? "3.3.0-alpha.13" : 'latest';
5
+ const VERSION = typeof "3.3.0-alpha.14" !== 'undefined' ? "3.3.0-alpha.14" : 'latest';
6
6
  export const WMSCapabilitiesLoader = {
7
7
  id: 'wms-capabilities',
8
8
  name: 'WMS Capabilities',
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { parseWMSError } from './lib/wms/parse-wms';
4
4
 
5
- const VERSION = typeof "3.3.0-alpha.13" !== 'undefined' ? "3.3.0-alpha.13" : 'latest';
5
+ const VERSION = typeof "3.3.0-alpha.14" !== 'undefined' ? "3.3.0-alpha.14" : 'latest';
6
6
  export const WMSErrorLoader = {
7
7
  id: 'wms-error',
8
8
  name: 'WMS Error',
package/dist/index.d.ts CHANGED
@@ -2,11 +2,15 @@ export { WMSErrorLoader } from './wms-error-loader';
2
2
  export type { WMSLoaderOptions } from './wms-capabilities-loader';
3
3
  export type { WMSCapabilities } from './lib/wms/wms-types';
4
4
  export { WMSCapabilitiesLoader } from './wms-capabilities-loader';
5
- export type { WMSServiceProps } from './lib/data-sources/wms-service';
6
- export { WMSService } from './lib/data-sources/wms-service';
7
- export type { ImageSourceMetadata as _ImageSourceMetadata } from './lib/data-sources/image-source';
8
- export { ImageSource as _ImageSource } from './lib/data-sources/image-source';
9
- export { AdHocImageService as _AdHocImageService } from './lib/data-sources/adhoc-image-service';
5
+ export type { ImageSourceMetadata } from './lib/data-sources/image-source';
6
+ export type { ImageType } from '@loaders.gl/images';
7
+ export { ImageSource } from './lib/data-sources/image-source';
8
+ export type { ImageServiceType } from './lib/data-sources/create-image-source';
9
+ export { createImageSource } from './lib/data-sources/create-image-source';
10
+ export type { ImageServiceProps } from './lib/data-sources/image-services/image-service';
11
+ export { ImageService } from './lib/data-sources/image-services/image-service';
12
+ export { WMSService } from './lib/data-sources/image-services/wms-service';
13
+ export { ArcGISImageService as _ArcGISImageService } from './lib/data-sources/image-services/arcgis-image-service';
10
14
  export type { WMSFeatureInfo as _WMSFeatureInfo } from './lib/wms/wms-types';
11
15
  export { WMSFeatureInfoLoader as _WMSFeatureInfoLoader } from './wip/wms-feature-info-loader';
12
16
  export type { WMSLayerDescription as _WMSLayerDescription } from './lib/wms/wms-types';
@@ -20,6 +24,4 @@ export { WFSCapabilitiesLoader as _WFSCapabilitiesLoader } from './wip/wfs-capab
20
24
  export type { GeoJSON as _GeoJSON } from '@loaders.gl/schema';
21
25
  export type { GMLLoaderOptions as _GMLLoaderOptions } from './wip/gml-loader';
22
26
  export { GMLLoader as _GMLLoader } from './wip/gml-loader';
23
- export type { LERCData } from './lib/lerc/lerc-types';
24
- export { LERCLoader } from './lerc-loader';
25
27
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,cAAc,EAAC,MAAM,oBAAoB,CAAC;AAElD,YAAY,EAAC,gBAAgB,EAAC,MAAM,2BAA2B,CAAC;AAEhE,YAAY,EAAC,eAAe,EAAC,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAC,qBAAqB,EA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C;AAC5F,OAAO,EAAC,sBAAsB,IAAI,uBAAuB,EAAC,MAAM,gCAAgC,CAAC;AAIjG,YAAY,EAAC,eAAe,IAAI,gBAAgB,EAAC,MAAM,qBAAqB,CAAC;AAC7E,YAAY,EAAC,gBAAgB,IAAI,iBAAiB,EAAC,MAAM,+BAA+B,CAAC;AACzF,OAAO,EAAC,qBAAqB,IAAI,sBAAsB,EAAC,MAAM,+BAA+B,CAAC;AAI9F,YAAY,EAAC,OAAO,IAAI,QAAQ,EAAC,MAAM,oBAAoB,CAAC;AAC5D,YAAY,EAAC,gBAAgB,IAAI,iBAAiB,EAAC,MAAM,kBAAkB,CAAC;AAC5E,OAAO,EAAC,SAAS,IAAI,UAAU,EAAC,MAAM,kBAAkB,CAAC"}
package/dist/index.js CHANGED
@@ -1,18 +1,22 @@
1
1
  "use strict";
2
2
  // loaders.gl, MIT license
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.LERCLoader = exports._GMLLoader = exports._WFSCapabilitiesLoader = exports._WMTSCapabilitiesLoader = exports._WMSLayerDescriptionLoader = exports._WMSFeatureInfoLoader = exports._AdHocImageService = exports._ImageSource = exports.WMSService = exports.WMSCapabilitiesLoader = exports.WMSErrorLoader = void 0;
4
+ exports._GMLLoader = exports._WFSCapabilitiesLoader = exports._WMTSCapabilitiesLoader = exports._WMSLayerDescriptionLoader = exports._WMSFeatureInfoLoader = exports._ArcGISImageService = exports.WMSService = exports.ImageService = exports.createImageSource = exports.ImageSource = exports.WMSCapabilitiesLoader = exports.WMSErrorLoader = void 0;
5
5
  // WMS
6
6
  var wms_error_loader_1 = require("./wms-error-loader");
7
7
  Object.defineProperty(exports, "WMSErrorLoader", { enumerable: true, get: function () { return wms_error_loader_1.WMSErrorLoader; } });
8
8
  var wms_capabilities_loader_1 = require("./wms-capabilities-loader");
9
9
  Object.defineProperty(exports, "WMSCapabilitiesLoader", { enumerable: true, get: function () { return wms_capabilities_loader_1.WMSCapabilitiesLoader; } });
10
- var wms_service_1 = require("./lib/data-sources/wms-service");
11
- Object.defineProperty(exports, "WMSService", { enumerable: true, get: function () { return wms_service_1.WMSService; } });
12
10
  var image_source_1 = require("./lib/data-sources/image-source");
13
- Object.defineProperty(exports, "_ImageSource", { enumerable: true, get: function () { return image_source_1.ImageSource; } });
14
- var adhoc_image_service_1 = require("./lib/data-sources/adhoc-image-service");
15
- Object.defineProperty(exports, "_AdHocImageService", { enumerable: true, get: function () { return adhoc_image_service_1.AdHocImageService; } });
11
+ Object.defineProperty(exports, "ImageSource", { enumerable: true, get: function () { return image_source_1.ImageSource; } });
12
+ var create_image_source_1 = require("./lib/data-sources/create-image-source");
13
+ Object.defineProperty(exports, "createImageSource", { enumerable: true, get: function () { return create_image_source_1.createImageSource; } });
14
+ var image_service_1 = require("./lib/data-sources/image-services/image-service");
15
+ Object.defineProperty(exports, "ImageService", { enumerable: true, get: function () { return image_service_1.ImageService; } });
16
+ var wms_service_1 = require("./lib/data-sources/image-services/wms-service");
17
+ Object.defineProperty(exports, "WMSService", { enumerable: true, get: function () { return wms_service_1.WMSService; } });
18
+ var arcgis_image_service_1 = require("./lib/data-sources/image-services/arcgis-image-service");
19
+ Object.defineProperty(exports, "_ArcGISImageService", { enumerable: true, get: function () { return arcgis_image_service_1.ArcGISImageService; } });
16
20
  var wms_feature_info_loader_1 = require("./wip/wms-feature-info-loader");
17
21
  Object.defineProperty(exports, "_WMSFeatureInfoLoader", { enumerable: true, get: function () { return wms_feature_info_loader_1.WMSFeatureInfoLoader; } });
18
22
  var wms_layer_description_loader_1 = require("./wip/wms-layer-description-loader");
@@ -23,5 +27,7 @@ var wfs_capabilities_loader_1 = require("./wip/wfs-capabilities-loader");
23
27
  Object.defineProperty(exports, "_WFSCapabilitiesLoader", { enumerable: true, get: function () { return wfs_capabilities_loader_1.WFSCapabilitiesLoader; } });
24
28
  var gml_loader_1 = require("./wip/gml-loader");
25
29
  Object.defineProperty(exports, "_GMLLoader", { enumerable: true, get: function () { return gml_loader_1.GMLLoader; } });
26
- var lerc_loader_1 = require("./lerc-loader");
27
- Object.defineProperty(exports, "LERCLoader", { enumerable: true, get: function () { return lerc_loader_1.LERCLoader; } });
30
+ // LERC
31
+ // TODO - restore once esbuild bundling issues have been resolved
32
+ // export type {LERCData} from './lib/lerc/lerc-types.js';
33
+ // export {LERCLoader} from './lerc-loader.js';
@@ -11,6 +11,8 @@ export type AdHocImageServiceProps = {
11
11
  * Accepts a template url string and builds requests URLs
12
12
  */
13
13
  export declare class AdHocImageService extends ImageSource {
14
+ static type: 'template';
15
+ static testURL: (url: string) => boolean;
14
16
  templateUrl: string;
15
17
  constructor(props: AdHocImageServiceProps);
16
18
  getMetadata(): Promise<ImageSourceMetadata>;
@@ -1 +1 @@
1
- {"version":3,"file":"adhoc-image-service.d.ts","sourceRoot":"","sources":["../../../src/lib/data-sources/adhoc-image-service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAGlD,OAAO,KAAK,EAAC,mBAAmB,EAAE,kBAAkB,EAAC,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAE3C,MAAM,MAAM,sBAAsB,GAAG;IACnC,mFAAmF;IACnF,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;GAIG;AACH,qBAAa,iBAAkB,SAAQ,WAAW;IAChD,WAAW,EAAE,MAAM,CAAC;gBAER,KAAK,EAAE,sBAAsB;IAOnC,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,SAAS,CAAC,kBAAkB,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM;CAS1E"}
1
+ {"version":3,"file":"adhoc-image-service.d.ts","sourceRoot":"","sources":["../../../src/lib/data-sources/adhoc-image-service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAGlD,OAAO,KAAK,EAAC,mBAAmB,EAAE,kBAAkB,EAAC,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAE3C,MAAM,MAAM,sBAAsB,GAAG;IACnC,mFAAmF;IACnF,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;GAIG;AACH,qBAAa,iBAAkB,SAAQ,WAAW;IAChD,MAAM,CAAC,IAAI,EAAE,UAAU,CAAc;IACrC,MAAM,CAAC,OAAO,QAAS,MAAM,KAAG,OAAO,CAAoC;IAE3E,WAAW,EAAE,MAAM,CAAC;gBAER,KAAK,EAAE,sBAAsB;IAOnC,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,SAAS,CAAC,kBAAkB,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM;CAS1E"}
@@ -42,3 +42,5 @@ class AdHocImageService extends image_source_1.ImageSource {
42
42
  }
43
43
  }
44
44
  exports.AdHocImageService = AdHocImageService;
45
+ AdHocImageService.type = 'template';
46
+ AdHocImageService.testURL = (url) => url.toLowerCase().includes('{');
@@ -0,0 +1,79 @@
1
+ import { LoaderOptions } from '@loaders.gl/loader-utils';
2
+ import { /* ImageLoader, */ ImageType } from '@loaders.gl/images';
3
+ import type { ImageSourceMetadata, GetImageParameters } from './image-source';
4
+ import { ImageSource } from './image-source';
5
+ type FetchLike = (url: string, options?: RequestInit) => Promise<Response>;
6
+ export type ArcGISImageServiceProps = {
7
+ url: string;
8
+ loadOptions?: LoaderOptions;
9
+ fetch?: typeof fetch | FetchLike;
10
+ };
11
+ export declare class ArcGISImageService extends ImageSource {
12
+ static type: 'arcgis-image-server';
13
+ static testURL: (url: string) => boolean;
14
+ url: string;
15
+ loadOptions: LoaderOptions;
16
+ fetch: typeof fetch | FetchLike;
17
+ constructor(props: ArcGISImageServiceProps);
18
+ getMetadata(): Promise<ImageSourceMetadata>;
19
+ getImage(parameters: GetImageParameters): Promise<ImageType>;
20
+ info(): Promise<unknown>;
21
+ /**
22
+ * Form a URL to an ESRI ImageServer
23
+ // 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`,
24
+ */
25
+ exportImage(options: {
26
+ boundingBox: [number, number, number, number];
27
+ boundingBoxSR?: string;
28
+ width: number;
29
+ height: number;
30
+ imageSR?: string;
31
+ time?: never;
32
+ format?: 'jpgpng';
33
+ pixelType?: 'U8';
34
+ noData?: never;
35
+ noDataInterpretation?: 'esriNoDataMatchAny';
36
+ interpolation?: '+RSP_NearestNeighbor';
37
+ compression?: never;
38
+ compressionQuality?: never;
39
+ bandIds?: never;
40
+ mosaicRule?: never;
41
+ renderingRule?: never;
42
+ f?: 'image';
43
+ }): Promise<ImageType>;
44
+ infoURL(options: {
45
+ parameters?: Record<string, unknown>;
46
+ }): string;
47
+ /**
48
+ * Form a URL to an ESRI ImageServer
49
+ // 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`,
50
+ */
51
+ exportImageURL(options: {
52
+ boundingBox: [number, number, number, number];
53
+ boundingBoxSR?: string;
54
+ width: number;
55
+ height: number;
56
+ imageSR?: string;
57
+ time?: never;
58
+ format?: 'jpgpng';
59
+ pixelType?: 'U8';
60
+ noData?: never;
61
+ noDataInterpretation?: 'esriNoDataMatchAny';
62
+ interpolation?: '+RSP_NearestNeighbor';
63
+ compression?: never;
64
+ compressionQuality?: never;
65
+ bandIds?: never;
66
+ mosaicRule?: never;
67
+ renderingRule?: never;
68
+ f?: 'image';
69
+ }): string;
70
+ /**
71
+ * @note protected, since perhaps getWMSUrl may need to be overridden to handle certain backends?
72
+ * @note if override is common, maybe add a callback prop?
73
+ * */
74
+ protected getUrl(options: Record<string, unknown>, extra?: Record<string, unknown>): string;
75
+ /** Checks for and parses a WMS XML formatted ServiceError and throws an exception */
76
+ protected checkResponse(response: Response): Promise<void>;
77
+ }
78
+ export {};
79
+ //# sourceMappingURL=arcgis-image-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arcgis-image-service.d.ts","sourceRoot":"","sources":["../../../src/lib/data-sources/arcgis-image-service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,aAAa,EAAC,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAC,kBAAkB,CAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAChE,OAAO,KAAK,EAAC,mBAAmB,EAAE,kBAAkB,EAAC,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAE3C,KAAK,SAAS,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,KAAK,OAAO,C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IT license
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.ArcGISImageService = void 0;
5
+ const image_source_1 = require("./image-source");
6
+ class ArcGISImageService extends image_source_1.ImageSource {
7
+ constructor(props) {
8
+ super();
9
+ this.url = props.url;
10
+ this.loadOptions = props.loadOptions || {};
11
+ this.fetch = props.fetch || fetch;
12
+ }
13
+ // ImageSource (normalized endpoints)
14
+ async getMetadata() {
15
+ return (await this.info());
16
+ // TODO - normalize metadata
17
+ }
18
+ async getImage(parameters) {
19
+ throw new Error('not implemented');
20
+ // TODO - Map generic parameters to ArcGIS specific parameters
21
+ // return await this.exportImage(parameters);
22
+ }
23
+ // ImageServer endpoints
24
+ async info() {
25
+ // We just need a JSON parsing...
26
+ // return this.getUrl({path: '', ...options});
27
+ throw new Error('not implemented');
28
+ }
29
+ /**
30
+ * Form a URL to an ESRI ImageServer
31
+ // https://sampleserver6.arcgisonline.com/arcgis/rest/services/NLCDLandCover2001/ImageServer/exportImage?bbox=${bounds[0]},${bounds[1]},${bounds[2]},${bounds[3]}&bboxSR=4326&size=${width},${height}&imageSR=102100&time=&format=jpgpng&pixelType=U8&noData=&noDataInterpretation=esriNoDataMatchAny&interpolation=+RSP_NearestNeighbor&compression=&compressionQuality=&bandIds=&mosaicRule=&renderingRule=&f=image`,
32
+ */
33
+ exportImage(options) {
34
+ // See WMSService.getMap()
35
+ throw new Error('not implemented');
36
+ }
37
+ // URL creators
38
+ infoURL(options) {
39
+ return this.url;
40
+ // return this.getUrl({path: '', ...options});
41
+ }
42
+ /**
43
+ * Form a URL to an ESRI ImageServer
44
+ // https://sampleserver6.arcgisonline.com/arcgis/rest/services/NLCDLandCover2001/ImageServer/exportImage?bbox=${bounds[0]},${bounds[1]},${bounds[2]},${bounds[3]}&bboxSR=4326&size=${width},${height}&imageSR=102100&time=&format=jpgpng&pixelType=U8&noData=&noDataInterpretation=esriNoDataMatchAny&interpolation=+RSP_NearestNeighbor&compression=&compressionQuality=&bandIds=&mosaicRule=&renderingRule=&f=image`,
45
+ */
46
+ exportImageURL(options) {
47
+ // const {boundingBox} = options;
48
+ // const bbox = `bbox=${boundingBox[0]},${boundingBox[1]},${boundingBox[2]},${boundingBox[3]}`;
49
+ // const size = `size=${width},${height}`;
50
+ // return this.getUrl({path: 'exportImage'});
51
+ return this.url;
52
+ }
53
+ // INTERNAL METHODS
54
+ /**
55
+ * @note protected, since perhaps getWMSUrl may need to be overridden to handle certain backends?
56
+ * @note if override is common, maybe add a callback prop?
57
+ * */
58
+ getUrl(options, extra) {
59
+ let url = `${this.url}`;
60
+ let first = true;
61
+ for (const [key, value] of Object.entries(options)) {
62
+ url += first ? '?' : '&';
63
+ first = false;
64
+ if (Array.isArray(value)) {
65
+ url += `${key.toUpperCase()}=${value.join(',')}`;
66
+ }
67
+ else {
68
+ url += `${key.toUpperCase()}=${value ? String(value) : ''}`;
69
+ }
70
+ }
71
+ return url;
72
+ }
73
+ /** Checks for and parses a WMS XML formatted ServiceError and throws an exception */
74
+ async checkResponse(response) {
75
+ if (!response.ok) {
76
+ // } || response.headers['content-type'] === WMSErrorLoader.mimeTypes[0]) {
77
+ // const arrayBuffer = await response.arrayBuffer();
78
+ // const error = await WMSErrorLoader.parse(arrayBuffer, this.loadOptions);
79
+ throw new Error('error');
80
+ }
81
+ }
82
+ }
83
+ exports.ArcGISImageService = ArcGISImageService;
84
+ ArcGISImageService.type = 'arcgis-image-server';
85
+ ArcGISImageService.testURL = (url) => url.toLowerCase().includes('ImageServer');
@@ -0,0 +1,16 @@
1
+ import { ImageSource } from './image-source';
2
+ import { ImageServiceProps } from './image-services/image-service';
3
+ export type ImageServiceType = 'wms' | 'arcgis-image-server' | 'template';
4
+ type Props = ImageServiceProps & {
5
+ type?: ImageServiceType | 'auto';
6
+ };
7
+ /**
8
+ * Creates an image source
9
+ * If type is not supplied, will try to automatically detec the the
10
+ * @param url URL to the image source
11
+ * @param type type of source. if not known, set to 'auto'
12
+ * @returns an ImageSource instance
13
+ */
14
+ export declare function createImageSource(props: Props): ImageSource;
15
+ export {};
16
+ //# sourceMappingURL=create-image-source.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-image-source.d.ts","sourceRoot":"","sources":["../../../src/lib/data-sources/create-image-source.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAe,iBAAiB,EAAC,MAAM,gCAAgC,CAAC;AAI/E,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,qBAAqB,GAAG,UAAU,CAAC;AAI1E,KAAK,KAAK,GAAG,iBAAiB,GAAG;IAC/B,IAAI,CAAC,EAAE,gBAAgB,GAAG,MAAM,CAAC;CAClC,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,GAAG,WAAW,CAY3D"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ // loaders.gl, MIT license
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.createImageSource = void 0;
5
+ const image_service_1 = require("./image-services/image-service");
6
+ const wms_service_1 = require("./image-services/wms-service");
7
+ const arcgis_image_service_1 = require("./image-services/arcgis-image-service");
8
+ const SERVICES = [wms_service_1.WMSService, arcgis_image_service_1.ArcGISImageService, image_service_1.ImageService];
9
+ /**
10
+ * Creates an image source
11
+ * If type is not supplied, will try to automatically detec the the
12
+ * @param url URL to the image source
13
+ * @param type type of source. if not known, set to 'auto'
14
+ * @returns an ImageSource instance
15
+ */
16
+ function createImageSource(props) {
17
+ const { type = 'auto' } = props;
18
+ const serviceType = type === 'auto' ? guessServiceType(props.url) : type;
19
+ switch (serviceType) {
20
+ case 'template':
21
+ return new image_service_1.ImageService(props);
22
+ case 'wms':
23
+ return new wms_service_1.WMSService(props);
24
+ default:
25
+ // currently only wms service supported
26
+ throw new Error('Not a valid image source type');
27
+ }
28
+ }
29
+ exports.createImageSource = createImageSource;
30
+ /** Guess service type from URL */
31
+ function guessServiceType(url) {
32
+ for (const Service of SERVICES) {
33
+ if (Service.testURL && Service.testURL(url)) {
34
+ return Service.type;
35
+ }
36
+ }
37
+ // If all else fails, guess that this is MS service
38
+ return 'wms';
39
+ }
@@ -0,0 +1,71 @@
1
+ import { ImageType } from '@loaders.gl/images';
2
+ import type { ImageSourceMetadata, GetImageParameters } from '../image-source';
3
+ import { ImageSource } from '../image-source';
4
+ import { ImageServiceProps } from './image-service';
5
+ export declare class ArcGISImageService extends ImageSource {
6
+ static type: 'arcgis-image-server';
7
+ static testURL: (url: string) => boolean;
8
+ props: Required<ImageServiceProps>;
9
+ fetch: (url: string, options?: RequestInit) => Promise<Response>;
10
+ constructor(props: ImageServiceProps);
11
+ getMetadata(): Promise<ImageSourceMetadata>;
12
+ getImage(parameters: GetImageParameters): Promise<ImageType>;
13
+ info(): Promise<unknown>;
14
+ /**
15
+ * Form a URL to an ESRI ImageServer
16
+ // 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`,
17
+ */
18
+ exportImage(options: {
19
+ boundingBox: [number, number, number, number];
20
+ boundingBoxSR?: string;
21
+ width: number;
22
+ height: number;
23
+ imageSR?: string;
24
+ time?: never;
25
+ format?: 'jpgpng';
26
+ pixelType?: 'U8';
27
+ noData?: never;
28
+ noDataInterpretation?: 'esriNoDataMatchAny';
29
+ interpolation?: '+RSP_NearestNeighbor';
30
+ compression?: never;
31
+ compressionQuality?: never;
32
+ bandIds?: never;
33
+ mosaicRule?: never;
34
+ renderingRule?: never;
35
+ f?: 'image';
36
+ }): Promise<ImageType>;
37
+ infoURL(options: {
38
+ parameters?: Record<string, unknown>;
39
+ }): string;
40
+ /**
41
+ * Form a URL to an ESRI ImageServer
42
+ // 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`,
43
+ */
44
+ exportImageURL(options: {
45
+ boundingBox: [number, number, number, number];
46
+ boundingBoxSR?: string;
47
+ width: number;
48
+ height: number;
49
+ imageSR?: string;
50
+ time?: never;
51
+ format?: 'jpgpng';
52
+ pixelType?: 'U8';
53
+ noData?: never;
54
+ noDataInterpretation?: 'esriNoDataMatchAny';
55
+ interpolation?: '+RSP_NearestNeighbor';
56
+ compression?: never;
57
+ compressionQuality?: never;
58
+ bandIds?: never;
59
+ mosaicRule?: never;
60
+ renderingRule?: never;
61
+ f?: 'image';
62
+ }): string;
63
+ /**
64
+ * @note protected, since perhaps getWMSUrl may need to be overridden to handle certain backends?
65
+ * @note if override is common, maybe add a callback prop?
66
+ * */
67
+ protected getUrl(options: Record<string, unknown>, extra?: Record<string, unknown>): string;
68
+ /** Checks for and parses a WMS XML formatted ServiceError and throws an exception */
69
+ protected checkResponse(response: Response): Promise<void>;
70
+ }
71
+ //# sourceMappingURL=arcgis-image-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arcgis-image-service.d.ts","sourceRoot":"","sources":["../../../../src/lib/data-sources/image-services/arcgis-image-service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAC7C,OAAO,KAAK,EAAC,mBAAmB,EAAE,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAC,iBAAiB,EAA2C,MAAM,iBAAiB,CA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