@loaders.gl/wms 4.0.0-beta.3 → 4.0.0-beta.4
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.dev.js +25 -183
- package/package.json +6 -6
package/dist/dist.dev.js
CHANGED
|
@@ -108,7 +108,6 @@ var __exports__ = (() => {
|
|
|
108
108
|
var util = require_util();
|
|
109
109
|
var defaultOptions = {
|
|
110
110
|
allowBooleanAttributes: false,
|
|
111
|
-
//A tag can have attributes without any value
|
|
112
111
|
unpairedTags: []
|
|
113
112
|
};
|
|
114
113
|
exports.validate = function(xmlData, options) {
|
|
@@ -405,7 +404,6 @@ var __exports__ = (() => {
|
|
|
405
404
|
const lines = xmlData.substring(0, index).split(/\r?\n/);
|
|
406
405
|
return {
|
|
407
406
|
line: lines.length,
|
|
408
|
-
// column number is last line's length + 1, because column numbering starts at 1:
|
|
409
407
|
col: lines[lines.length - 1].length + 1
|
|
410
408
|
};
|
|
411
409
|
}
|
|
@@ -425,14 +423,10 @@ var __exports__ = (() => {
|
|
|
425
423
|
textNodeName: "#text",
|
|
426
424
|
ignoreAttributes: true,
|
|
427
425
|
removeNSPrefix: false,
|
|
428
|
-
// remove NS from tag name or attribute name if true
|
|
429
426
|
allowBooleanAttributes: false,
|
|
430
|
-
//a tag can have attributes without any value
|
|
431
|
-
//ignoreRootElement : false,
|
|
432
427
|
parseTagValue: true,
|
|
433
428
|
parseAttributeValue: false,
|
|
434
429
|
trimValues: true,
|
|
435
|
-
//Trim string values of tag and attributes
|
|
436
430
|
cdataPropName: false,
|
|
437
431
|
numberParseOptions: {
|
|
438
432
|
hex: true,
|
|
@@ -446,7 +440,6 @@ var __exports__ = (() => {
|
|
|
446
440
|
return val2;
|
|
447
441
|
},
|
|
448
442
|
stopNodes: [],
|
|
449
|
-
//nested tags will not be parsed even for errors
|
|
450
443
|
alwaysCreateTextNode: false,
|
|
451
444
|
isArray: () => false,
|
|
452
445
|
commentPropName: false,
|
|
@@ -460,7 +453,6 @@ var __exports__ = (() => {
|
|
|
460
453
|
updateTag: function(tagName, jPath, attrs) {
|
|
461
454
|
return tagName;
|
|
462
455
|
}
|
|
463
|
-
// skipEmptyListItem: false
|
|
464
456
|
};
|
|
465
457
|
var buildOptions = function(options) {
|
|
466
458
|
return Object.assign({}, defaultOptions, options);
|
|
@@ -757,11 +749,6 @@ var __exports__ = (() => {
|
|
|
757
749
|
regex: /&(nbsp|#160);/g,
|
|
758
750
|
val: " "
|
|
759
751
|
},
|
|
760
|
-
// "lt" : { regex: /&(lt|#60);/g, val: "<" },
|
|
761
|
-
// "gt" : { regex: /&(gt|#62);/g, val: ">" },
|
|
762
|
-
// "amp" : { regex: /&(amp|#38);/g, val: "&" },
|
|
763
|
-
// "quot" : { regex: /&(quot|#34);/g, val: "\"" },
|
|
764
|
-
// "apos" : { regex: /&(apos|#39);/g, val: "'" },
|
|
765
752
|
"cent": {
|
|
766
753
|
regex: /&(cent|#162);/g,
|
|
767
754
|
val: "\xA2"
|
|
@@ -1351,11 +1338,6 @@ var __exports__ = (() => {
|
|
|
1351
1338
|
this.externalEntities = {};
|
|
1352
1339
|
this.options = buildOptions(options);
|
|
1353
1340
|
}
|
|
1354
|
-
/**
|
|
1355
|
-
* Parse XML dats to JS object
|
|
1356
|
-
* @param {string|Buffer} xmlData
|
|
1357
|
-
* @param {boolean|Object} validationOption
|
|
1358
|
-
*/
|
|
1359
1341
|
parse(xmlData, validationOption) {
|
|
1360
1342
|
if (typeof xmlData === "string") {
|
|
1361
1343
|
} else if (xmlData.toString) {
|
|
@@ -1379,11 +1361,6 @@ var __exports__ = (() => {
|
|
|
1379
1361
|
else
|
|
1380
1362
|
return prettify(orderedResult, this.options);
|
|
1381
1363
|
}
|
|
1382
|
-
/**
|
|
1383
|
-
* Add Entity which is not by default supported by this library
|
|
1384
|
-
* @param {string} key
|
|
1385
|
-
* @param {string} value
|
|
1386
|
-
*/
|
|
1387
1364
|
addEntity(key, value) {
|
|
1388
1365
|
if (value.indexOf("&") !== -1) {
|
|
1389
1366
|
throw new Error("Entity value can't have '&'");
|
|
@@ -1553,33 +1530,24 @@ var __exports__ = (() => {
|
|
|
1553
1530
|
preserveOrder: false,
|
|
1554
1531
|
commentPropName: false,
|
|
1555
1532
|
unpairedTags: [],
|
|
1556
|
-
entities: [
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
val: "'"
|
|
1573
|
-
},
|
|
1574
|
-
{
|
|
1575
|
-
regex: new RegExp('"', "g"),
|
|
1576
|
-
val: """
|
|
1577
|
-
}
|
|
1578
|
-
],
|
|
1533
|
+
entities: [{
|
|
1534
|
+
regex: new RegExp("&", "g"),
|
|
1535
|
+
val: "&"
|
|
1536
|
+
}, {
|
|
1537
|
+
regex: new RegExp(">", "g"),
|
|
1538
|
+
val: ">"
|
|
1539
|
+
}, {
|
|
1540
|
+
regex: new RegExp("<", "g"),
|
|
1541
|
+
val: "<"
|
|
1542
|
+
}, {
|
|
1543
|
+
regex: new RegExp("'", "g"),
|
|
1544
|
+
val: "'"
|
|
1545
|
+
}, {
|
|
1546
|
+
regex: new RegExp('"', "g"),
|
|
1547
|
+
val: """
|
|
1548
|
+
}],
|
|
1579
1549
|
processEntities: true,
|
|
1580
1550
|
stopNodes: [],
|
|
1581
|
-
// transformTagName: false,
|
|
1582
|
-
// transformAttributeName: false,
|
|
1583
1551
|
oneListGroup: false
|
|
1584
1552
|
};
|
|
1585
1553
|
function Builder(options) {
|
|
@@ -1837,21 +1805,14 @@ var __exports__ = (() => {
|
|
|
1837
1805
|
throw new Error(options?._parser);
|
|
1838
1806
|
}
|
|
1839
1807
|
const fastXMLOptions = {
|
|
1840
|
-
// Default FastXML options
|
|
1841
|
-
// https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/docs/v4/2.XMLparseOptions.md#allowbooleanattributes
|
|
1842
1808
|
allowBooleanAttributes: true,
|
|
1843
|
-
// https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/docs/v4/2.XMLparseOptions.md#ignoredeclaration
|
|
1844
1809
|
ignoreDeclaration: true,
|
|
1845
|
-
// https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/docs/v4/2.XMLparseOptions.md#removensprefix
|
|
1846
1810
|
removeNSPrefix: options?.removeNSPrefix,
|
|
1847
|
-
// https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/docs/v4/2.XMLparseOptions.md#textnodename
|
|
1848
1811
|
textNodeName: options?.textNodeName,
|
|
1849
|
-
// Let's application specify keys that are always arrays
|
|
1850
1812
|
isArray: (name, jpath, isLeafNode, isAttribute) => {
|
|
1851
1813
|
const array = Boolean(options?.arrayPaths?.some((path) => jpath === path));
|
|
1852
1814
|
return array;
|
|
1853
1815
|
},
|
|
1854
|
-
// Application overrides
|
|
1855
1816
|
...options?._fastXML
|
|
1856
1817
|
};
|
|
1857
1818
|
const xml = fastParseXML(text, fastXMLOptions);
|
|
@@ -1918,10 +1879,7 @@ var __exports__ = (() => {
|
|
|
1918
1879
|
var window_ = globals.window || globals.self || globals.global || {};
|
|
1919
1880
|
var global_ = globals.global || globals.self || globals.window || {};
|
|
1920
1881
|
var document_ = globals.document || {};
|
|
1921
|
-
var isBrowser = (
|
|
1922
|
-
// @ts-ignore process does not exist on browser
|
|
1923
|
-
Boolean(typeof process !== "object" || String(process) !== "[object process]" || process.browser)
|
|
1924
|
-
);
|
|
1882
|
+
var isBrowser = Boolean(typeof process !== "object" || String(process) !== "[object process]" || process.browser);
|
|
1925
1883
|
var matches = typeof process !== "undefined" && process.version && /v([0-9]*)/.exec(process.version);
|
|
1926
1884
|
var nodeVersion = matches && parseFloat(matches[1]) || 0;
|
|
1927
1885
|
|
|
@@ -1945,8 +1903,6 @@ var __exports__ = (() => {
|
|
|
1945
1903
|
|
|
1946
1904
|
// ../loader-utils/src/lib/sources/data-source.ts
|
|
1947
1905
|
var DataSource = class {
|
|
1948
|
-
/** A resolved fetch function extracted from loadOptions prop */
|
|
1949
|
-
/** The actual load options, if calling a loaders.gl loader */
|
|
1950
1906
|
_needsRefresh = true;
|
|
1951
1907
|
constructor(props) {
|
|
1952
1908
|
this.props = {
|
|
@@ -1961,14 +1917,9 @@ var __exports__ = (() => {
|
|
|
1961
1917
|
this.props = Object.assign(this.props, props);
|
|
1962
1918
|
this.setNeedsRefresh();
|
|
1963
1919
|
}
|
|
1964
|
-
/** Mark this data source as needing a refresh (redraw) */
|
|
1965
1920
|
setNeedsRefresh() {
|
|
1966
1921
|
this._needsRefresh = true;
|
|
1967
1922
|
}
|
|
1968
|
-
/**
|
|
1969
|
-
* Does this data source need refreshing?
|
|
1970
|
-
* @note The specifics of the refresh mechanism depends on type of data source
|
|
1971
|
-
*/
|
|
1972
1923
|
getNeedsRefresh(clear = true) {
|
|
1973
1924
|
const needsRefresh = this._needsRefresh;
|
|
1974
1925
|
if (clear) {
|
|
@@ -2283,8 +2234,6 @@ var __exports__ = (() => {
|
|
|
2283
2234
|
layers: [],
|
|
2284
2235
|
requests: extractRequests(xml.Capability?.Request),
|
|
2285
2236
|
exceptions: extractExceptions(xml.Exception)
|
|
2286
|
-
// contact field is a mess of largely irrelevant information, put it last
|
|
2287
|
-
// contact: xml.Service?.Contact ? JSON.stringify(xml.Service?.Contact) : undefined,
|
|
2288
2237
|
};
|
|
2289
2238
|
const xmlLayers = getXMLArray(xml.Capability?.Layer);
|
|
2290
2239
|
for (const xmlSubLayer of xmlLayers) {
|
|
@@ -2318,9 +2267,7 @@ var __exports__ = (() => {
|
|
|
2318
2267
|
}
|
|
2319
2268
|
function extractLayer(xmlLayer) {
|
|
2320
2269
|
const layer = {
|
|
2321
|
-
// All layers must have a title
|
|
2322
2270
|
title: String(xmlLayer?.Title || ""),
|
|
2323
|
-
// Name is required only if renderable
|
|
2324
2271
|
name: xmlLayer?.Name && String(xmlLayer?.Name),
|
|
2325
2272
|
abstract: xmlLayer?.Name && String(xmlLayer?.Abstract),
|
|
2326
2273
|
keywords: getXMLStringArray(xmlLayer.KeywordList?.Keyword)
|
|
@@ -2404,7 +2351,6 @@ var __exports__ = (() => {
|
|
|
2404
2351
|
resy
|
|
2405
2352
|
} = xmlBoundingBox;
|
|
2406
2353
|
const boundingBox = {
|
|
2407
|
-
// CRS in 1.3.0, SRS in 1.1.1
|
|
2408
2354
|
crs: CRS || SRS,
|
|
2409
2355
|
boundingBox: [[getXMLFloat(minx), getXMLFloat(miny)], [getXMLFloat(maxx), getXMLFloat(maxy)]]
|
|
2410
2356
|
};
|
|
@@ -2476,14 +2422,8 @@ var __exports__ = (() => {
|
|
|
2476
2422
|
options: {
|
|
2477
2423
|
wms: {}
|
|
2478
2424
|
},
|
|
2479
|
-
parse: async (arrayBuffer, options) => (
|
|
2480
|
-
|
|
2481
|
-
parseWMSCapabilities(new TextDecoder().decode(arrayBuffer), options?.wms)
|
|
2482
|
-
),
|
|
2483
|
-
parseTextSync: (text, options) => (
|
|
2484
|
-
// TODO pass in XML options
|
|
2485
|
-
parseWMSCapabilities(text, options?.wms)
|
|
2486
|
-
)
|
|
2425
|
+
parse: async (arrayBuffer, options) => parseWMSCapabilities(new TextDecoder().decode(arrayBuffer), options?.wms),
|
|
2426
|
+
parseTextSync: (text, options) => parseWMSCapabilities(text, options?.wms)
|
|
2487
2427
|
};
|
|
2488
2428
|
function testXMLFile6(text) {
|
|
2489
2429
|
return text.startsWith("<?xml");
|
|
@@ -3349,12 +3289,10 @@ var __exports__ = (() => {
|
|
|
3349
3289
|
var VERSION9 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
3350
3290
|
|
|
3351
3291
|
// ../images/src/lib/category-api/image-type.ts
|
|
3352
|
-
var
|
|
3353
|
-
_parseImageNode
|
|
3354
|
-
} = globalThis;
|
|
3292
|
+
var parseImageNode = globalThis.loaders?.parseImageNode;
|
|
3355
3293
|
var IMAGE_SUPPORTED = typeof Image !== "undefined";
|
|
3356
3294
|
var IMAGE_BITMAP_SUPPORTED = typeof ImageBitmap !== "undefined";
|
|
3357
|
-
var NODE_IMAGE_SUPPORTED = Boolean(
|
|
3295
|
+
var NODE_IMAGE_SUPPORTED = Boolean(parseImageNode);
|
|
3358
3296
|
var DATA_SUPPORTED = isBrowser ? true : NODE_IMAGE_SUPPORTED;
|
|
3359
3297
|
function isImageTypeSupported(type) {
|
|
3360
3298
|
switch (type) {
|
|
@@ -3571,7 +3509,6 @@ var __exports__ = (() => {
|
|
|
3571
3509
|
}
|
|
3572
3510
|
return {
|
|
3573
3511
|
mimeType: mediaType.mimeType,
|
|
3574
|
-
// TODO - decode width and height
|
|
3575
3512
|
width: 0,
|
|
3576
3513
|
height: 0
|
|
3577
3514
|
};
|
|
@@ -3629,9 +3566,7 @@ var __exports__ = (() => {
|
|
|
3629
3566
|
return {
|
|
3630
3567
|
mimeType: "image/jpeg",
|
|
3631
3568
|
height: dataView.getUint16(i + 5, BIG_ENDIAN),
|
|
3632
|
-
// Number of lines
|
|
3633
3569
|
width: dataView.getUint16(i + 7, BIG_ENDIAN)
|
|
3634
|
-
// Number of pixels per line
|
|
3635
3570
|
};
|
|
3636
3571
|
}
|
|
3637
3572
|
if (!tableMarkers.has(marker)) {
|
|
@@ -3671,9 +3606,9 @@ var __exports__ = (() => {
|
|
|
3671
3606
|
const {
|
|
3672
3607
|
mimeType
|
|
3673
3608
|
} = getBinaryImageMetadata(arrayBuffer) || {};
|
|
3674
|
-
const
|
|
3675
|
-
assert(
|
|
3676
|
-
return await
|
|
3609
|
+
const parseImageNode2 = globalThis.loaders?.parseImageNode;
|
|
3610
|
+
assert(parseImageNode2);
|
|
3611
|
+
return await parseImageNode2(arrayBuffer, mimeType);
|
|
3677
3612
|
}
|
|
3678
3613
|
|
|
3679
3614
|
// ../images/src/lib/parsers/parse-image.ts
|
|
@@ -3722,9 +3657,7 @@ var __exports__ = (() => {
|
|
|
3722
3657
|
image: {
|
|
3723
3658
|
type: "auto",
|
|
3724
3659
|
decode: true
|
|
3725
|
-
// if format is HTML
|
|
3726
3660
|
}
|
|
3727
|
-
// imagebitmap: {} - passes (platform dependent) parameters to ImageBitmap constructor
|
|
3728
3661
|
};
|
|
3729
3662
|
var ImageLoader = {
|
|
3730
3663
|
id: "image",
|
|
@@ -3734,7 +3667,6 @@ var __exports__ = (() => {
|
|
|
3734
3667
|
mimeTypes: MIME_TYPES,
|
|
3735
3668
|
extensions: EXTENSIONS,
|
|
3736
3669
|
parse: parseImage,
|
|
3737
|
-
// TODO: byteOffset, byteLength;
|
|
3738
3670
|
tests: [(arrayBuffer) => Boolean(getBinaryImageMetadata(new DataView(arrayBuffer)))],
|
|
3739
3671
|
options: DEFAULT_IMAGE_LOADER_OPTIONS
|
|
3740
3672
|
};
|
|
@@ -3746,13 +3678,7 @@ var __exports__ = (() => {
|
|
|
3746
3678
|
create: (props) => new WMSSource(props)
|
|
3747
3679
|
};
|
|
3748
3680
|
var WMSSource = class extends ImageSource {
|
|
3749
|
-
/** Base URL to the service */
|
|
3750
|
-
/** In WMS 1.3.0, replaces references to EPSG:4326 with CRS:84. But not always supported. Default: false */
|
|
3751
|
-
/** In WMS 1.3.0, flips x,y (lng, lat) coordinates for the supplied coordinate systems. Default: ['ESPG:4326'] */
|
|
3752
|
-
/** Default static WMS parameters */
|
|
3753
|
-
/** Default static vendor parameters */
|
|
3754
3681
|
capabilities = null;
|
|
3755
|
-
/** Create a WMSSource */
|
|
3756
3682
|
constructor(props) {
|
|
3757
3683
|
super(props);
|
|
3758
3684
|
this.url = props.url;
|
|
@@ -3773,7 +3699,6 @@ var __exports__ = (() => {
|
|
|
3773
3699
|
};
|
|
3774
3700
|
this.vendorParameters = props.vendorParameters || {};
|
|
3775
3701
|
}
|
|
3776
|
-
// ImageService implementation
|
|
3777
3702
|
async getMetadata() {
|
|
3778
3703
|
const capabilities = await this.getCapabilities();
|
|
3779
3704
|
return this.normalizeMetadata(capabilities);
|
|
@@ -3784,8 +3709,6 @@ var __exports__ = (() => {
|
|
|
3784
3709
|
normalizeMetadata(capabilities) {
|
|
3785
3710
|
return capabilities;
|
|
3786
3711
|
}
|
|
3787
|
-
// WMS Service API Stubs
|
|
3788
|
-
/** Get Capabilities */
|
|
3789
3712
|
async getCapabilities(wmsParameters, vendorParameters) {
|
|
3790
3713
|
const url = this.getCapabilitiesURL(wmsParameters, vendorParameters);
|
|
3791
3714
|
const response = await this.fetch(url);
|
|
@@ -3795,7 +3718,6 @@ var __exports__ = (() => {
|
|
|
3795
3718
|
this.capabilities = capabilities;
|
|
3796
3719
|
return capabilities;
|
|
3797
3720
|
}
|
|
3798
|
-
/** Get a map image */
|
|
3799
3721
|
async getMap(wmsParameters, vendorParameters) {
|
|
3800
3722
|
const url = this.getMapURL(wmsParameters, vendorParameters);
|
|
3801
3723
|
const response = await this.fetch(url);
|
|
@@ -3807,7 +3729,6 @@ var __exports__ = (() => {
|
|
|
3807
3729
|
throw this._parseError(arrayBuffer);
|
|
3808
3730
|
}
|
|
3809
3731
|
}
|
|
3810
|
-
/** Get Feature Info for a coordinate */
|
|
3811
3732
|
async getFeatureInfo(wmsParameters, vendorParameters) {
|
|
3812
3733
|
const url = this.getFeatureInfoURL(wmsParameters, vendorParameters);
|
|
3813
3734
|
const response = await this.fetch(url);
|
|
@@ -3815,7 +3736,6 @@ var __exports__ = (() => {
|
|
|
3815
3736
|
this._checkResponse(response, arrayBuffer);
|
|
3816
3737
|
return await WMSFeatureInfoLoader.parse(arrayBuffer, this.loadOptions);
|
|
3817
3738
|
}
|
|
3818
|
-
/** Get Feature Info for a coordinate */
|
|
3819
3739
|
async getFeatureInfoText(wmsParameters, vendorParameters) {
|
|
3820
3740
|
const url = this.getFeatureInfoURL(wmsParameters, vendorParameters);
|
|
3821
3741
|
const response = await this.fetch(url);
|
|
@@ -3823,7 +3743,6 @@ var __exports__ = (() => {
|
|
|
3823
3743
|
this._checkResponse(response, arrayBuffer);
|
|
3824
3744
|
return new TextDecoder().decode(arrayBuffer);
|
|
3825
3745
|
}
|
|
3826
|
-
/** Get more information about a layer */
|
|
3827
3746
|
async describeLayer(wmsParameters, vendorParameters) {
|
|
3828
3747
|
const url = this.describeLayerURL(wmsParameters, vendorParameters);
|
|
3829
3748
|
const response = await this.fetch(url);
|
|
@@ -3831,7 +3750,6 @@ var __exports__ = (() => {
|
|
|
3831
3750
|
this._checkResponse(response, arrayBuffer);
|
|
3832
3751
|
return await WMSLayerDescriptionLoader.parse(arrayBuffer, this.loadOptions);
|
|
3833
3752
|
}
|
|
3834
|
-
/** Get an image with a semantic legend */
|
|
3835
3753
|
async getLegendGraphic(wmsParameters, vendorParameters) {
|
|
3836
3754
|
const url = this.getLegendGraphicURL(wmsParameters, vendorParameters);
|
|
3837
3755
|
const response = await this.fetch(url);
|
|
@@ -3843,9 +3761,6 @@ var __exports__ = (() => {
|
|
|
3843
3761
|
throw this._parseError(arrayBuffer);
|
|
3844
3762
|
}
|
|
3845
3763
|
}
|
|
3846
|
-
// Typed URL creators
|
|
3847
|
-
// For applications that want full control of fetching and parsing
|
|
3848
|
-
/** Generate a URL for the GetCapabilities request */
|
|
3849
3764
|
getCapabilitiesURL(wmsParameters, vendorParameters) {
|
|
3850
3765
|
const options = {
|
|
3851
3766
|
version: this.wmsParameters.version,
|
|
@@ -3853,7 +3768,6 @@ var __exports__ = (() => {
|
|
|
3853
3768
|
};
|
|
3854
3769
|
return this._getWMSUrl("GetCapabilities", options, vendorParameters);
|
|
3855
3770
|
}
|
|
3856
|
-
/** Generate a URL for the GetMap request */
|
|
3857
3771
|
getMapURL(wmsParameters, vendorParameters) {
|
|
3858
3772
|
wmsParameters = this._getWMS130Parameters(wmsParameters);
|
|
3859
3773
|
const options = {
|
|
@@ -3865,35 +3779,23 @@ var __exports__ = (() => {
|
|
|
3865
3779
|
layers: this.wmsParameters.layers,
|
|
3866
3780
|
styles: this.wmsParameters.styles,
|
|
3867
3781
|
crs: this.wmsParameters.crs,
|
|
3868
|
-
// bbox: [-77.87304, 40.78975, -77.85828, 40.80228],
|
|
3869
|
-
// width: 1200,
|
|
3870
|
-
// height: 900,
|
|
3871
3782
|
...wmsParameters
|
|
3872
3783
|
};
|
|
3873
3784
|
return this._getWMSUrl("GetMap", options, vendorParameters);
|
|
3874
3785
|
}
|
|
3875
|
-
/** Generate a URL for the GetFeatureInfo request */
|
|
3876
3786
|
getFeatureInfoURL(wmsParameters, vendorParameters) {
|
|
3877
3787
|
wmsParameters = this._getWMS130Parameters(wmsParameters);
|
|
3878
3788
|
const options = {
|
|
3879
3789
|
version: this.wmsParameters.version,
|
|
3880
|
-
// query_layers: [],
|
|
3881
|
-
// format: this.wmsParameters.format,
|
|
3882
3790
|
info_format: this.wmsParameters.info_format,
|
|
3883
3791
|
layers: this.wmsParameters.layers,
|
|
3884
3792
|
query_layers: this.wmsParameters.query_layers,
|
|
3885
3793
|
styles: this.wmsParameters.styles,
|
|
3886
3794
|
crs: this.wmsParameters.crs,
|
|
3887
|
-
// bbox: [-77.87304, 40.78975, -77.85828, 40.80228],
|
|
3888
|
-
// width: 1200,
|
|
3889
|
-
// height: 900,
|
|
3890
|
-
// x: undefined!,
|
|
3891
|
-
// y: undefined!,
|
|
3892
3795
|
...wmsParameters
|
|
3893
3796
|
};
|
|
3894
3797
|
return this._getWMSUrl("GetFeatureInfo", options, vendorParameters);
|
|
3895
3798
|
}
|
|
3896
|
-
/** Generate a URL for the GetFeatureInfo request */
|
|
3897
3799
|
describeLayerURL(wmsParameters, vendorParameters) {
|
|
3898
3800
|
const options = {
|
|
3899
3801
|
version: this.wmsParameters.version,
|
|
@@ -3904,12 +3806,10 @@ var __exports__ = (() => {
|
|
|
3904
3806
|
getLegendGraphicURL(wmsParameters, vendorParameters) {
|
|
3905
3807
|
const options = {
|
|
3906
3808
|
version: this.wmsParameters.version,
|
|
3907
|
-
// format?
|
|
3908
3809
|
...wmsParameters
|
|
3909
3810
|
};
|
|
3910
3811
|
return this._getWMSUrl("GetLegendGraphic", options, vendorParameters);
|
|
3911
3812
|
}
|
|
3912
|
-
// INTERNAL METHODS
|
|
3913
3813
|
_parseWMSUrl(url) {
|
|
3914
3814
|
const [baseUrl, search] = url.split("?");
|
|
3915
3815
|
const searchParams = search.split("&");
|
|
@@ -3923,11 +3823,6 @@ var __exports__ = (() => {
|
|
|
3923
3823
|
parameters
|
|
3924
3824
|
};
|
|
3925
3825
|
}
|
|
3926
|
-
/**
|
|
3927
|
-
* Generate a URL with parameters
|
|
3928
|
-
* @note case _getWMSUrl may need to be overridden to handle certain backends?
|
|
3929
|
-
* @note at the moment, only URLs with parameters are supported (no XML payloads)
|
|
3930
|
-
* */
|
|
3931
3826
|
_getWMSUrl(request, wmsParameters, vendorParameters) {
|
|
3932
3827
|
let url = this.url;
|
|
3933
3828
|
let first = true;
|
|
@@ -3959,7 +3854,6 @@ var __exports__ = (() => {
|
|
|
3959
3854
|
}
|
|
3960
3855
|
return newParameters;
|
|
3961
3856
|
}
|
|
3962
|
-
// eslint-disable-complexity
|
|
3963
3857
|
_getURLParameter(key, value, wmsParameters) {
|
|
3964
3858
|
switch (key) {
|
|
3965
3859
|
case "crs":
|
|
@@ -3985,28 +3879,20 @@ var __exports__ = (() => {
|
|
|
3985
3879
|
key = key.toUpperCase();
|
|
3986
3880
|
return Array.isArray(value) ? `${key}=${value.join(",")}` : `${key}=${value ? String(value) : ""}`;
|
|
3987
3881
|
}
|
|
3988
|
-
/** Coordinate order is flipped for certain CRS in WMS 1.3.0 */
|
|
3989
3882
|
_flipBoundingBox(bboxValue, wmsParameters) {
|
|
3990
3883
|
if (!Array.isArray(bboxValue) || bboxValue.length !== 4) {
|
|
3991
3884
|
return null;
|
|
3992
3885
|
}
|
|
3993
|
-
const flipCoordinates = (
|
|
3994
|
-
// Only affects WMS 1.3.0
|
|
3995
|
-
wmsParameters.version === "1.3.0" && // Flip if we are dealing with a CRS that was flipped in 1.3.0
|
|
3996
|
-
this.flipCRS.includes(wmsParameters.crs || "") && // Don't flip if we are subsituting EPSG:4326 with CRS:84
|
|
3997
|
-
!(this.substituteCRS84 && wmsParameters.crs === "EPSG:4326")
|
|
3998
|
-
);
|
|
3886
|
+
const flipCoordinates = wmsParameters.version === "1.3.0" && this.flipCRS.includes(wmsParameters.crs || "") && !(this.substituteCRS84 && wmsParameters.crs === "EPSG:4326");
|
|
3999
3887
|
const bbox = bboxValue;
|
|
4000
3888
|
return flipCoordinates ? [bbox[1], bbox[0], bbox[3], bbox[2]] : bbox;
|
|
4001
3889
|
}
|
|
4002
|
-
/** Fetches an array buffer and checks the response (boilerplate reduction) */
|
|
4003
3890
|
async _fetchArrayBuffer(url) {
|
|
4004
3891
|
const response = await this.fetch(url);
|
|
4005
3892
|
const arrayBuffer = await response.arrayBuffer();
|
|
4006
3893
|
this._checkResponse(response, arrayBuffer);
|
|
4007
3894
|
return arrayBuffer;
|
|
4008
3895
|
}
|
|
4009
|
-
/** Checks for and parses a WMS XML formatted ServiceError and throws an exception */
|
|
4010
3896
|
_checkResponse(response, arrayBuffer) {
|
|
4011
3897
|
const contentType = response.headers["content-type"];
|
|
4012
3898
|
if (!response.ok || WMSErrorLoader.mimeTypes.includes(contentType)) {
|
|
@@ -4019,7 +3905,6 @@ var __exports__ = (() => {
|
|
|
4019
3905
|
throw new Error(error);
|
|
4020
3906
|
}
|
|
4021
3907
|
}
|
|
4022
|
-
/** Error situation detected */
|
|
4023
3908
|
_parseError(arrayBuffer) {
|
|
4024
3909
|
const error = WMSErrorLoader.parseSync?.(arrayBuffer, this.loadOptions);
|
|
4025
3910
|
return new Error(error);
|
|
@@ -4031,7 +3916,6 @@ var __exports__ = (() => {
|
|
|
4031
3916
|
constructor(props) {
|
|
4032
3917
|
super(props);
|
|
4033
3918
|
}
|
|
4034
|
-
// IMAGE SOURCE API
|
|
4035
3919
|
async getMetadata() {
|
|
4036
3920
|
throw new Error("ImageSource.getMetadata not implemented");
|
|
4037
3921
|
}
|
|
@@ -4042,8 +3926,6 @@ var __exports__ = (() => {
|
|
|
4042
3926
|
const arrayBuffer = await response.arrayBuffer();
|
|
4043
3927
|
return await ImageLoader.parse(arrayBuffer);
|
|
4044
3928
|
}
|
|
4045
|
-
// HELPERS
|
|
4046
|
-
/** Break up bounding box in east, north, south, west */
|
|
4047
3929
|
getGranularParameters(parameters) {
|
|
4048
3930
|
const [east, north, west, south] = parameters.bbox;
|
|
4049
3931
|
return {
|
|
@@ -4054,7 +3936,6 @@ var __exports__ = (() => {
|
|
|
4054
3936
|
west
|
|
4055
3937
|
};
|
|
4056
3938
|
}
|
|
4057
|
-
/** Supports both ${} and {} notations */
|
|
4058
3939
|
getURLFromTemplate(parameters) {
|
|
4059
3940
|
let url = this.props.url;
|
|
4060
3941
|
for (const [key, value] of Object.entries(parameters)) {
|
|
@@ -4072,37 +3953,21 @@ var __exports__ = (() => {
|
|
|
4072
3953
|
constructor(props) {
|
|
4073
3954
|
super(props);
|
|
4074
3955
|
}
|
|
4075
|
-
// ImageSource (normalized endpoints)
|
|
4076
3956
|
async getMetadata() {
|
|
4077
3957
|
return await this.metadata();
|
|
4078
3958
|
}
|
|
4079
3959
|
async getImage(parameters) {
|
|
4080
3960
|
throw new Error("not implemented");
|
|
4081
3961
|
}
|
|
4082
|
-
// ImageServer endpoints
|
|
4083
3962
|
async metadata() {
|
|
4084
3963
|
throw new Error("not implemented");
|
|
4085
3964
|
}
|
|
4086
|
-
/**
|
|
4087
|
-
* Form a URL to an ESRI ImageServer
|
|
4088
|
-
// 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`,
|
|
4089
|
-
*/
|
|
4090
3965
|
exportImage(options) {
|
|
4091
3966
|
throw new Error("not implemented");
|
|
4092
3967
|
}
|
|
4093
|
-
// URL creators
|
|
4094
3968
|
metadataURL(options) {
|
|
4095
3969
|
return `${this.props.url}?f=pjson`;
|
|
4096
3970
|
}
|
|
4097
|
-
/**
|
|
4098
|
-
* Form a URL to an ESRI ImageServer
|
|
4099
|
-
// https://sampleserver6.arcgisonline.com/arcgis/rest/services/NLCDLandCover2001/ImageServer/exportImage?
|
|
4100
|
-
// bbox=${bounds[0]},${bounds[1]},${bounds[2]},${bounds[3]}&bboxSR=4326&
|
|
4101
|
-
// size=${width},${height}&imageSR=102100&time=&format=jpgpng&pixelType=U8&
|
|
4102
|
-
// noData=&noDataInterpretation=esriNoDataMatchAny&interpolation=+RSP_NearestNeighbor&compression=&
|
|
4103
|
-
// compressionQuality=&bandIds=&mosaicRule=&renderingRule=&
|
|
4104
|
-
// f=image
|
|
4105
|
-
*/
|
|
4106
3971
|
exportImageURL(options) {
|
|
4107
3972
|
const bbox = `bbox=${options.bbox[0]},${options.bbox[1]},${options.bbox[2]},${options.bbox[3]}`;
|
|
4108
3973
|
const size = `size=${options.width},${options.height}`;
|
|
@@ -4115,11 +3980,6 @@ var __exports__ = (() => {
|
|
|
4115
3980
|
delete arcgisOptions.height;
|
|
4116
3981
|
return this.getUrl("exportImage", arcgisOptions);
|
|
4117
3982
|
}
|
|
4118
|
-
// INTERNAL METHODS
|
|
4119
|
-
/**
|
|
4120
|
-
* @note protected, since perhaps getWMSUrl may need to be overridden to handle certain backends?
|
|
4121
|
-
* @note if override is common, maybe add a callback prop?
|
|
4122
|
-
* */
|
|
4123
3983
|
getUrl(path, options, extra) {
|
|
4124
3984
|
let url = `${this.props.url}/${path}`;
|
|
4125
3985
|
let first = true;
|
|
@@ -4134,7 +3994,6 @@ var __exports__ = (() => {
|
|
|
4134
3994
|
}
|
|
4135
3995
|
return url;
|
|
4136
3996
|
}
|
|
4137
|
-
/** Checks for and parses a WMS XML formatted ServiceError and throws an exception */
|
|
4138
3997
|
async checkResponse(response) {
|
|
4139
3998
|
if (!response.ok) {
|
|
4140
3999
|
throw new Error("error");
|
|
@@ -4156,9 +4015,7 @@ var __exports__ = (() => {
|
|
|
4156
4015
|
// src/services/ogc/csw-service.ts
|
|
4157
4016
|
var CSWService = class extends DataSource {
|
|
4158
4017
|
capabilities = null;
|
|
4159
|
-
/** A list of loaders used by the CSWService methods */
|
|
4160
4018
|
loaders = [WMSErrorLoader, CSWCapabilitiesLoader];
|
|
4161
|
-
/** Create a CSWService */
|
|
4162
4019
|
constructor(props) {
|
|
4163
4020
|
super(props);
|
|
4164
4021
|
}
|
|
@@ -4217,8 +4074,6 @@ var __exports__ = (() => {
|
|
|
4217
4074
|
params: parts[1] || ""
|
|
4218
4075
|
};
|
|
4219
4076
|
}
|
|
4220
|
-
// CSW Service API Stubs
|
|
4221
|
-
/** Get Capabilities */
|
|
4222
4077
|
async getCapabilities(wmsParameters, vendorParameters) {
|
|
4223
4078
|
const url = this.getCapabilitiesURL(wmsParameters, vendorParameters);
|
|
4224
4079
|
const response = await this.fetch(url);
|
|
@@ -4227,7 +4082,6 @@ var __exports__ = (() => {
|
|
|
4227
4082
|
const capabilities = await CSWCapabilitiesLoader.parse(arrayBuffer, this.props.loadOptions);
|
|
4228
4083
|
return capabilities;
|
|
4229
4084
|
}
|
|
4230
|
-
/** Get Records */
|
|
4231
4085
|
async getRecords(wmsParameters, vendorParameters) {
|
|
4232
4086
|
const url = this.getRecordsURL(wmsParameters, vendorParameters);
|
|
4233
4087
|
const response = await this.fetch(url);
|
|
@@ -4235,7 +4089,6 @@ var __exports__ = (() => {
|
|
|
4235
4089
|
this._checkResponse(response, arrayBuffer);
|
|
4236
4090
|
return await CSWRecordsLoader.parse(arrayBuffer, this.props.loadOptions);
|
|
4237
4091
|
}
|
|
4238
|
-
/** Get Domain */
|
|
4239
4092
|
async getDomain(wmsParameters, vendorParameters) {
|
|
4240
4093
|
const url = this.getDomainURL(wmsParameters, vendorParameters);
|
|
4241
4094
|
const response = await this.fetch(url);
|
|
@@ -4243,9 +4096,6 @@ var __exports__ = (() => {
|
|
|
4243
4096
|
this._checkResponse(response, arrayBuffer);
|
|
4244
4097
|
return await CSWDomainLoader.parse(arrayBuffer, this.props.loadOptions);
|
|
4245
4098
|
}
|
|
4246
|
-
// Typed URL creators
|
|
4247
|
-
// For applications that want full control of fetching and parsing
|
|
4248
|
-
/** Generate a URL for the GetCapabilities request */
|
|
4249
4099
|
getCapabilitiesURL(wmsParameters, vendorParameters) {
|
|
4250
4100
|
const options = {
|
|
4251
4101
|
version: "3.0.0",
|
|
@@ -4256,7 +4106,6 @@ var __exports__ = (() => {
|
|
|
4256
4106
|
};
|
|
4257
4107
|
return this._getCSWUrl(options, vendorParameters);
|
|
4258
4108
|
}
|
|
4259
|
-
/** Generate a URL for the GetCapabilities request */
|
|
4260
4109
|
getRecordsURL(wmsParameters, vendorParameters) {
|
|
4261
4110
|
const options = {
|
|
4262
4111
|
version: "3.0.0",
|
|
@@ -4268,7 +4117,6 @@ var __exports__ = (() => {
|
|
|
4268
4117
|
};
|
|
4269
4118
|
return this._getCSWUrl(options, vendorParameters);
|
|
4270
4119
|
}
|
|
4271
|
-
/** Generate a URL for the GetCapabilities request */
|
|
4272
4120
|
getDomainURL(wmsParameters, vendorParameters) {
|
|
4273
4121
|
const options = {
|
|
4274
4122
|
version: "3.0.0",
|
|
@@ -4279,10 +4127,6 @@ var __exports__ = (() => {
|
|
|
4279
4127
|
};
|
|
4280
4128
|
return this._getCSWUrl(options, vendorParameters);
|
|
4281
4129
|
}
|
|
4282
|
-
// INTERNAL METHODS
|
|
4283
|
-
/**
|
|
4284
|
-
* @note case _getCSWUrl may need to be overridden to handle certain backends?
|
|
4285
|
-
* */
|
|
4286
4130
|
_getCSWUrl(options, vendorParameters) {
|
|
4287
4131
|
let url = this.props.url;
|
|
4288
4132
|
let first = true;
|
|
@@ -4297,7 +4141,6 @@ var __exports__ = (() => {
|
|
|
4297
4141
|
}
|
|
4298
4142
|
return encodeURI(url);
|
|
4299
4143
|
}
|
|
4300
|
-
/** Checks for and parses a CSW XML formatted ServiceError and throws an exception */
|
|
4301
4144
|
_checkResponse(response, arrayBuffer) {
|
|
4302
4145
|
const contentType = response.headers["content-type"];
|
|
4303
4146
|
if (!response.ok || WMSErrorLoader.mimeTypes.includes(contentType)) {
|
|
@@ -4305,7 +4148,6 @@ var __exports__ = (() => {
|
|
|
4305
4148
|
throw new Error(error);
|
|
4306
4149
|
}
|
|
4307
4150
|
}
|
|
4308
|
-
/** Error situation detected */
|
|
4309
4151
|
_parseError(arrayBuffer) {
|
|
4310
4152
|
const error = WMSErrorLoader.parseSync?.(arrayBuffer, this.props.loadOptions);
|
|
4311
4153
|
return new Error(error);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/wms",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.4",
|
|
4
4
|
"description": "Framework-independent loaders for the WMS (Web Map Service) standard",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -47,13 +47,13 @@
|
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@babel/runtime": "^7.3.1",
|
|
50
|
-
"@loaders.gl/images": "4.0.0-beta.
|
|
51
|
-
"@loaders.gl/loader-utils": "4.0.0-beta.
|
|
52
|
-
"@loaders.gl/schema": "4.0.0-beta.
|
|
53
|
-
"@loaders.gl/xml": "4.0.0-beta.
|
|
50
|
+
"@loaders.gl/images": "4.0.0-beta.4",
|
|
51
|
+
"@loaders.gl/loader-utils": "4.0.0-beta.4",
|
|
52
|
+
"@loaders.gl/schema": "4.0.0-beta.4",
|
|
53
|
+
"@loaders.gl/xml": "4.0.0-beta.4",
|
|
54
54
|
"@turf/rewind": "^5.1.5",
|
|
55
55
|
"deep-strict-equal": "^0.2.0",
|
|
56
56
|
"lerc": "^4.0.1"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "848c20b474532d301f2c3f8d4e1fb9bf262b86d4"
|
|
59
59
|
}
|