@loaders.gl/wms 3.3.0-alpha.13 → 3.3.0-alpha.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dist.min.js +182 -1046
- package/dist/es5/index.js +20 -13
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/lerc-loader.js +1 -1
- package/dist/es5/lib/data-sources/adhoc-image-service.js +4 -0
- package/dist/es5/lib/data-sources/adhoc-image-service.js.map +1 -1
- package/dist/es5/lib/data-sources/arcgis-image-service.js +180 -0
- package/dist/es5/lib/data-sources/arcgis-image-service.js.map +1 -0
- package/dist/es5/lib/data-sources/create-image-source.js +45 -0
- package/dist/es5/lib/data-sources/create-image-source.js.map +1 -0
- package/dist/es5/lib/data-sources/image-services/arcgis-image-service.js +179 -0
- package/dist/es5/lib/data-sources/image-services/arcgis-image-service.js.map +1 -0
- package/dist/es5/lib/data-sources/image-services/image-service.js +163 -0
- package/dist/es5/lib/data-sources/image-services/image-service.js.map +1 -0
- package/dist/es5/lib/data-sources/{wms-service.js → image-services/wms-service.js} +116 -75
- package/dist/es5/lib/data-sources/image-services/wms-service.js.map +1 -0
- package/dist/es5/wip/arcgis-feature-service.js +45 -0
- package/dist/es5/wip/arcgis-feature-service.js.map +1 -0
- package/dist/es5/wip/data-source.js.map +1 -1
- package/dist/es5/wip/gml-loader.js +1 -1
- package/dist/es5/wip/wcs-capabilities-loader.js +1 -1
- package/dist/es5/wip/wfs-capabilities-loader.js +1 -1
- package/dist/es5/wip/wmts-capabilities-loader.js +1 -1
- package/dist/es5/wms-capabilities-loader.js +1 -1
- package/dist/es5/wms-error-loader.js +1 -1
- package/dist/esm/index.js +5 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lerc-loader.js +1 -1
- package/dist/esm/lib/data-sources/adhoc-image-service.js +2 -0
- package/dist/esm/lib/data-sources/adhoc-image-service.js.map +1 -1
- package/dist/esm/lib/data-sources/arcgis-image-service.js +62 -0
- package/dist/esm/lib/data-sources/arcgis-image-service.js.map +1 -0
- package/dist/esm/lib/data-sources/create-image-source.js +30 -0
- package/dist/esm/lib/data-sources/create-image-source.js.map +1 -0
- package/dist/esm/lib/data-sources/image-services/arcgis-image-service.js +61 -0
- package/dist/esm/lib/data-sources/image-services/arcgis-image-service.js.map +1 -0
- package/dist/esm/lib/data-sources/image-services/image-service.js +72 -0
- package/dist/esm/lib/data-sources/image-services/image-service.js.map +1 -0
- package/dist/esm/lib/data-sources/{wms-service.js → image-services/wms-service.js} +46 -32
- package/dist/esm/lib/data-sources/image-services/wms-service.js.map +1 -0
- package/dist/esm/wip/arcgis-feature-service.js +28 -0
- package/dist/esm/wip/arcgis-feature-service.js.map +1 -0
- package/dist/esm/wip/data-source.js.map +1 -1
- package/dist/esm/wip/gml-loader.js +1 -1
- package/dist/esm/wip/wcs-capabilities-loader.js +1 -1
- package/dist/esm/wip/wfs-capabilities-loader.js +1 -1
- package/dist/esm/wip/wmts-capabilities-loader.js +1 -1
- package/dist/esm/wms-capabilities-loader.js +1 -1
- package/dist/esm/wms-error-loader.js +1 -1
- package/dist/index.d.ts +9 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -8
- package/dist/lib/data-sources/adhoc-image-service.d.ts +2 -0
- package/dist/lib/data-sources/adhoc-image-service.d.ts.map +1 -1
- package/dist/lib/data-sources/adhoc-image-service.js +2 -0
- package/dist/lib/data-sources/arcgis-image-service.d.ts +79 -0
- package/dist/lib/data-sources/arcgis-image-service.d.ts.map +1 -0
- package/dist/lib/data-sources/arcgis-image-service.js +85 -0
- package/dist/lib/data-sources/create-image-source.d.ts +16 -0
- package/dist/lib/data-sources/create-image-source.d.ts.map +1 -0
- package/dist/lib/data-sources/create-image-source.js +39 -0
- package/dist/lib/data-sources/image-services/arcgis-image-service.d.ts +71 -0
- package/dist/lib/data-sources/image-services/arcgis-image-service.d.ts.map +1 -0
- package/dist/lib/data-sources/image-services/arcgis-image-service.js +85 -0
- package/dist/lib/data-sources/image-services/image-service.d.ts +39 -0
- package/dist/lib/data-sources/image-services/image-service.d.ts.map +1 -0
- package/dist/lib/data-sources/image-services/image-service.js +82 -0
- package/dist/lib/data-sources/{wms-service.d.ts → image-services/wms-service.d.ts} +33 -38
- package/dist/lib/data-sources/image-services/wms-service.d.ts.map +1 -0
- package/dist/lib/data-sources/{wms-service.js → image-services/wms-service.js} +40 -28
- package/dist/wip/arcgis-feature-service.d.ts +56 -0
- package/dist/wip/arcgis-feature-service.d.ts.map +1 -0
- package/dist/wip/arcgis-feature-service.js +28 -0
- package/dist/wip/data-source.d.ts +14 -13
- package/dist/wip/data-source.d.ts.map +1 -1
- package/dist/wip/data-source.js +15 -13
- package/package.json +6 -6
- package/src/index.ts +13 -8
- package/src/lib/data-sources/adhoc-image-service.ts +3 -0
- package/src/lib/data-sources/arcgis-image-service.ts +146 -0
- package/src/lib/data-sources/create-image-source.ts +46 -0
- package/src/lib/data-sources/image-services/arcgis-image-service.ts +136 -0
- package/src/lib/data-sources/image-services/image-service.ts +105 -0
- package/src/lib/data-sources/{wms-service.ts → image-services/wms-service.ts} +51 -47
- package/src/wip/arcgis-feature-service.ts +89 -0
- package/src/wip/data-source.ts +15 -13
- package/dist/es5/lib/data-sources/wms-service.js.map +0 -1
- package/dist/esm/lib/data-sources/wms-service.js.map +0 -1
- package/dist/lib/data-sources/wms-service.d.ts.map +0 -1
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.ImageService = void 0;
|
|
8
|
+
exports.getFetchFunction = getFetchFunction;
|
|
9
|
+
exports.mergeImageServiceProps = mergeImageServiceProps;
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
12
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
14
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
15
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
16
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
18
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
19
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
20
|
+
var _images = require("@loaders.gl/images");
|
|
21
|
+
var _imageSource = require("../image-source");
|
|
22
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
23
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
24
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
25
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
26
|
+
var ImageService = function (_ImageSource) {
|
|
27
|
+
(0, _inherits2.default)(ImageService, _ImageSource);
|
|
28
|
+
var _super = _createSuper(ImageService);
|
|
29
|
+
function ImageService(props) {
|
|
30
|
+
var _this;
|
|
31
|
+
(0, _classCallCheck2.default)(this, ImageService);
|
|
32
|
+
_this = _super.call(this);
|
|
33
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "props", void 0);
|
|
34
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "fetch", void 0);
|
|
35
|
+
_this.props = mergeImageServiceProps(props);
|
|
36
|
+
_this.fetch = getFetchFunction(props);
|
|
37
|
+
return _this;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
(0, _createClass2.default)(ImageService, [{
|
|
41
|
+
key: "getMetadata",
|
|
42
|
+
value: function () {
|
|
43
|
+
var _getMetadata = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee() {
|
|
44
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
45
|
+
while (1) {
|
|
46
|
+
switch (_context.prev = _context.next) {
|
|
47
|
+
case 0:
|
|
48
|
+
throw new Error('ImageSource.getMetadata not implemented');
|
|
49
|
+
case 1:
|
|
50
|
+
case "end":
|
|
51
|
+
return _context.stop();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}, _callee);
|
|
55
|
+
}));
|
|
56
|
+
function getMetadata() {
|
|
57
|
+
return _getMetadata.apply(this, arguments);
|
|
58
|
+
}
|
|
59
|
+
return getMetadata;
|
|
60
|
+
}()
|
|
61
|
+
}, {
|
|
62
|
+
key: "getImage",
|
|
63
|
+
value: function () {
|
|
64
|
+
var _getImage = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee2(parameters) {
|
|
65
|
+
var granularParameters, url, response, arrayBuffer;
|
|
66
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
67
|
+
while (1) {
|
|
68
|
+
switch (_context2.prev = _context2.next) {
|
|
69
|
+
case 0:
|
|
70
|
+
granularParameters = this.getGranularParameters(parameters);
|
|
71
|
+
url = this.getURLFromTemplate(granularParameters);
|
|
72
|
+
_context2.next = 4;
|
|
73
|
+
return this.fetch(url);
|
|
74
|
+
case 4:
|
|
75
|
+
response = _context2.sent;
|
|
76
|
+
_context2.next = 7;
|
|
77
|
+
return response.arrayBuffer();
|
|
78
|
+
case 7:
|
|
79
|
+
arrayBuffer = _context2.sent;
|
|
80
|
+
_context2.next = 10;
|
|
81
|
+
return _images.ImageLoader.parse(arrayBuffer);
|
|
82
|
+
case 10:
|
|
83
|
+
return _context2.abrupt("return", _context2.sent);
|
|
84
|
+
case 11:
|
|
85
|
+
case "end":
|
|
86
|
+
return _context2.stop();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}, _callee2, this);
|
|
90
|
+
}));
|
|
91
|
+
function getImage(_x) {
|
|
92
|
+
return _getImage.apply(this, arguments);
|
|
93
|
+
}
|
|
94
|
+
return getImage;
|
|
95
|
+
}()
|
|
96
|
+
}, {
|
|
97
|
+
key: "getGranularParameters",
|
|
98
|
+
value:
|
|
99
|
+
|
|
100
|
+
function getGranularParameters(parameters) {
|
|
101
|
+
var _parameters$bbox = (0, _slicedToArray2.default)(parameters.bbox, 4),
|
|
102
|
+
east = _parameters$bbox[0],
|
|
103
|
+
north = _parameters$bbox[1],
|
|
104
|
+
west = _parameters$bbox[2],
|
|
105
|
+
south = _parameters$bbox[3];
|
|
106
|
+
return _objectSpread(_objectSpread({}, parameters), {}, {
|
|
107
|
+
east: east,
|
|
108
|
+
north: north,
|
|
109
|
+
south: south,
|
|
110
|
+
west: west
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
}, {
|
|
115
|
+
key: "getURLFromTemplate",
|
|
116
|
+
value:
|
|
117
|
+
function getURLFromTemplate(parameters) {
|
|
118
|
+
var url = this.props.url;
|
|
119
|
+
for (var _i = 0, _Object$entries = Object.entries(parameters); _i < _Object$entries.length; _i++) {
|
|
120
|
+
var _Object$entries$_i = (0, _slicedToArray2.default)(_Object$entries[_i], 2),
|
|
121
|
+
key = _Object$entries$_i[0],
|
|
122
|
+
value = _Object$entries$_i[1];
|
|
123
|
+
url = url.replace("${".concat(key, "}"), String(value));
|
|
124
|
+
url = url.replace("{".concat(key, "}"), String(value));
|
|
125
|
+
}
|
|
126
|
+
return url;
|
|
127
|
+
}
|
|
128
|
+
}]);
|
|
129
|
+
return ImageService;
|
|
130
|
+
}(_imageSource.ImageSource);
|
|
131
|
+
exports.ImageService = ImageService;
|
|
132
|
+
(0, _defineProperty2.default)(ImageService, "type", 'template');
|
|
133
|
+
(0, _defineProperty2.default)(ImageService, "testURL", function (url) {
|
|
134
|
+
return url.toLowerCase().includes('{');
|
|
135
|
+
});
|
|
136
|
+
function getFetchFunction(options) {
|
|
137
|
+
var fetchFunction = options === null || options === void 0 ? void 0 : options.fetch;
|
|
138
|
+
|
|
139
|
+
if (fetchFunction && typeof fetchFunction === 'function') {
|
|
140
|
+
return function (url, fetchOptions) {
|
|
141
|
+
return fetchFunction(url, fetchOptions);
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
var fetchOptions = options === null || options === void 0 ? void 0 : options.fetch;
|
|
146
|
+
if (fetchOptions && typeof fetchOptions !== 'function') {
|
|
147
|
+
return function (url) {
|
|
148
|
+
return fetch(url, fetchOptions);
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return function (url) {
|
|
153
|
+
return fetch(url);
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
function mergeImageServiceProps(props) {
|
|
157
|
+
return _objectSpread(_objectSpread({}, props), {}, {
|
|
158
|
+
loadOptions: _objectSpread(_objectSpread({}, props.loadOptions), {}, {
|
|
159
|
+
fetch: getFetchFunction(props.loadOptions)
|
|
160
|
+
})
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=image-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-service.js","names":["ImageService","props","mergeImageServiceProps","fetch","getFetchFunction","Error","parameters","granularParameters","getGranularParameters","url","getURLFromTemplate","response","arrayBuffer","ImageLoader","parse","bbox","east","north","west","south","Object","entries","key","value","replace","String","ImageSource","toLowerCase","includes","options","fetchFunction","fetchOptions","loadOptions"],"sources":["../../../../../src/lib/data-sources/image-services/image-service.ts"],"sourcesContent":["// loaders.gl, MIT license\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 '../image-source';\nimport {ImageSource} from '../image-source';\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 class ImageService extends ImageSource {\n static type: 'template' = 'template';\n static testURL = (url: string): boolean => url.toLowerCase().includes('{');\n\n props: Required<ImageServiceProps>;\n fetch: (url: string, options?: RequestInit) => Promise<Response>;\n\n constructor(props: ImageServiceProps) {\n super();\n this.props = mergeImageServiceProps(props);\n this.fetch = getFetchFunction(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.bbox;\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(value));\n }\n return url;\n }\n}\n\n/**\n * Gets the current fetch function from options\n * @todo - move to loader-utils module\n * @todo - use in core module counterpart\n * @param options\n * @param context\n */\nexport function getFetchFunction(options?: LoaderOptions) {\n const fetchFunction = options?.fetch;\n\n // options.fetch can be a function\n if (fetchFunction && typeof fetchFunction === 'function') {\n return (url: string, fetchOptions?: RequestInit) => fetchFunction(url, fetchOptions);\n }\n\n // options.fetch can be an options object, use global fetch with those options\n const fetchOptions = options?.fetch;\n if (fetchOptions && typeof fetchOptions !== 'function') {\n return (url) => fetch(url, fetchOptions);\n }\n\n // else return the global fetch function\n return (url) => fetch(url);\n}\n\nexport function mergeImageServiceProps(props: ImageServiceProps): Required<ImageServiceProps> {\n return {\n // Default fetch\n ...props,\n loadOptions: {\n ...props.loadOptions,\n fetch: getFetchFunction(props.loadOptions)\n }\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAIA;AAGA;AAA4C;AAAA;AAAA;AAAA;AAAA,IAe/BA,YAAY;EAAA;EAAA;EAOvB,sBAAYC,KAAwB,EAAE;IAAA;IAAA;IACpC;IAAQ;IAAA;IACR,MAAKA,K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 = _interopRequireDefault(require("@babel/runtime
|
|
|
16
16
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
17
17
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
18
18
|
var _images = require("@loaders.gl/images");
|
|
19
|
-
var _imageSource = require("
|
|
20
|
-
var
|
|
21
|
-
var
|
|
22
|
-
var
|
|
23
|
-
var
|
|
19
|
+
var _imageSource = require("../image-source");
|
|
20
|
+
var _imageService = require("./image-service");
|
|
21
|
+
var _wmsCapabilitiesLoader = require("../../../wms-capabilities-loader");
|
|
22
|
+
var _wmsFeatureInfoLoader = require("../../../wip/wms-feature-info-loader");
|
|
23
|
+
var _wmsLayerDescriptionLoader = require("../../../wip/wms-layer-description-loader");
|
|
24
|
+
var _wmsErrorLoader = require("../../../wms-error-loader");
|
|
24
25
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
25
26
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
26
27
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
@@ -30,20 +31,21 @@ var WMSService = function (_ImageSource) {
|
|
|
30
31
|
var _super = _createSuper(WMSService);
|
|
31
32
|
|
|
32
33
|
function WMSService(props) {
|
|
34
|
+
var _this$props$loadOptio;
|
|
33
35
|
var _this;
|
|
34
36
|
(0, _classCallCheck2.default)(this, WMSService);
|
|
35
37
|
_this = _super.call(this);
|
|
36
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "
|
|
37
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "loadOptions", {
|
|
38
|
-
wms: {
|
|
39
|
-
throwOnError: true
|
|
40
|
-
}
|
|
41
|
-
});
|
|
38
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "props", void 0);
|
|
42
39
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "fetch", void 0);
|
|
40
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "capabilities", null);
|
|
43
41
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "loaders", [_images.ImageLoader, _wmsErrorLoader.WMSErrorLoader, _wmsCapabilitiesLoader.WMSCapabilitiesLoader, _wmsFeatureInfoLoader.WMSFeatureInfoLoader, _wmsLayerDescriptionLoader.WMSLayerDescriptionLoader]);
|
|
44
|
-
_this.
|
|
45
|
-
|
|
46
|
-
_this.
|
|
42
|
+
_this.props = (0, _imageService.mergeImageServiceProps)(props);
|
|
43
|
+
_this.fetch = (0, _imageService.getFetchFunction)(_this.props);
|
|
44
|
+
_this.props.loadOptions = _objectSpread(_objectSpread({}, _this.props.loadOptions), {}, {
|
|
45
|
+
wms: _objectSpread(_objectSpread({}, (_this$props$loadOptio = _this.props.loadOptions) === null || _this$props$loadOptio === void 0 ? void 0 : _this$props$loadOptio.wms), {}, {
|
|
46
|
+
throwOnError: true
|
|
47
|
+
})
|
|
48
|
+
});
|
|
47
49
|
return _this;
|
|
48
50
|
}
|
|
49
51
|
|
|
@@ -63,27 +65,28 @@ var WMSService = function (_ImageSource) {
|
|
|
63
65
|
key: "getCapabilities",
|
|
64
66
|
value: function () {
|
|
65
67
|
var _getCapabilities = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(wmsParameters, vendorParameters) {
|
|
66
|
-
var url,
|
|
68
|
+
var url, response, arrayBuffer, capabilities;
|
|
67
69
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
68
70
|
while (1) {
|
|
69
71
|
switch (_context.prev = _context.next) {
|
|
70
72
|
case 0:
|
|
71
73
|
url = this.getCapabilitiesURL(wmsParameters, vendorParameters);
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
case 4:
|
|
74
|
+
_context.next = 3;
|
|
75
|
+
return this.fetch(url);
|
|
76
|
+
case 3:
|
|
76
77
|
response = _context.sent;
|
|
77
|
-
_context.next =
|
|
78
|
+
_context.next = 6;
|
|
78
79
|
return response.arrayBuffer();
|
|
79
|
-
case
|
|
80
|
+
case 6:
|
|
80
81
|
arrayBuffer = _context.sent;
|
|
81
82
|
this._checkResponse(response, arrayBuffer);
|
|
82
|
-
_context.next =
|
|
83
|
-
return _wmsCapabilitiesLoader.WMSCapabilitiesLoader.parse(arrayBuffer, this.loadOptions);
|
|
84
|
-
case
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
_context.next = 10;
|
|
84
|
+
return _wmsCapabilitiesLoader.WMSCapabilitiesLoader.parse(arrayBuffer, this.props.loadOptions);
|
|
85
|
+
case 10:
|
|
86
|
+
capabilities = _context.sent;
|
|
87
|
+
this.capabilities = capabilities;
|
|
88
|
+
return _context.abrupt("return", capabilities);
|
|
89
|
+
case 13:
|
|
87
90
|
case "end":
|
|
88
91
|
return _context.stop();
|
|
89
92
|
}
|
|
@@ -99,37 +102,36 @@ var WMSService = function (_ImageSource) {
|
|
|
99
102
|
key: "getMap",
|
|
100
103
|
value: function () {
|
|
101
104
|
var _getMap = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee2(options, vendorParameters) {
|
|
102
|
-
var url,
|
|
105
|
+
var url, response, arrayBuffer;
|
|
103
106
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
104
107
|
while (1) {
|
|
105
108
|
switch (_context2.prev = _context2.next) {
|
|
106
109
|
case 0:
|
|
107
110
|
url = this.getMapURL(options, vendorParameters);
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
case 4:
|
|
111
|
+
_context2.next = 3;
|
|
112
|
+
return this.fetch(url);
|
|
113
|
+
case 3:
|
|
112
114
|
response = _context2.sent;
|
|
113
|
-
_context2.next =
|
|
115
|
+
_context2.next = 6;
|
|
114
116
|
return response.arrayBuffer();
|
|
115
|
-
case
|
|
117
|
+
case 6:
|
|
116
118
|
arrayBuffer = _context2.sent;
|
|
117
119
|
this._checkResponse(response, arrayBuffer);
|
|
118
|
-
_context2.prev =
|
|
119
|
-
_context2.next =
|
|
120
|
-
return _images.ImageLoader.parse(arrayBuffer, this.loadOptions);
|
|
121
|
-
case
|
|
120
|
+
_context2.prev = 8;
|
|
121
|
+
_context2.next = 11;
|
|
122
|
+
return _images.ImageLoader.parse(arrayBuffer, this.props.loadOptions);
|
|
123
|
+
case 11:
|
|
122
124
|
return _context2.abrupt("return", _context2.sent);
|
|
123
|
-
case
|
|
124
|
-
_context2.prev =
|
|
125
|
-
_context2.t0 = _context2["catch"](
|
|
125
|
+
case 14:
|
|
126
|
+
_context2.prev = 14;
|
|
127
|
+
_context2.t0 = _context2["catch"](8);
|
|
126
128
|
throw this._parseError(arrayBuffer);
|
|
127
|
-
case
|
|
129
|
+
case 17:
|
|
128
130
|
case "end":
|
|
129
131
|
return _context2.stop();
|
|
130
132
|
}
|
|
131
133
|
}
|
|
132
|
-
}, _callee2, this, [[
|
|
134
|
+
}, _callee2, this, [[8, 14]]);
|
|
133
135
|
}));
|
|
134
136
|
function getMap(_x3, _x4) {
|
|
135
137
|
return _getMap.apply(this, arguments);
|
|
@@ -147,7 +149,7 @@ var WMSService = function (_ImageSource) {
|
|
|
147
149
|
case 0:
|
|
148
150
|
url = this.getFeatureInfoURL(options, vendorParameters);
|
|
149
151
|
_context3.next = 3;
|
|
150
|
-
return this.fetch(url
|
|
152
|
+
return this.fetch(url);
|
|
151
153
|
case 3:
|
|
152
154
|
response = _context3.sent;
|
|
153
155
|
_context3.next = 6;
|
|
@@ -156,7 +158,7 @@ var WMSService = function (_ImageSource) {
|
|
|
156
158
|
arrayBuffer = _context3.sent;
|
|
157
159
|
this._checkResponse(response, arrayBuffer);
|
|
158
160
|
_context3.next = 10;
|
|
159
|
-
return _wmsFeatureInfoLoader.WMSFeatureInfoLoader.parse(arrayBuffer, this.loadOptions);
|
|
161
|
+
return _wmsFeatureInfoLoader.WMSFeatureInfoLoader.parse(arrayBuffer, this.props.loadOptions);
|
|
160
162
|
case 10:
|
|
161
163
|
return _context3.abrupt("return", _context3.sent);
|
|
162
164
|
case 11:
|
|
@@ -172,52 +174,52 @@ var WMSService = function (_ImageSource) {
|
|
|
172
174
|
return getFeatureInfo;
|
|
173
175
|
}()
|
|
174
176
|
}, {
|
|
175
|
-
key: "
|
|
177
|
+
key: "getFeatureInfoText",
|
|
176
178
|
value: function () {
|
|
177
|
-
var
|
|
179
|
+
var _getFeatureInfoText = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee4(options, vendorParameters) {
|
|
178
180
|
var url, response, arrayBuffer;
|
|
179
181
|
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
180
182
|
while (1) {
|
|
181
183
|
switch (_context4.prev = _context4.next) {
|
|
182
184
|
case 0:
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
185
|
+
options = _objectSpread(_objectSpread({}, options), {}, {
|
|
186
|
+
info_format: 'text/plain'
|
|
187
|
+
});
|
|
188
|
+
url = this.getFeatureInfoURL(options, vendorParameters);
|
|
189
|
+
_context4.next = 4;
|
|
190
|
+
return this.fetch(url);
|
|
191
|
+
case 4:
|
|
187
192
|
response = _context4.sent;
|
|
188
|
-
_context4.next =
|
|
193
|
+
_context4.next = 7;
|
|
189
194
|
return response.arrayBuffer();
|
|
190
|
-
case
|
|
195
|
+
case 7:
|
|
191
196
|
arrayBuffer = _context4.sent;
|
|
192
197
|
this._checkResponse(response, arrayBuffer);
|
|
193
|
-
_context4.
|
|
194
|
-
return _wmsLayerDescriptionLoader.WMSLayerDescriptionLoader.parse(arrayBuffer, this.loadOptions);
|
|
198
|
+
return _context4.abrupt("return", new TextDecoder().decode(arrayBuffer));
|
|
195
199
|
case 10:
|
|
196
|
-
return _context4.abrupt("return", _context4.sent);
|
|
197
|
-
case 11:
|
|
198
200
|
case "end":
|
|
199
201
|
return _context4.stop();
|
|
200
202
|
}
|
|
201
203
|
}
|
|
202
204
|
}, _callee4, this);
|
|
203
205
|
}));
|
|
204
|
-
function
|
|
205
|
-
return
|
|
206
|
+
function getFeatureInfoText(_x7, _x8) {
|
|
207
|
+
return _getFeatureInfoText.apply(this, arguments);
|
|
206
208
|
}
|
|
207
|
-
return
|
|
209
|
+
return getFeatureInfoText;
|
|
208
210
|
}()
|
|
209
211
|
}, {
|
|
210
|
-
key: "
|
|
212
|
+
key: "describeLayer",
|
|
211
213
|
value: function () {
|
|
212
|
-
var
|
|
214
|
+
var _describeLayer = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee5(options, vendorParameters) {
|
|
213
215
|
var url, response, arrayBuffer;
|
|
214
216
|
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
215
217
|
while (1) {
|
|
216
218
|
switch (_context5.prev = _context5.next) {
|
|
217
219
|
case 0:
|
|
218
|
-
url = this.
|
|
220
|
+
url = this.describeLayerURL(options, vendorParameters);
|
|
219
221
|
_context5.next = 3;
|
|
220
|
-
return this.fetch(url
|
|
222
|
+
return this.fetch(url);
|
|
221
223
|
case 3:
|
|
222
224
|
response = _context5.sent;
|
|
223
225
|
_context5.next = 6;
|
|
@@ -225,23 +227,58 @@ var WMSService = function (_ImageSource) {
|
|
|
225
227
|
case 6:
|
|
226
228
|
arrayBuffer = _context5.sent;
|
|
227
229
|
this._checkResponse(response, arrayBuffer);
|
|
228
|
-
_context5.
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
case 11:
|
|
230
|
+
_context5.next = 10;
|
|
231
|
+
return _wmsLayerDescriptionLoader.WMSLayerDescriptionLoader.parse(arrayBuffer, this.props.loadOptions);
|
|
232
|
+
case 10:
|
|
232
233
|
return _context5.abrupt("return", _context5.sent);
|
|
234
|
+
case 11:
|
|
235
|
+
case "end":
|
|
236
|
+
return _context5.stop();
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}, _callee5, this);
|
|
240
|
+
}));
|
|
241
|
+
function describeLayer(_x9, _x10) {
|
|
242
|
+
return _describeLayer.apply(this, arguments);
|
|
243
|
+
}
|
|
244
|
+
return describeLayer;
|
|
245
|
+
}()
|
|
246
|
+
}, {
|
|
247
|
+
key: "getLegendGraphic",
|
|
248
|
+
value: function () {
|
|
249
|
+
var _getLegendGraphic = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee6(options, vendorParameters) {
|
|
250
|
+
var url, response, arrayBuffer;
|
|
251
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
252
|
+
while (1) {
|
|
253
|
+
switch (_context6.prev = _context6.next) {
|
|
254
|
+
case 0:
|
|
255
|
+
url = this.getLegendGraphicURL(options, vendorParameters);
|
|
256
|
+
_context6.next = 3;
|
|
257
|
+
return this.fetch(url);
|
|
258
|
+
case 3:
|
|
259
|
+
response = _context6.sent;
|
|
260
|
+
_context6.next = 6;
|
|
261
|
+
return response.arrayBuffer();
|
|
262
|
+
case 6:
|
|
263
|
+
arrayBuffer = _context6.sent;
|
|
264
|
+
this._checkResponse(response, arrayBuffer);
|
|
265
|
+
_context6.prev = 8;
|
|
266
|
+
_context6.next = 11;
|
|
267
|
+
return _images.ImageLoader.parse(arrayBuffer, this.props.loadOptions);
|
|
268
|
+
case 11:
|
|
269
|
+
return _context6.abrupt("return", _context6.sent);
|
|
233
270
|
case 14:
|
|
234
|
-
|
|
235
|
-
|
|
271
|
+
_context6.prev = 14;
|
|
272
|
+
_context6.t0 = _context6["catch"](8);
|
|
236
273
|
throw this._parseError(arrayBuffer);
|
|
237
274
|
case 17:
|
|
238
275
|
case "end":
|
|
239
|
-
return
|
|
276
|
+
return _context6.stop();
|
|
240
277
|
}
|
|
241
278
|
}
|
|
242
|
-
},
|
|
279
|
+
}, _callee6, this, [[8, 14]]);
|
|
243
280
|
}));
|
|
244
|
-
function getLegendGraphic(
|
|
281
|
+
function getLegendGraphic(_x11, _x12) {
|
|
245
282
|
return _getLegendGraphic.apply(this, arguments);
|
|
246
283
|
}
|
|
247
284
|
return getLegendGraphic;
|
|
@@ -317,7 +354,7 @@ var WMSService = function (_ImageSource) {
|
|
|
317
354
|
value:
|
|
318
355
|
|
|
319
356
|
function _getWMSUrl(options, vendorParameters) {
|
|
320
|
-
var url =
|
|
357
|
+
var url = this.props.url;
|
|
321
358
|
var first = true;
|
|
322
359
|
for (var _i = 0, _Object$entries = Object.entries(options); _i < _Object$entries.length; _i++) {
|
|
323
360
|
var _Object$entries$_i = (0, _slicedToArray2.default)(_Object$entries[_i], 2),
|
|
@@ -340,7 +377,7 @@ var WMSService = function (_ImageSource) {
|
|
|
340
377
|
function _checkResponse(response, arrayBuffer) {
|
|
341
378
|
var contentType = response.headers['content-type'];
|
|
342
379
|
if (!response.ok || _wmsErrorLoader.WMSErrorLoader.mimeTypes.includes(contentType)) {
|
|
343
|
-
var error = _wmsErrorLoader.WMSErrorLoader.parseSync(arrayBuffer, this.loadOptions);
|
|
380
|
+
var error = _wmsErrorLoader.WMSErrorLoader.parseSync(arrayBuffer, this.props.loadOptions);
|
|
344
381
|
throw new Error(error);
|
|
345
382
|
}
|
|
346
383
|
}
|
|
@@ -349,11 +386,15 @@ var WMSService = function (_ImageSource) {
|
|
|
349
386
|
key: "_parseError",
|
|
350
387
|
value:
|
|
351
388
|
function _parseError(arrayBuffer) {
|
|
352
|
-
var error = _wmsErrorLoader.WMSErrorLoader.parseSync(arrayBuffer, this.loadOptions);
|
|
389
|
+
var error = _wmsErrorLoader.WMSErrorLoader.parseSync(arrayBuffer, this.props.loadOptions);
|
|
353
390
|
return new Error(error);
|
|
354
391
|
}
|
|
355
392
|
}]);
|
|
356
393
|
return WMSService;
|
|
357
394
|
}(_imageSource.ImageSource);
|
|
358
395
|
exports.WMSService = WMSService;
|
|
396
|
+
(0, _defineProperty2.default)(WMSService, "type", 'wms');
|
|
397
|
+
(0, _defineProperty2.default)(WMSService, "testURL", function (url) {
|
|
398
|
+
return url.toLowerCase().includes('wms');
|
|
399
|
+
});
|
|
359
400
|
//# sourceMappingURL=wms-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wms-service.js","names":["WMSService","props","ImageLoader","WMSErrorLoader","WMSCapabilitiesLoader","WMSFeatureInfoLoader","WMSLayerDescriptionLoader","mergeImageServiceProps","fetch","getFetchFunction","loadOptions","wms","throwOnError","getCapabilities","parameters","getMap","wmsParameters","vendorParameters","url","getCapabilitiesURL","response","arrayBuffer","_checkResponse","parse","capabilities","options","getMapURL","_parseError","getFeatureInfoURL","info_format","TextDecoder","decode","describeLayerURL","getLegendGraphicURL","service","version","request","_getWMSUrl","styles","undefined","srs","format","first","Object","entries","key","value","Array","isArray","toUpperCase","join","String","encodeURI","contentType","headers","ok","mimeTypes","includes","error","parseSync","Error","ImageSource","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;AAGA;AACA;AAGA;AACA;AACA;AACA;AAAyD;AAAA;AAAA;AAAA;AAAA,IAgF5CA,UAAU;EAAA;EAAA;;EAkBrB,oBAAYC,KAAwB,EAAE;IAAA;IAAA;IAAA;IACpC;IAAQ;IAAA;IAAA,2FAb6B,IAAI;IAAA,sFAGxB,CACjBC,mBAAW,EACXC,8BAAc,EACdC,4CAAqB,EACrBC,0CAAoB,EACpBC,oDAAyB,CAC1B;IAKC,MAAKL,KAAK,GAAG,IAAAM,oCAAsB,EAACN,KAAK,CAAC;IAC1C,MAAKO,KAAK,GAAG,IAAAC,8BAAgB,EAAC,MAAKR,KAAK,CAAC;IACzC,MAAKA,KAAK,CAACS,WAAW,mCACjB,MAAKT,KAA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;MAC3E,IAAMgC,WAAW,GAAGjC,QAAQ,CAACkC,OAAO,CAAC,cAAc,CAAC;MACpD,IAAI,CAAClC,QAAQ,CAACmC,EAAE,IAAIpD,8BAAc,CAACqD,SAAS,CAACC,QAAQ,CAACJ,WAAW,CAAC,EAAE;QAClE,IAAMK,KAAK,GAAGvD,8BAAc,CAACwD,SAAS,CAACtC,WAAW,EAAE,IAAI,CAACpB,KAAK,CAACS,WAAW,CAAC;QAC3E,MAAM,IAAIkD,KAAK,CAACF,KAAK,CAAC;MACxB;IACF;;EAAC;IAAA;IAAA;IAGD,qBAAsBrC,WAAwB,EAAS;MACrD,IAAMqC,KAAK,GAAGvD,8BAAc,CAACwD,SAAS,CAACtC,WAAW,EAAE,IAAI,CAACpB,KAAK,CAACS,WAAW,CAAC;MAC3E,OAAO,IAAIkD,KAAK,CAACF,KAAK,CAAC;IACzB;EAAC;EAAA;AAAA,EA9P6BG,wBAAW;AAAA;AAAA,8BAA9B7D,UAAU,UACA,KAAK;AAAA,8BADfA,UAAU,aAEJ,UAACkB,GAAW;EAAA,OAAcA,GAAG,CAAC4C,WAAW,EAAE,CAACL,QAAQ,CAAC,KAAK,CAAC;AAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.ArcGISFeatureService = void 0;
|
|
8
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
12
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
13
|
+
var ArcGISFeatureService = function () {
|
|
14
|
+
function ArcGISFeatureService(props) {
|
|
15
|
+
(0, _classCallCheck2.default)(this, ArcGISFeatureService);
|
|
16
|
+
(0, _defineProperty2.default)(this, "url", void 0);
|
|
17
|
+
(0, _defineProperty2.default)(this, "loadOptions", void 0);
|
|
18
|
+
(0, _defineProperty2.default)(this, "fetch", void 0);
|
|
19
|
+
this.url = props.url;
|
|
20
|
+
this.loadOptions = props.loadOptions || {};
|
|
21
|
+
this.fetch = props.fetch || fetch;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
(0, _createClass2.default)(ArcGISFeatureService, [{
|
|
25
|
+
key: "metadataURL",
|
|
26
|
+
value:
|
|
27
|
+
|
|
28
|
+
function metadataURL(options) {
|
|
29
|
+
return this.getUrl(_objectSpread({}, options));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
}, {
|
|
33
|
+
key: "exportImageURL",
|
|
34
|
+
value:
|
|
35
|
+
function exportImageURL(options) {
|
|
36
|
+
var boundingBox = options.boundingBox;
|
|
37
|
+
return this.getUrl({
|
|
38
|
+
path: 'exportImage'
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}]);
|
|
42
|
+
return ArcGISFeatureService;
|
|
43
|
+
}();
|
|
44
|
+
exports.ArcGISFeatureService = ArcGISFeatureService;
|
|
45
|
+
//# sourceMappingURL=arcgis-feature-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arcgis-feature-service.js","names":["ArcGISFeatureService","props","url","loadOptions","fetch","options","getUrl","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":";;;;;;;;;;;;IAyCaA,oBAAoB;EAK/B,8BAAYC,KAAgC,EAAE;IAAA;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;;EAAC;IAAA;IAAA;;IAID,qBAAYC,OAA+C,EAAU;MACnE,OAAO,IAAI,CAACC,MAAM,mBAAKD,OAAO,EAAE;IAClC;;EAAC;IAAA;IAAA;IAQD,wBAAeA,OAkBd,EAAU;MACT,IAAOE,WAAW,GAAIF,OAAO,CAAtBE,WAAW;MAGlB,OAAO,IAAI,CAACD,MAAM,CAAC;QAACE,IAAI,EAAE;MAAe,CAAC,CAAC;IAC7C;EAAC;EAAA;AAAA;AAAA"}
|
|
@@ -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//
|
|
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":""}
|
|
@@ -9,7 +9,7 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
|
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
10
|
var _parseGml = require("../lib/gml/parse-gml");
|
|
11
11
|
|
|
12
|
-
var VERSION = typeof "3.3.0-alpha.
|
|
12
|
+
var VERSION = typeof "3.3.0-alpha.14" !== 'undefined' ? "3.3.0-alpha.14" : 'latest';
|
|
13
13
|
var GMLLoader = {
|
|
14
14
|
name: 'GML',
|
|
15
15
|
id: 'gml',
|