@loaders.gl/ogc 5.0.0-beta.1 → 5.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/README.md +4 -2
- package/dist/{wms/gml-loader.cjs → gml-loader.cjs} +2757 -3796
- package/dist/gml-loader.cjs.map +6 -0
- package/dist/gml-loader.d.ts +2 -0
- package/dist/gml-loader.d.ts.map +1 -0
- package/dist/gml-loader.js +2 -0
- package/dist/gml-loader.js.map +1 -0
- package/dist/index.cjs +342 -4376
- package/dist/index.cjs.map +3 -3
- package/dist/stac/index.cjs +19 -1041
- package/dist/stac/index.cjs.map +3 -3
- package/dist/stac/stac-source-loader-types.js +3 -3
- package/dist/stac/stac-source-loader-types.js.map +1 -1
- package/dist/{stac/stac-source.cjs → stac-source.cjs} +212 -779
- package/dist/stac-source.cjs.map +6 -0
- package/dist/stac-source.d.ts +2 -0
- package/dist/stac-source.d.ts.map +1 -0
- package/dist/stac-source.js +2 -0
- package/dist/stac-source.js.map +1 -0
- package/dist/wms/bundled.cjs +2561 -3514
- package/dist/wms/bundled.cjs.map +3 -3
- package/dist/wms/csw-capabilities-loader-with-parser.d.ts +1 -1
- package/dist/wms/csw-capabilities-loader-with-parser.d.ts.map +1 -1
- package/dist/wms/csw-capabilities-loader.d.ts +1 -1
- package/dist/wms/csw-capabilities-loader.d.ts.map +1 -1
- package/dist/wms/csw-capabilities-loader.js +1 -1
- package/dist/wms/csw-domain-loader-with-parser.d.ts +1 -1
- package/dist/wms/csw-domain-loader-with-parser.d.ts.map +1 -1
- package/dist/wms/csw-domain-loader.d.ts +1 -1
- package/dist/wms/csw-domain-loader.d.ts.map +1 -1
- package/dist/wms/csw-domain-loader.js +1 -1
- package/dist/wms/csw-records-loader-with-parser.d.ts +1 -1
- package/dist/wms/csw-records-loader-with-parser.d.ts.map +1 -1
- package/dist/wms/csw-records-loader.d.ts +1 -1
- package/dist/wms/csw-records-loader.d.ts.map +1 -1
- package/dist/wms/csw-records-loader.js +1 -1
- package/dist/wms/csw-source-loader.js +1 -1
- package/dist/wms/gml-loader-types.js +2 -2
- package/dist/wms/gml-loader-types.js.map +1 -1
- package/dist/wms/index.cjs +3040 -3892
- package/dist/wms/index.cjs.map +3 -3
- package/dist/wms/lib/parsers/csw/parse-csw-capabilities.d.ts +1 -1
- package/dist/wms/lib/parsers/csw/parse-csw-capabilities.d.ts.map +1 -1
- package/dist/wms/lib/parsers/csw/parse-csw-domain.d.ts +1 -1
- package/dist/wms/lib/parsers/csw/parse-csw-domain.d.ts.map +1 -1
- package/dist/wms/lib/parsers/csw/parse-csw-records.d.ts +1 -1
- package/dist/wms/lib/parsers/csw/parse-csw-records.d.ts.map +1 -1
- package/dist/wms/lib/parsers/csw/parse-csw-records.js +2 -5
- package/dist/wms/lib/parsers/csw/parse-csw-records.js.map +1 -1
- package/dist/wms/lib/parsers/csw/parse-exception-report.js +2 -2
- package/dist/wms/lib/parsers/csw/parse-exception-report.js.map +1 -1
- package/dist/wms/lib/parsers/wms/parse-wms-error.d.ts.map +1 -1
- package/dist/wms/lib/parsers/wms/parse-wms-error.js +3 -1
- package/dist/wms/lib/parsers/wms/parse-wms-error.js.map +1 -1
- package/dist/wms/lib/parsers/wms/parse-wms-layer-description.d.ts +1 -1
- package/dist/wms/lib/parsers/wms/parse-wms-layer-description.d.ts.map +1 -1
- package/dist/wms/lib/parsers/wmts/parse-wmts-capabilities.js +1 -1
- package/dist/wms/lib/parsers/wmts/parse-wmts-capabilities.js.map +1 -1
- package/dist/wms/lib/parsers/xml/parse-xml-text.d.ts +1 -1
- package/dist/wms/lib/parsers/xml/parse-xml-text.d.ts.map +1 -1
- package/dist/wms/lib/parsers/xml/parse-xml-text.js +2 -1
- package/dist/wms/lib/parsers/xml/parse-xml-text.js.map +1 -1
- package/dist/wms/unbundled.cjs +316 -3333
- package/dist/wms/unbundled.cjs.map +3 -3
- package/dist/wms/wcs-source-loader.js +1 -1
- package/dist/wms/wcs-source-loader.js.map +1 -1
- package/dist/wms/wfs-capabilities-loader.js +1 -1
- package/dist/wms/wfs-source-loader.d.ts +2 -2
- package/dist/wms/wfs-source-loader.js +2 -2
- package/dist/wms/wip/wcs-capabilities-loader.js +1 -1
- package/dist/wms/wip/wmts-capabilities-loader-with-parser.d.ts +1 -1
- package/dist/wms/wip/wmts-capabilities-loader-with-parser.d.ts.map +1 -1
- package/dist/wms/wip/wmts-capabilities-loader.d.ts +1 -1
- package/dist/wms/wip/wmts-capabilities-loader.d.ts.map +1 -1
- package/dist/wms/wip/wmts-capabilities-loader.js +1 -1
- package/dist/wms/wms-capabilities-loader-with-parser.d.ts +1 -1
- package/dist/wms/wms-capabilities-loader-with-parser.d.ts.map +1 -1
- package/dist/wms/wms-capabilities-loader.d.ts +1 -1
- package/dist/wms/wms-capabilities-loader.d.ts.map +1 -1
- package/dist/wms/wms-capabilities-loader.js +1 -1
- package/dist/wms/wms-error-loader.js +1 -1
- package/dist/wms/wms-source-loader.d.ts +2 -2
- package/dist/wms/wms-source-loader.d.ts.map +1 -1
- package/dist/wms/wms-source-loader.js +3 -3
- package/dist/wms/wms-source-loader.js.map +1 -1
- package/dist/wms/wmts-capabilities-loader.js +1 -1
- package/dist/wms/wmts-capabilities-loader.js.map +1 -1
- package/dist/wms/wmts-source-loader.d.ts +2 -2
- package/dist/wms/wmts-source-loader.d.ts.map +1 -1
- package/dist/wms/wmts-source-loader.js +3 -3
- package/dist/wms/wmts-source-loader.js.map +1 -1
- package/dist/{wms/wmts-capabilities-loader-with-parser.cjs → wmts-capabilities-loader-with-parser.cjs} +227 -179
- package/dist/wmts-capabilities-loader-with-parser.cjs.map +6 -0
- package/dist/wmts-capabilities-loader-with-parser.d.ts +2 -0
- package/dist/wmts-capabilities-loader-with-parser.d.ts.map +1 -0
- package/dist/wmts-capabilities-loader-with-parser.js +3 -0
- package/dist/wmts-capabilities-loader-with-parser.js.map +1 -0
- package/package.json +27 -20
- package/src/gml-loader.ts +1 -0
- package/src/stac/stac-source-loader-types.ts +2 -2
- package/src/stac-source.ts +1 -0
- package/src/wms/csw-capabilities-loader-with-parser.ts +1 -1
- package/src/wms/csw-capabilities-loader.ts +1 -1
- package/src/wms/csw-domain-loader-with-parser.ts +1 -1
- package/src/wms/csw-domain-loader.ts +1 -1
- package/src/wms/csw-records-loader-with-parser.ts +1 -1
- package/src/wms/csw-records-loader.ts +1 -1
- package/src/wms/gml-loader-types.ts +1 -1
- package/src/wms/lib/parsers/csw/parse-csw-capabilities.ts +1 -1
- package/src/wms/lib/parsers/csw/parse-csw-domain.ts +1 -1
- package/src/wms/lib/parsers/csw/parse-csw-records.ts +3 -6
- package/src/wms/lib/parsers/csw/parse-exception-report.ts +2 -2
- package/src/wms/lib/parsers/wms/parse-wms-error.ts +3 -1
- package/src/wms/lib/parsers/wms/parse-wms-layer-description.ts +1 -1
- package/src/wms/lib/parsers/wmts/parse-wmts-capabilities.ts +1 -1
- package/src/wms/lib/parsers/xml/parse-xml-text.ts +3 -2
- package/src/wms/wcs-source-loader.ts +1 -1
- package/src/wms/wfs-source-loader.ts +2 -2
- package/src/wms/wip/wms-feature-info-loader-with-parser.ts +1 -1
- package/src/wms/wip/wms-feature-info-loader.ts +1 -1
- package/src/wms/wip/wms-layer-description-loader-with-parser.ts +1 -1
- package/src/wms/wip/wms-layer-description-loader.ts +1 -1
- package/src/wms/wip/wmts-capabilities-loader-with-parser.ts +1 -1
- package/src/wms/wip/wmts-capabilities-loader.ts +1 -1
- package/src/wms/wms-capabilities-loader-with-parser.ts +1 -1
- package/src/wms/wms-capabilities-loader.ts +1 -1
- package/src/wms/wms-source-loader.ts +5 -13
- package/src/wms/wmts-capabilities-loader.ts +1 -1
- package/src/wms/wmts-source-loader.ts +5 -5
- package/src/wmts-capabilities-loader-with-parser.ts +2 -0
- package/dist/stac/stac-source.cjs.map +0 -6
- package/dist/wms/gml-loader.cjs.map +0 -6
- package/dist/wms/wmts-capabilities-loader-with-parser.cjs.map +0 -6
package/dist/wms/unbundled.cjs
CHANGED
|
@@ -80,26 +80,7 @@ var init_parse_exception_report = __esm({
|
|
|
80
80
|
}
|
|
81
81
|
});
|
|
82
82
|
|
|
83
|
-
// ../
|
|
84
|
-
var XMLFormat;
|
|
85
|
-
var init_xml_format = __esm({
|
|
86
|
-
"../xml/src/xml-format.ts"() {
|
|
87
|
-
"use strict";
|
|
88
|
-
XMLFormat = {
|
|
89
|
-
name: "XML",
|
|
90
|
-
id: "xml",
|
|
91
|
-
module: "xml",
|
|
92
|
-
encoding: "xml",
|
|
93
|
-
format: "xml",
|
|
94
|
-
extensions: ["xml"],
|
|
95
|
-
mimeTypes: ["application/xml", "text/xml"],
|
|
96
|
-
category: "table",
|
|
97
|
-
text: true
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
// ../xml/src/lib/xml-utils/uncapitalize.ts
|
|
83
|
+
// ../documents/src/lib/xml-utils/uncapitalize.ts
|
|
103
84
|
function uncapitalize(str) {
|
|
104
85
|
return typeof str === "string" ? str.charAt(0).toLowerCase() + str.slice(1) : str;
|
|
105
86
|
}
|
|
@@ -110,22 +91,27 @@ function uncapitalizeKeys(object) {
|
|
|
110
91
|
if (object && typeof object === "object") {
|
|
111
92
|
const newObject = {};
|
|
112
93
|
for (const [key, value] of Object.entries(object)) {
|
|
113
|
-
newObject
|
|
94
|
+
Object.defineProperty(newObject, uncapitalize(key), {
|
|
95
|
+
value: uncapitalizeKeys(value),
|
|
96
|
+
enumerable: true,
|
|
97
|
+
configurable: true,
|
|
98
|
+
writable: true
|
|
99
|
+
});
|
|
114
100
|
}
|
|
115
101
|
return newObject;
|
|
116
102
|
}
|
|
117
103
|
return object;
|
|
118
104
|
}
|
|
119
105
|
var init_uncapitalize = __esm({
|
|
120
|
-
"../
|
|
106
|
+
"../documents/src/lib/xml-utils/uncapitalize.ts"() {
|
|
121
107
|
"use strict";
|
|
122
108
|
}
|
|
123
109
|
});
|
|
124
110
|
|
|
125
|
-
// ../
|
|
111
|
+
// ../documents/src/sax-ts/sax.ts
|
|
126
112
|
var DEFAULT_SAX_EVENTS, DEFAULT_SAX_PARSER_OPTIONS, EVENTS, BUFFERS, nameStart, nameBody, entityStart, entityBody, ENTITIES, SAX, SAXParser;
|
|
127
113
|
var init_sax = __esm({
|
|
128
|
-
"../
|
|
114
|
+
"../documents/src/sax-ts/sax.ts"() {
|
|
129
115
|
"use strict";
|
|
130
116
|
DEFAULT_SAX_EVENTS = {
|
|
131
117
|
ontext: () => {
|
|
@@ -173,6 +159,9 @@ var init_sax = __esm({
|
|
|
173
159
|
lowercasetags: false,
|
|
174
160
|
noscript: false,
|
|
175
161
|
strictEntities: false,
|
|
162
|
+
preserveCase: false,
|
|
163
|
+
caseInsensitiveTags: false,
|
|
164
|
+
processEntities: true,
|
|
176
165
|
xmlns: void 0,
|
|
177
166
|
position: void 0,
|
|
178
167
|
trim: void 0,
|
|
@@ -989,7 +978,12 @@ var init_sax = __esm({
|
|
|
989
978
|
continue;
|
|
990
979
|
} else {
|
|
991
980
|
this.strictFail("Attribute without value");
|
|
992
|
-
this.tag.attributes
|
|
981
|
+
Object.defineProperty(this.tag.attributes, this.attribName, {
|
|
982
|
+
value: "",
|
|
983
|
+
enumerable: true,
|
|
984
|
+
configurable: true,
|
|
985
|
+
writable: true
|
|
986
|
+
});
|
|
993
987
|
this.attribValue = "";
|
|
994
988
|
this.emitNode("onattribute", {
|
|
995
989
|
name: this.attribName,
|
|
@@ -1170,7 +1164,7 @@ var init_sax = __esm({
|
|
|
1170
1164
|
}
|
|
1171
1165
|
end() {
|
|
1172
1166
|
if (this.sawRoot && !this.closedRoot) this.strictFail("Unclosed root tag");
|
|
1173
|
-
if (this.state !== this.S.BEGIN && this.state !== this.S.BEGIN_WHITESPACE && this.state !== this.S.TEXT) {
|
|
1167
|
+
if (this.strict && this.state !== this.S.BEGIN && this.state !== this.S.BEGIN_WHITESPACE && this.state !== this.S.TEXT) {
|
|
1174
1168
|
this.errorFunction("Unexpected end");
|
|
1175
1169
|
}
|
|
1176
1170
|
this.closeText();
|
|
@@ -1193,10 +1187,11 @@ Char: ${this.c}`;
|
|
|
1193
1187
|
return this;
|
|
1194
1188
|
}
|
|
1195
1189
|
attrib() {
|
|
1196
|
-
if (!this.strict) {
|
|
1190
|
+
if (!this.strict && !this.opt.preserveCase) {
|
|
1197
1191
|
this.attribName = this.attribName[this.looseCase]();
|
|
1198
1192
|
}
|
|
1199
|
-
if (this.attribList.indexOf(this.attribName) !== -1 || this.tag.attributes
|
|
1193
|
+
if (this.attribList.indexOf(this.attribName) !== -1 || Object.hasOwn(this.tag.attributes, this.attribName)) {
|
|
1194
|
+
this.strictFail("Duplicate attribute");
|
|
1200
1195
|
this.attribName = this.attribValue = "";
|
|
1201
1196
|
return;
|
|
1202
1197
|
}
|
|
@@ -1226,7 +1221,12 @@ Actual: ${this.attribValue}`
|
|
|
1226
1221
|
}
|
|
1227
1222
|
this.attribList.push([this.attribName, this.attribValue]);
|
|
1228
1223
|
} else {
|
|
1229
|
-
this.tag.attributes
|
|
1224
|
+
Object.defineProperty(this.tag.attributes, this.attribName, {
|
|
1225
|
+
value: this.attribValue,
|
|
1226
|
+
enumerable: true,
|
|
1227
|
+
configurable: true,
|
|
1228
|
+
writable: true
|
|
1229
|
+
});
|
|
1230
1230
|
this.emitNode("onattribute", {
|
|
1231
1231
|
name: this.attribName,
|
|
1232
1232
|
value: this.attribValue
|
|
@@ -1235,7 +1235,7 @@ Actual: ${this.attribValue}`
|
|
|
1235
1235
|
this.attribName = this.attribValue = "";
|
|
1236
1236
|
}
|
|
1237
1237
|
newTag() {
|
|
1238
|
-
if (!this.strict) this.tagName = this.tagName[this.looseCase]();
|
|
1238
|
+
if (!this.strict && !this.opt.preserveCase) this.tagName = this.tagName[this.looseCase]();
|
|
1239
1239
|
const parent = this.tags[this.tags.length - 1] || this;
|
|
1240
1240
|
const tag = { name: this.tagName, attributes: {} };
|
|
1241
1241
|
this.tag = tag;
|
|
@@ -1245,15 +1245,21 @@ Actual: ${this.attribValue}`
|
|
|
1245
1245
|
this.attribList.length = 0;
|
|
1246
1246
|
this.emitNode("onopentagstart", tag);
|
|
1247
1247
|
}
|
|
1248
|
+
/** Validates an entity before optionally preserving its authored spelling. */
|
|
1248
1249
|
parseEntity() {
|
|
1250
|
+
const decoded = this.decodeEntity();
|
|
1251
|
+
return this.opt.processEntities === false ? `&${this.entity};` : decoded;
|
|
1252
|
+
}
|
|
1253
|
+
/** Decodes predefined, configured, or numeric entities without resolving document types. */
|
|
1254
|
+
decodeEntity() {
|
|
1249
1255
|
let entity = this.entity;
|
|
1250
1256
|
const entityLC = entity.toLowerCase();
|
|
1251
1257
|
let num = NaN;
|
|
1252
1258
|
let numStr = "";
|
|
1253
|
-
if (this.ENTITIES[entity]) {
|
|
1259
|
+
if (typeof this.ENTITIES[entity] === "string" || typeof this.ENTITIES[entity] === "number") {
|
|
1254
1260
|
return this.ENTITIES[entity];
|
|
1255
1261
|
}
|
|
1256
|
-
if (this.ENTITIES[entityLC]) {
|
|
1262
|
+
if (typeof this.ENTITIES[entityLC] === "string" || typeof this.ENTITIES[entityLC] === "number") {
|
|
1257
1263
|
return this.ENTITIES[entityLC];
|
|
1258
1264
|
}
|
|
1259
1265
|
entity = entityLC;
|
|
@@ -1273,6 +1279,10 @@ Actual: ${this.attribValue}`
|
|
|
1273
1279
|
this.strictFail("Invalid character entity");
|
|
1274
1280
|
return `&${this.entity};`;
|
|
1275
1281
|
}
|
|
1282
|
+
if (num < 0 || num > 1114111 || num >= 55296 && num <= 57343 || num < 32 && ![9, 10, 13].includes(num) || num === 65534 || num === 65535) {
|
|
1283
|
+
this.strictFail("Invalid character entity");
|
|
1284
|
+
return `&${this.entity};`;
|
|
1285
|
+
}
|
|
1276
1286
|
return String.fromCodePoint(num);
|
|
1277
1287
|
}
|
|
1278
1288
|
beginWhiteSpace(c) {
|
|
@@ -1378,7 +1388,12 @@ Actual: ${this.attribValue}`
|
|
|
1378
1388
|
this.strictFail(`Unbound namespace prefix: ${JSON.stringify(prefix)}`);
|
|
1379
1389
|
a.uri = prefix;
|
|
1380
1390
|
}
|
|
1381
|
-
this.tag.attributes
|
|
1391
|
+
Object.defineProperty(this.tag.attributes, name, {
|
|
1392
|
+
value: a,
|
|
1393
|
+
enumerable: true,
|
|
1394
|
+
configurable: true,
|
|
1395
|
+
writable: true
|
|
1396
|
+
});
|
|
1382
1397
|
this.emitNode("onattribute", a);
|
|
1383
1398
|
}
|
|
1384
1399
|
this.attribList.length = 0;
|
|
@@ -1406,8 +1421,10 @@ Actual: ${this.attribValue}`
|
|
|
1406
1421
|
this.state = this.S.TEXT;
|
|
1407
1422
|
return;
|
|
1408
1423
|
}
|
|
1424
|
+
const caseInsensitiveTags = !this.strict && (this.opt.caseInsensitiveTags || !this.opt.preserveCase);
|
|
1409
1425
|
if (this.script) {
|
|
1410
|
-
|
|
1426
|
+
const normalizedScriptCloseTag = caseInsensitiveTags ? this.tagName.toLowerCase() : this.tagName;
|
|
1427
|
+
if (normalizedScriptCloseTag !== "script") {
|
|
1411
1428
|
this.script += `</${this.tagName}>`;
|
|
1412
1429
|
this.tagName = "";
|
|
1413
1430
|
this.state = this.S.SCRIPT;
|
|
@@ -1418,12 +1435,11 @@ Actual: ${this.attribValue}`
|
|
|
1418
1435
|
}
|
|
1419
1436
|
let t = this.tags.length;
|
|
1420
1437
|
let tagName = this.tagName;
|
|
1421
|
-
|
|
1422
|
-
tagName = tagName[this.looseCase]();
|
|
1423
|
-
}
|
|
1438
|
+
const normalizedTagName = caseInsensitiveTags ? tagName.toLowerCase() : tagName;
|
|
1424
1439
|
while (t--) {
|
|
1425
1440
|
const close = this.tags[t];
|
|
1426
|
-
|
|
1441
|
+
const normalizedOpenTagName = caseInsensitiveTags ? close.name.toLowerCase() : close.name;
|
|
1442
|
+
if (normalizedOpenTagName !== normalizedTagName) {
|
|
1427
1443
|
this.strictFail("Unexpected close tag");
|
|
1428
1444
|
} else {
|
|
1429
1445
|
break;
|
|
@@ -1508,200 +1524,225 @@ Actual: ${this.attribValue}`
|
|
|
1508
1524
|
}
|
|
1509
1525
|
});
|
|
1510
1526
|
|
|
1511
|
-
// ../
|
|
1527
|
+
// ../documents/src/lib/parsers/parse-xml-internal.ts
|
|
1528
|
+
function setXMLField(object, name, value) {
|
|
1529
|
+
Object.defineProperty(object, name, {
|
|
1530
|
+
value,
|
|
1531
|
+
enumerable: true,
|
|
1532
|
+
configurable: true,
|
|
1533
|
+
writable: true
|
|
1534
|
+
});
|
|
1535
|
+
}
|
|
1512
1536
|
function parseXMLInternal(text2, options = {}) {
|
|
1513
|
-
|
|
1537
|
+
if (options.strict !== false && /[^\u0009\u000a\u000d\u0020-\ud7ff\ue000-\ufffd\u{10000}-\u{10ffff}]/u.test(text2)) {
|
|
1538
|
+
throw new Error("XML: invalid XML character");
|
|
1539
|
+
}
|
|
1540
|
+
const maximumDepth = options.maxDepth ?? 256;
|
|
1541
|
+
if (!Number.isSafeInteger(maximumDepth) || maximumDepth < 1 || maximumDepth > 4096) {
|
|
1542
|
+
throw new Error("XML: maxDepth must be an integer between 1 and 4096");
|
|
1543
|
+
}
|
|
1544
|
+
const state = new InternalXMLParserState(options, maximumDepth);
|
|
1514
1545
|
const parser = new SAXParser({
|
|
1515
|
-
strict:
|
|
1546
|
+
strict: options.strict !== false,
|
|
1547
|
+
strictEntities: !options.htmlEntities,
|
|
1548
|
+
preserveCase: true,
|
|
1549
|
+
caseInsensitiveTags: options.strict === false,
|
|
1550
|
+
processEntities: options.processEntities !== false,
|
|
1516
1551
|
onopentag: (tag) => state.openElement(tag.name, tag.attributes || {}),
|
|
1517
|
-
ontext: (
|
|
1518
|
-
oncdata: (
|
|
1552
|
+
ontext: (value) => state.addText(value),
|
|
1553
|
+
oncdata: (value) => state.addText(value),
|
|
1554
|
+
onscript: (value) => state.addText(value),
|
|
1519
1555
|
onclosetag: () => state.closeElement(),
|
|
1520
1556
|
onerror: (error) => {
|
|
1521
1557
|
throw error;
|
|
1522
1558
|
}
|
|
1523
1559
|
});
|
|
1524
1560
|
parser.write(text2).close();
|
|
1561
|
+
if (options.strict === false) {
|
|
1562
|
+
while (state.stack.length) state.closeElement();
|
|
1563
|
+
}
|
|
1564
|
+
if (state.result === void 0) throw new Error("XML: document requires a root element");
|
|
1525
1565
|
return state.result;
|
|
1526
1566
|
}
|
|
1527
1567
|
var InternalXMLParserState;
|
|
1528
1568
|
var init_parse_xml_internal = __esm({
|
|
1529
|
-
"../
|
|
1569
|
+
"../documents/src/lib/parsers/parse-xml-internal.ts"() {
|
|
1530
1570
|
"use strict";
|
|
1531
1571
|
init_sax();
|
|
1532
1572
|
InternalXMLParserState = class {
|
|
1533
|
-
/**
|
|
1573
|
+
/** Initializes conversion options and the element nesting budget. */
|
|
1574
|
+
constructor(options, maximumDepth) {
|
|
1575
|
+
this.options = options;
|
|
1576
|
+
this.maximumDepth = maximumDepth;
|
|
1577
|
+
}
|
|
1534
1578
|
options;
|
|
1579
|
+
maximumDepth;
|
|
1535
1580
|
/** Open element stack. */
|
|
1536
1581
|
stack = [];
|
|
1537
|
-
/**
|
|
1582
|
+
/** Parsed root document. */
|
|
1538
1583
|
result;
|
|
1539
|
-
/**
|
|
1540
|
-
constructor(options) {
|
|
1541
|
-
this.options = options;
|
|
1542
|
-
}
|
|
1543
|
-
/** Start a new element. */
|
|
1584
|
+
/** Starts an element, rejecting multiple roots and excessive nesting. */
|
|
1544
1585
|
openElement(name, attributes) {
|
|
1586
|
+
if (this.stack.length >= this.maximumDepth)
|
|
1587
|
+
throw new Error("XML: maximum nesting depth exceeded");
|
|
1588
|
+
if (!this.stack.length && this.result !== void 0 && this.options.strict !== false) {
|
|
1589
|
+
throw new Error("XML: document requires a single root element");
|
|
1590
|
+
}
|
|
1545
1591
|
const elementName = this.normalizeName(name);
|
|
1546
1592
|
const parent = this.stack[this.stack.length - 1];
|
|
1547
|
-
const path = parent ? `${parent.path}.${elementName}` : elementName;
|
|
1548
1593
|
this.stack.push({
|
|
1549
1594
|
name: elementName,
|
|
1550
|
-
path,
|
|
1595
|
+
path: parent ? `${parent.path}.${elementName}` : elementName,
|
|
1551
1596
|
attributes: this.normalizeAttributes(attributes),
|
|
1552
1597
|
children: {},
|
|
1598
|
+
orderedChildren: [],
|
|
1553
1599
|
text: ""
|
|
1554
1600
|
});
|
|
1555
1601
|
}
|
|
1556
|
-
/**
|
|
1602
|
+
/** Accumulates text without losing whitespace between text and CDATA chunks. */
|
|
1557
1603
|
addText(text2) {
|
|
1558
|
-
const
|
|
1559
|
-
|
|
1560
|
-
if (currentElement && trimmedText) {
|
|
1561
|
-
currentElement.text += trimmedText;
|
|
1562
|
-
}
|
|
1604
|
+
const current = this.stack[this.stack.length - 1];
|
|
1605
|
+
if (current) current.text += text2;
|
|
1563
1606
|
}
|
|
1564
|
-
/**
|
|
1607
|
+
/** Finishes an element and attaches it to its parent or the document root. */
|
|
1565
1608
|
closeElement() {
|
|
1566
1609
|
const node = this.stack.pop();
|
|
1567
|
-
if (!node)
|
|
1568
|
-
return;
|
|
1569
|
-
}
|
|
1610
|
+
if (!node) return;
|
|
1570
1611
|
const value = this.finalizeElement(node);
|
|
1571
1612
|
const parent = this.stack[this.stack.length - 1];
|
|
1572
|
-
if (
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1613
|
+
if (this.options.preserveOrder) {
|
|
1614
|
+
if (parent) parent.orderedChildren.push(value);
|
|
1615
|
+
else this.result = value;
|
|
1616
|
+
return;
|
|
1617
|
+
}
|
|
1618
|
+
if (parent) this.addChild(parent.children, node.name, node.path, value);
|
|
1619
|
+
else {
|
|
1620
|
+
if (this.result === void 0) this.result = {};
|
|
1621
|
+
this.addChild(this.result, node.name, node.path, value);
|
|
1576
1622
|
}
|
|
1577
1623
|
}
|
|
1578
|
-
/**
|
|
1624
|
+
/** Converts a completed element, keeping grouping and coercion independent. */
|
|
1579
1625
|
finalizeElement(node) {
|
|
1580
|
-
const
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
if (!hasAttributes && !hasChildren) {
|
|
1584
|
-
return hasText ? this.parseValue(node.text) : "";
|
|
1626
|
+
const text2 = this.options.trimValues === false ? node.text : node.text.trim();
|
|
1627
|
+
if (this.options.preserveOrder) {
|
|
1628
|
+
return { name: node.name, attributes: node.attributes, children: node.orderedChildren, text: text2 };
|
|
1585
1629
|
}
|
|
1586
|
-
const
|
|
1587
|
-
if (
|
|
1588
|
-
|
|
1630
|
+
const hasAttributes = Object.keys(node.attributes).length > 0;
|
|
1631
|
+
if (!hasAttributes && !Object.keys(node.children).length) {
|
|
1632
|
+
return this.parseValue(text2, this.options.parseTagValue !== false);
|
|
1633
|
+
}
|
|
1634
|
+
const object = node.children;
|
|
1635
|
+
if (text2)
|
|
1636
|
+
setXMLField(
|
|
1637
|
+
object,
|
|
1638
|
+
this.options.textNodeName ?? "value",
|
|
1639
|
+
this.parseValue(text2, this.options.parseTagValue !== false)
|
|
1640
|
+
);
|
|
1641
|
+
if (hasAttributes && this.options.attributesGroupName) {
|
|
1642
|
+
setXMLField(object, this.options.attributesGroupName, node.attributes);
|
|
1643
|
+
} else {
|
|
1644
|
+
for (const [name, value] of Object.entries(node.attributes)) setXMLField(object, name, value);
|
|
1589
1645
|
}
|
|
1590
|
-
Object.assign(object, node.attributes);
|
|
1591
1646
|
return object;
|
|
1592
1647
|
}
|
|
1593
|
-
/**
|
|
1594
|
-
addChild(
|
|
1648
|
+
/** Appends an element while preserving repeated and explicitly array-valued fields. */
|
|
1649
|
+
addChild(object, name, path, value) {
|
|
1595
1650
|
var _a;
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
if (existingValue === void 0) {
|
|
1599
|
-
parent.children[name] = shouldBeArray ? [value] : value;
|
|
1600
|
-
} else if (Array.isArray(existingValue)) {
|
|
1601
|
-
existingValue.push(value);
|
|
1651
|
+
if (!Object.hasOwn(object, name)) {
|
|
1652
|
+
setXMLField(object, name, ((_a = this.options.arrayPaths) == null ? void 0 : _a.includes(path)) ? [value] : value);
|
|
1602
1653
|
} else {
|
|
1603
|
-
|
|
1654
|
+
const existing = object[name];
|
|
1655
|
+
if (Array.isArray(existing)) existing.push(value);
|
|
1656
|
+
else setXMLField(object, name, [existing, value]);
|
|
1604
1657
|
}
|
|
1605
1658
|
}
|
|
1606
|
-
/**
|
|
1659
|
+
/** Applies namespace, prefix, grouping and scalar options to attributes. */
|
|
1607
1660
|
normalizeAttributes(attributes) {
|
|
1608
|
-
const
|
|
1661
|
+
const normalized = {};
|
|
1662
|
+
if (this.options.ignoreAttributes) return normalized;
|
|
1609
1663
|
for (const [name, value] of Object.entries(attributes)) {
|
|
1610
|
-
if (this.options.removeNSPrefix && name.startsWith("xmlns"))
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1664
|
+
if (this.options.removeNSPrefix && (name === "xmlns" || name.startsWith("xmlns:"))) continue;
|
|
1665
|
+
const text2 = this.options.trimValues === false ? value : value.trim();
|
|
1666
|
+
setXMLField(
|
|
1667
|
+
normalized,
|
|
1668
|
+
(this.options.attributeNamePrefix ?? "") + this.normalizeName(name),
|
|
1669
|
+
this.parseValue(text2, this.options.parseAttributeValue === true)
|
|
1670
|
+
);
|
|
1614
1671
|
}
|
|
1615
|
-
return
|
|
1672
|
+
return normalized;
|
|
1616
1673
|
}
|
|
1617
|
-
/**
|
|
1674
|
+
/** Removes a namespace prefix only when requested. */
|
|
1618
1675
|
normalizeName(name) {
|
|
1619
|
-
|
|
1620
|
-
return name;
|
|
1621
|
-
}
|
|
1622
|
-
const separatorIndex = name.indexOf(":");
|
|
1623
|
-
return separatorIndex === -1 ? name : name.slice(separatorIndex + 1);
|
|
1624
|
-
}
|
|
1625
|
-
/** Parse attribute values only when the fast-xml-parser compatibility option requests it. */
|
|
1626
|
-
parseAttributeValue(value) {
|
|
1627
|
-
var _a;
|
|
1628
|
-
return ((_a = this.options._fastXML) == null ? void 0 : _a.parseAttributeValue) ? this.parseValue(value) : value;
|
|
1676
|
+
return this.options.removeNSPrefix ? name.slice(name.indexOf(":") + 1) : name;
|
|
1629
1677
|
}
|
|
1630
|
-
/**
|
|
1631
|
-
parseValue(value) {
|
|
1632
|
-
|
|
1633
|
-
if (
|
|
1634
|
-
|
|
1635
|
-
}
|
|
1636
|
-
if (/^(?:true|false)$/i.test(value)) {
|
|
1637
|
-
return value.toLowerCase() === "true";
|
|
1638
|
-
}
|
|
1639
|
-
if (value !== "" && Number.isFinite(Number(value))) {
|
|
1640
|
-
return Number(value);
|
|
1641
|
-
}
|
|
1678
|
+
/** Coerces only finite numeric values and lowercase XML boolean literals. */
|
|
1679
|
+
parseValue(value, convert) {
|
|
1680
|
+
if (!convert) return value;
|
|
1681
|
+
if (value === "true" || value === "false") return value === "true";
|
|
1682
|
+
if (value !== "" && value.trim() !== "" && Number.isFinite(Number(value))) return Number(value);
|
|
1642
1683
|
return value;
|
|
1643
1684
|
}
|
|
1644
1685
|
};
|
|
1645
1686
|
}
|
|
1646
1687
|
});
|
|
1647
1688
|
|
|
1648
|
-
// ../
|
|
1649
|
-
function parseXMLSync(text2, options) {
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
}
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
// https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/docs/v4/2.XMLparseOptions.md#ignoredeclaration
|
|
1659
|
-
ignoreDeclaration: true,
|
|
1660
|
-
// https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/docs/v4/2.XMLparseOptions.md#removensprefix
|
|
1661
|
-
removeNSPrefix: options == null ? void 0 : options.removeNSPrefix,
|
|
1662
|
-
// https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/docs/v4/2.XMLparseOptions.md#textnodename
|
|
1663
|
-
textNodeName: options == null ? void 0 : options.textNodeName,
|
|
1664
|
-
// Let's application specify keys that are always arrays
|
|
1665
|
-
isArray: (name, jpath, isLeafNode, isAttribute) => {
|
|
1666
|
-
var _a;
|
|
1667
|
-
const array = Boolean((_a = options == null ? void 0 : options.arrayPaths) == null ? void 0 : _a.some((path) => jpath.toString() === path));
|
|
1668
|
-
return array;
|
|
1669
|
-
},
|
|
1670
|
-
// Application overrides
|
|
1671
|
-
...options == null ? void 0 : options._fastXML
|
|
1672
|
-
};
|
|
1673
|
-
return fastParseXML(text2, fastXMLOptions);
|
|
1674
|
-
}
|
|
1675
|
-
function fastParseXML(text2, options) {
|
|
1676
|
-
const parser = new import_fast_xml_parser.XMLParser({
|
|
1677
|
-
ignoreAttributes: false,
|
|
1678
|
-
attributeNamePrefix: "",
|
|
1679
|
-
...options
|
|
1680
|
-
});
|
|
1681
|
-
const parsedXML = parser.parse(text2);
|
|
1682
|
-
return parsedXML;
|
|
1689
|
+
// ../documents/src/lib/parsers/parse-xml.ts
|
|
1690
|
+
function parseXMLSync(text2, options = {}) {
|
|
1691
|
+
if (Object.hasOwn(options, "_fastXML") || Object.hasOwn(options, "_sax")) {
|
|
1692
|
+
throw new Error("XML: backend-specific options were removed; use native XML options");
|
|
1693
|
+
}
|
|
1694
|
+
if (options._parser && !["internal", "sax"].includes(options._parser)) {
|
|
1695
|
+
throw new Error("XML: unsupported parser backend; use the native documents parser");
|
|
1696
|
+
}
|
|
1697
|
+
const parsed = parseXMLInternal(text2, options);
|
|
1698
|
+
return options.uncapitalizeKeys ? uncapitalizeKeys(parsed) : parsed;
|
|
1683
1699
|
}
|
|
1684
|
-
var import_fast_xml_parser;
|
|
1685
1700
|
var init_parse_xml = __esm({
|
|
1686
|
-
"../
|
|
1701
|
+
"../documents/src/lib/parsers/parse-xml.ts"() {
|
|
1687
1702
|
"use strict";
|
|
1688
1703
|
init_uncapitalize();
|
|
1689
1704
|
init_parse_xml_internal();
|
|
1690
|
-
import_fast_xml_parser = require("fast-xml-parser");
|
|
1691
1705
|
}
|
|
1692
1706
|
});
|
|
1693
1707
|
|
|
1694
|
-
// ../
|
|
1695
|
-
var
|
|
1696
|
-
|
|
1708
|
+
// ../documents/src/xml-parser.ts
|
|
1709
|
+
var init_xml_parser = __esm({
|
|
1710
|
+
"../documents/src/xml-parser.ts"() {
|
|
1711
|
+
"use strict";
|
|
1712
|
+
init_parse_xml();
|
|
1713
|
+
}
|
|
1714
|
+
});
|
|
1715
|
+
|
|
1716
|
+
// ../documents/src/xml-format.ts
|
|
1717
|
+
var XMLFormat;
|
|
1718
|
+
var init_xml_format = __esm({
|
|
1719
|
+
"../documents/src/xml-format.ts"() {
|
|
1720
|
+
"use strict";
|
|
1721
|
+
XMLFormat = {
|
|
1722
|
+
name: "XML",
|
|
1723
|
+
id: "xml",
|
|
1724
|
+
module: "documents",
|
|
1725
|
+
encoding: "xml",
|
|
1726
|
+
format: "xml",
|
|
1727
|
+
extensions: ["xml"],
|
|
1728
|
+
mimeTypes: ["application/xml", "text/xml"],
|
|
1729
|
+
category: "table",
|
|
1730
|
+
text: true
|
|
1731
|
+
};
|
|
1732
|
+
}
|
|
1733
|
+
});
|
|
1734
|
+
|
|
1735
|
+
// ../documents/src/xml-loader.ts
|
|
1736
|
+
var xml_loader_exports = {};
|
|
1737
|
+
__export(xml_loader_exports, {
|
|
1697
1738
|
XMLLoaderWithParser: () => XMLLoaderWithParser
|
|
1698
1739
|
});
|
|
1699
1740
|
var _XMLLoaderPreload, XMLLoaderMetadataWithoutPreload, XMLLoaderWithParser;
|
|
1700
|
-
var
|
|
1701
|
-
"../
|
|
1741
|
+
var init_xml_loader = __esm({
|
|
1742
|
+
"../documents/src/xml-loader.ts"() {
|
|
1702
1743
|
"use strict";
|
|
1703
1744
|
init_parse_xml();
|
|
1704
|
-
|
|
1745
|
+
init_xml_loader_types();
|
|
1705
1746
|
({ preload: _XMLLoaderPreload, ...XMLLoaderMetadataWithoutPreload } = XMLLoader);
|
|
1706
1747
|
XMLLoaderWithParser = {
|
|
1707
1748
|
...XMLLoaderMetadataWithoutPreload,
|
|
@@ -1714,17 +1755,17 @@ var init_xml_loader_with_parser = __esm({
|
|
|
1714
1755
|
}
|
|
1715
1756
|
});
|
|
1716
1757
|
|
|
1717
|
-
// ../
|
|
1758
|
+
// ../documents/src/xml-loader-types.ts
|
|
1718
1759
|
async function preload() {
|
|
1719
|
-
const { XMLLoaderWithParser: XMLLoaderWithParser2 } = await Promise.resolve().then(() => (
|
|
1760
|
+
const { XMLLoaderWithParser: XMLLoaderWithParser2 } = await Promise.resolve().then(() => (init_xml_loader(), xml_loader_exports));
|
|
1720
1761
|
return XMLLoaderWithParser2;
|
|
1721
1762
|
}
|
|
1722
1763
|
function testXMLFile(text2) {
|
|
1723
1764
|
return text2.startsWith("<?xml");
|
|
1724
1765
|
}
|
|
1725
1766
|
var VERSION, XMLLoader;
|
|
1726
|
-
var
|
|
1727
|
-
"../
|
|
1767
|
+
var init_xml_loader_types = __esm({
|
|
1768
|
+
"../documents/src/xml-loader-types.ts"() {
|
|
1728
1769
|
"use strict";
|
|
1729
1770
|
init_xml_format();
|
|
1730
1771
|
VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
@@ -1737,7 +1778,7 @@ var init_xml_loader = __esm({
|
|
|
1737
1778
|
testText: testXMLFile,
|
|
1738
1779
|
options: {
|
|
1739
1780
|
xml: {
|
|
1740
|
-
|
|
1781
|
+
strict: true,
|
|
1741
1782
|
uncapitalizeKeys: false,
|
|
1742
1783
|
removeNSPrefix: false,
|
|
1743
1784
|
textNodeName: "value",
|
|
@@ -1749,34 +1790,11 @@ var init_xml_loader = __esm({
|
|
|
1749
1790
|
}
|
|
1750
1791
|
});
|
|
1751
1792
|
|
|
1752
|
-
// ../
|
|
1753
|
-
function convertXMLValueToArray(xmlValue) {
|
|
1754
|
-
if (Array.isArray(xmlValue)) {
|
|
1755
|
-
return xmlValue;
|
|
1756
|
-
}
|
|
1757
|
-
if (xmlValue && typeof xmlValue === "object" && xmlValue["0"]) {
|
|
1758
|
-
}
|
|
1759
|
-
if (xmlValue) {
|
|
1760
|
-
return [xmlValue];
|
|
1761
|
-
}
|
|
1762
|
-
return [];
|
|
1763
|
-
}
|
|
1764
|
-
function convertXMLFieldToArrayInPlace(xml3, key) {
|
|
1765
|
-
xml3[key] = convertXMLValueToArray(xml3[key]);
|
|
1766
|
-
}
|
|
1767
|
-
var init_xml_utils = __esm({
|
|
1768
|
-
"../xml/src/lib/xml-utils/xml-utils.ts"() {
|
|
1769
|
-
"use strict";
|
|
1770
|
-
}
|
|
1771
|
-
});
|
|
1772
|
-
|
|
1773
|
-
// ../xml/src/index.ts
|
|
1793
|
+
// ../documents/src/index.ts
|
|
1774
1794
|
var init_src = __esm({
|
|
1775
|
-
"../
|
|
1795
|
+
"../documents/src/index.ts"() {
|
|
1776
1796
|
"use strict";
|
|
1777
|
-
|
|
1778
|
-
init_xml_utils();
|
|
1779
|
-
init_parse_xml();
|
|
1797
|
+
init_xml_loader_types();
|
|
1780
1798
|
}
|
|
1781
1799
|
});
|
|
1782
1800
|
|
|
@@ -1787,6 +1805,7 @@ function parseXMLTextSync(text2, options) {
|
|
|
1787
1805
|
var init_parse_xml_text = __esm({
|
|
1788
1806
|
"dist/wms/lib/parsers/xml/parse-xml-text.js"() {
|
|
1789
1807
|
"use strict";
|
|
1808
|
+
init_xml_parser();
|
|
1790
1809
|
init_src();
|
|
1791
1810
|
}
|
|
1792
1811
|
});
|
|
@@ -1846,7 +1865,7 @@ var init_csw_capabilities_loader = __esm({
|
|
|
1846
1865
|
"dist/wms/csw-capabilities-loader.js"() {
|
|
1847
1866
|
"use strict";
|
|
1848
1867
|
init_wms_format();
|
|
1849
|
-
VERSION2 = true ? "5.0.0-beta.
|
|
1868
|
+
VERSION2 = true ? "5.0.0-beta.4" : "latest";
|
|
1850
1869
|
CSWCapabilitiesLoader = {
|
|
1851
1870
|
...CSWCapabilitiesFormat,
|
|
1852
1871
|
dataType: null,
|
|
@@ -1934,7 +1953,7 @@ var init_csw_domain_loader = __esm({
|
|
|
1934
1953
|
"dist/wms/csw-domain-loader.js"() {
|
|
1935
1954
|
"use strict";
|
|
1936
1955
|
init_wms_format();
|
|
1937
|
-
VERSION3 = true ? "5.0.0-beta.
|
|
1956
|
+
VERSION3 = true ? "5.0.0-beta.4" : "latest";
|
|
1938
1957
|
CSWDomainLoader = {
|
|
1939
1958
|
...CSWDomainFormat,
|
|
1940
1959
|
dataType: null,
|
|
@@ -1958,9 +1977,37 @@ var init_csw_domain_loader = __esm({
|
|
|
1958
1977
|
}
|
|
1959
1978
|
});
|
|
1960
1979
|
|
|
1980
|
+
// ../documents/src/lib/xml-utils/xml-utils.ts
|
|
1981
|
+
function convertXMLValueToArray(xmlValue) {
|
|
1982
|
+
if (Array.isArray(xmlValue)) {
|
|
1983
|
+
return xmlValue;
|
|
1984
|
+
}
|
|
1985
|
+
if (xmlValue && typeof xmlValue === "object" && xmlValue["0"]) {
|
|
1986
|
+
}
|
|
1987
|
+
if (xmlValue) {
|
|
1988
|
+
return [xmlValue];
|
|
1989
|
+
}
|
|
1990
|
+
return [];
|
|
1991
|
+
}
|
|
1992
|
+
function convertXMLFieldToArrayInPlace(xml3, key) {
|
|
1993
|
+
xml3[key] = convertXMLValueToArray(xml3[key]);
|
|
1994
|
+
}
|
|
1995
|
+
var init_xml_utils = __esm({
|
|
1996
|
+
"../documents/src/lib/xml-utils/xml-utils.ts"() {
|
|
1997
|
+
"use strict";
|
|
1998
|
+
}
|
|
1999
|
+
});
|
|
2000
|
+
|
|
2001
|
+
// ../documents/src/xml-utils.ts
|
|
2002
|
+
var init_xml_utils2 = __esm({
|
|
2003
|
+
"../documents/src/xml-utils.ts"() {
|
|
2004
|
+
"use strict";
|
|
2005
|
+
init_xml_utils();
|
|
2006
|
+
}
|
|
2007
|
+
});
|
|
2008
|
+
|
|
1961
2009
|
// dist/wms/lib/parsers/csw/parse-csw-records.js
|
|
1962
2010
|
function parseCSWRecords(text2, options) {
|
|
1963
|
-
var _a;
|
|
1964
2011
|
const parsedXML = parseXMLTextSync(text2, {
|
|
1965
2012
|
...options,
|
|
1966
2013
|
xml: {
|
|
@@ -1968,10 +2015,7 @@ function parseCSWRecords(text2, options) {
|
|
|
1968
2015
|
removeNSPrefix: true,
|
|
1969
2016
|
uncapitalizeKeys: true,
|
|
1970
2017
|
arrayPaths: [],
|
|
1971
|
-
|
|
1972
|
-
...(_a = options == null ? void 0 : options.xml) == null ? void 0 : _a._fastXML,
|
|
1973
|
-
parseAttributeValue: true
|
|
1974
|
-
}
|
|
2018
|
+
parseAttributeValue: true
|
|
1975
2019
|
}
|
|
1976
2020
|
});
|
|
1977
2021
|
parseExceptionReport(parsedXML);
|
|
@@ -2001,7 +2045,7 @@ function parseCSWRecords(text2, options) {
|
|
|
2001
2045
|
var init_parse_csw_records = __esm({
|
|
2002
2046
|
"dist/wms/lib/parsers/csw/parse-csw-records.js"() {
|
|
2003
2047
|
"use strict";
|
|
2004
|
-
|
|
2048
|
+
init_xml_utils2();
|
|
2005
2049
|
init_parse_exception_report();
|
|
2006
2050
|
init_parse_xml_text();
|
|
2007
2051
|
}
|
|
@@ -2040,7 +2084,7 @@ var init_csw_records_loader = __esm({
|
|
|
2040
2084
|
"dist/wms/csw-records-loader.js"() {
|
|
2041
2085
|
"use strict";
|
|
2042
2086
|
init_wms_format();
|
|
2043
|
-
VERSION4 = true ? "5.0.0-beta.
|
|
2087
|
+
VERSION4 = true ? "5.0.0-beta.4" : "latest";
|
|
2044
2088
|
CSWRecordsLoader = {
|
|
2045
2089
|
...CSWRecordsFormat,
|
|
2046
2090
|
dataType: null,
|
|
@@ -2067,7 +2111,9 @@ var init_csw_records_loader = __esm({
|
|
|
2067
2111
|
// dist/wms/lib/parsers/wms/parse-wms-error.js
|
|
2068
2112
|
function parseWMSError(text2, options) {
|
|
2069
2113
|
var _a, _b;
|
|
2070
|
-
const
|
|
2114
|
+
const trimmed = text2.trim();
|
|
2115
|
+
const xml3 = trimmed.startsWith('"<') && trimmed.endsWith('>"') ? trimmed.slice(1, -1) : text2;
|
|
2116
|
+
const parsedXML = parseXMLTextSync(xml3, options);
|
|
2071
2117
|
const serviceExceptionXML = ((_a = parsedXML == null ? void 0 : parsedXML.ServiceExceptionReport) == null ? void 0 : _a.ServiceException) || ((_b = parsedXML == null ? void 0 : parsedXML["ogc:ServiceExceptionReport"]) == null ? void 0 : _b["ogc:ServiceException"]);
|
|
2072
2118
|
const message = typeof serviceExceptionXML === "string" ? serviceExceptionXML : serviceExceptionXML.value || serviceExceptionXML.code || "Unknown error";
|
|
2073
2119
|
return message;
|
|
@@ -2125,7 +2171,7 @@ var init_wms_error_loader = __esm({
|
|
|
2125
2171
|
"dist/wms/wms-error-loader.js"() {
|
|
2126
2172
|
"use strict";
|
|
2127
2173
|
init_wms_format();
|
|
2128
|
-
VERSION5 = true ? "5.0.0-beta.
|
|
2174
|
+
VERSION5 = true ? "5.0.0-beta.4" : "latest";
|
|
2129
2175
|
WMSErrorLoader = {
|
|
2130
2176
|
...WMSErrorFormat,
|
|
2131
2177
|
dataType: null,
|
|
@@ -2158,19 +2204,19 @@ function parseXMLTextSync2(text2, options) {
|
|
|
2158
2204
|
var init_parse_xml_text2 = __esm({
|
|
2159
2205
|
"src/wms/lib/parsers/xml/parse-xml-text.ts"() {
|
|
2160
2206
|
"use strict";
|
|
2207
|
+
init_xml_parser();
|
|
2161
2208
|
init_src();
|
|
2162
2209
|
}
|
|
2163
2210
|
});
|
|
2164
2211
|
|
|
2165
2212
|
// src/wms/lib/parsers/wmts/parse-wmts-capabilities.ts
|
|
2166
2213
|
function parseWMTSCapabilities(text2, options) {
|
|
2167
|
-
var _a;
|
|
2168
2214
|
const parsedXML = parseXMLTextSync2(text2, {
|
|
2169
2215
|
xml: {
|
|
2170
2216
|
...(options == null ? void 0 : options.xml) || {},
|
|
2171
2217
|
_parser: "internal",
|
|
2172
2218
|
textNodeName: "#text",
|
|
2173
|
-
|
|
2219
|
+
parseTagValue: false,
|
|
2174
2220
|
removeNSPrefix: true,
|
|
2175
2221
|
uncapitalizeKeys: true
|
|
2176
2222
|
}
|
|
@@ -2393,16 +2439,12 @@ var init_wmts_capabilities_loader = __esm({
|
|
|
2393
2439
|
extensions: ["xml"],
|
|
2394
2440
|
mimeTypes: ["application/vnd.ogc.wmts_xml", "application/xml", "text/xml"],
|
|
2395
2441
|
options: { wmts: {} },
|
|
2396
|
-
preload: async () => (await Promise.resolve().then(() => (
|
|
2442
|
+
preload: async () => (await Promise.resolve().then(() => (init_wmts_capabilities_loader_with_parser2(), wmts_capabilities_loader_with_parser_exports))).WMTSCapabilitiesLoaderWithParser
|
|
2397
2443
|
};
|
|
2398
2444
|
}
|
|
2399
2445
|
});
|
|
2400
2446
|
|
|
2401
2447
|
// src/wms/wmts-capabilities-loader-with-parser.ts
|
|
2402
|
-
var wmts_capabilities_loader_with_parser_exports = {};
|
|
2403
|
-
__export(wmts_capabilities_loader_with_parser_exports, {
|
|
2404
|
-
WMTSCapabilitiesLoaderWithParser: () => WMTSCapabilitiesLoaderWithParser
|
|
2405
|
-
});
|
|
2406
2448
|
var _preload, metadata, WMTSCapabilitiesLoaderWithParser;
|
|
2407
2449
|
var init_wmts_capabilities_loader_with_parser = __esm({
|
|
2408
2450
|
"src/wms/wmts-capabilities-loader-with-parser.ts"() {
|
|
@@ -2418,6 +2460,18 @@ var init_wmts_capabilities_loader_with_parser = __esm({
|
|
|
2418
2460
|
}
|
|
2419
2461
|
});
|
|
2420
2462
|
|
|
2463
|
+
// src/wmts-capabilities-loader-with-parser.ts
|
|
2464
|
+
var wmts_capabilities_loader_with_parser_exports = {};
|
|
2465
|
+
__export(wmts_capabilities_loader_with_parser_exports, {
|
|
2466
|
+
WMTSCapabilitiesLoaderWithParser: () => WMTSCapabilitiesLoaderWithParser
|
|
2467
|
+
});
|
|
2468
|
+
var init_wmts_capabilities_loader_with_parser2 = __esm({
|
|
2469
|
+
"src/wmts-capabilities-loader-with-parser.ts"() {
|
|
2470
|
+
"use strict";
|
|
2471
|
+
init_wmts_capabilities_loader_with_parser();
|
|
2472
|
+
}
|
|
2473
|
+
});
|
|
2474
|
+
|
|
2421
2475
|
// dist/wms/lib/parsers/xml/parse-xml-helpers.js
|
|
2422
2476
|
function getXMLArray(xmlValue) {
|
|
2423
2477
|
if (Array.isArray(xmlValue)) {
|
|
@@ -2715,7 +2769,7 @@ var init_wms_capabilities_loader = __esm({
|
|
|
2715
2769
|
"dist/wms/wms-capabilities-loader.js"() {
|
|
2716
2770
|
"use strict";
|
|
2717
2771
|
init_wms_format();
|
|
2718
|
-
VERSION6 = true ? "5.0.0-beta.
|
|
2772
|
+
VERSION6 = true ? "5.0.0-beta.4" : "latest";
|
|
2719
2773
|
WMSCapabilitiesLoader = {
|
|
2720
2774
|
...WMSCapabilitiesFormat,
|
|
2721
2775
|
dataType: null,
|
|
@@ -2824,7 +2878,7 @@ var init_wfs_capabilities_loader = __esm({
|
|
|
2824
2878
|
"dist/wms/wfs-capabilities-loader.js"() {
|
|
2825
2879
|
"use strict";
|
|
2826
2880
|
init_wms_format();
|
|
2827
|
-
VERSION7 = true ? "5.0.0-beta.
|
|
2881
|
+
VERSION7 = true ? "5.0.0-beta.4" : "latest";
|
|
2828
2882
|
WFSCapabilitiesLoader = {
|
|
2829
2883
|
...WFSCapabilitiesFormat,
|
|
2830
2884
|
dataType: null,
|
|
@@ -2848,3148 +2902,77 @@ var init_wfs_capabilities_loader = __esm({
|
|
|
2848
2902
|
}
|
|
2849
2903
|
});
|
|
2850
2904
|
|
|
2851
|
-
//
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2905
|
+
// dist/wms/unbundled.js
|
|
2906
|
+
var unbundled_exports = {};
|
|
2907
|
+
__export(unbundled_exports, {
|
|
2908
|
+
CSWCapabilitiesLoader: () => CSWCapabilitiesLoader,
|
|
2909
|
+
CSWDomainLoader: () => CSWDomainLoader,
|
|
2910
|
+
CSWRecordsLoader: () => CSWRecordsLoader,
|
|
2911
|
+
GMLLoader: () => GMLLoader,
|
|
2912
|
+
WMSCapabilitiesLoader: () => WMSCapabilitiesLoader,
|
|
2913
|
+
WMSErrorLoader: () => WMSErrorLoader,
|
|
2914
|
+
WMTSCapabilitiesLoader: () => WMTSCapabilitiesLoader2,
|
|
2915
|
+
_GMLLoader: () => GMLLoader,
|
|
2916
|
+
_WFSCapabilitiesLoader: () => WFSCapabilitiesLoader
|
|
2859
2917
|
});
|
|
2918
|
+
module.exports = __toCommonJS(unbundled_exports);
|
|
2919
|
+
init_csw_capabilities_loader();
|
|
2920
|
+
init_csw_domain_loader();
|
|
2921
|
+
init_csw_records_loader();
|
|
2922
|
+
init_wms_error_loader();
|
|
2860
2923
|
|
|
2861
|
-
//
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2924
|
+
// dist/wms/wmts-capabilities-loader.js
|
|
2925
|
+
init_wms_format();
|
|
2926
|
+
var WMTSCapabilitiesLoader2 = {
|
|
2927
|
+
...WMTSCapabilitiesFormat,
|
|
2928
|
+
dataType: null,
|
|
2929
|
+
batchType: null,
|
|
2930
|
+
name: "WMTS Capabilities",
|
|
2931
|
+
id: "wmts-capabilities",
|
|
2932
|
+
module: "ogc",
|
|
2933
|
+
version: "0.0.0",
|
|
2934
|
+
worker: false,
|
|
2935
|
+
encoding: "xml",
|
|
2936
|
+
format: "wmts-capabilities",
|
|
2937
|
+
text: true,
|
|
2938
|
+
extensions: ["xml"],
|
|
2939
|
+
mimeTypes: ["application/vnd.ogc.wmts_xml", "application/xml", "text/xml"],
|
|
2940
|
+
options: { wmts: {} },
|
|
2941
|
+
preload: async () => (await Promise.resolve().then(() => (init_wmts_capabilities_loader_with_parser2(), wmts_capabilities_loader_with_parser_exports))).WMTSCapabilitiesLoaderWithParser
|
|
2942
|
+
};
|
|
2868
2943
|
|
|
2869
|
-
//
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
function
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
metadata: serializeArrowMetadata(arrowSchema.metadata)
|
|
2880
|
-
};
|
|
2881
|
-
}
|
|
2882
|
-
function deserializeArrowSchema(schema, options) {
|
|
2883
|
-
return new arrow.Schema(
|
|
2884
|
-
schema.fields.map((field) => deserializeArrowField(field, options)),
|
|
2885
|
-
deserializeArrowMetadata(schema.metadata)
|
|
2886
|
-
);
|
|
2887
|
-
}
|
|
2888
|
-
function serializeArrowMetadata(arrowMetadata) {
|
|
2889
|
-
return Object.fromEntries(arrowMetadata);
|
|
2890
|
-
}
|
|
2891
|
-
function deserializeArrowMetadata(metadata2) {
|
|
2892
|
-
return metadata2 ? new Map(Object.entries(metadata2)) : /* @__PURE__ */ new Map();
|
|
2893
|
-
}
|
|
2894
|
-
function serializeArrowField(field) {
|
|
2895
|
-
return {
|
|
2896
|
-
name: field.name,
|
|
2897
|
-
type: serializeArrowType(field.type),
|
|
2898
|
-
nullable: field.nullable,
|
|
2899
|
-
metadata: serializeArrowMetadata(field.metadata)
|
|
2900
|
-
};
|
|
2901
|
-
}
|
|
2902
|
-
function deserializeArrowField(field, options) {
|
|
2903
|
-
return new arrow.Field(
|
|
2904
|
-
field.name,
|
|
2905
|
-
deserializeArrowType(field.type, options),
|
|
2906
|
-
field.nullable,
|
|
2907
|
-
deserializeArrowMetadata(field.metadata)
|
|
2908
|
-
);
|
|
2909
|
-
}
|
|
2910
|
-
function serializeArrowType(arrowType) {
|
|
2911
|
-
if (isArrowViewType(arrowType, "BinaryView")) {
|
|
2912
|
-
return "binary-view";
|
|
2913
|
-
}
|
|
2914
|
-
if (isArrowViewType(arrowType, "Utf8View")) {
|
|
2915
|
-
return "utf8-view";
|
|
2916
|
-
}
|
|
2917
|
-
if (isOptionalArrowType(arrowType, "LargeList")) {
|
|
2918
|
-
const largeListType = arrowType;
|
|
2919
|
-
return {
|
|
2920
|
-
type: "large-list",
|
|
2921
|
-
children: [serializeArrowField(largeListType.valueField)]
|
|
2922
|
-
};
|
|
2923
|
-
}
|
|
2924
|
-
switch (arrowType.constructor) {
|
|
2925
|
-
case arrow.Null:
|
|
2926
|
-
return "null";
|
|
2927
|
-
case arrow.Binary:
|
|
2928
|
-
return "binary";
|
|
2929
|
-
case arrow.FixedSizeBinary:
|
|
2930
|
-
return {
|
|
2931
|
-
type: "fixed-size-binary",
|
|
2932
|
-
byteWidth: arrowType.byteWidth
|
|
2933
|
-
};
|
|
2934
|
-
case arrow.Bool:
|
|
2935
|
-
return "bool";
|
|
2936
|
-
case arrow.Int:
|
|
2937
|
-
const intType = arrowType;
|
|
2938
|
-
return `${intType.isSigned ? "" : "u"}int${intType.bitWidth}`;
|
|
2939
|
-
case arrow.Int8:
|
|
2940
|
-
return "int8";
|
|
2941
|
-
case arrow.Int16:
|
|
2942
|
-
return "int16";
|
|
2943
|
-
case arrow.Int32:
|
|
2944
|
-
return "int32";
|
|
2945
|
-
case arrow.Int64:
|
|
2946
|
-
return "int64";
|
|
2947
|
-
case arrow.Uint8:
|
|
2948
|
-
return "uint8";
|
|
2949
|
-
case arrow.Uint16:
|
|
2950
|
-
return "uint16";
|
|
2951
|
-
case arrow.Uint32:
|
|
2952
|
-
return "uint32";
|
|
2953
|
-
case arrow.Uint64:
|
|
2954
|
-
return "uint64";
|
|
2955
|
-
case arrow.Float:
|
|
2956
|
-
const precision = arrowType.precision;
|
|
2957
|
-
switch (precision) {
|
|
2958
|
-
case arrow.Precision.HALF:
|
|
2959
|
-
return "float16";
|
|
2960
|
-
case arrow.Precision.SINGLE:
|
|
2961
|
-
return "float32";
|
|
2962
|
-
case arrow.Precision.DOUBLE:
|
|
2963
|
-
return "float64";
|
|
2964
|
-
default:
|
|
2965
|
-
return "float16";
|
|
2966
|
-
}
|
|
2967
|
-
case arrow.Float16:
|
|
2968
|
-
return "float16";
|
|
2969
|
-
case arrow.Float32:
|
|
2970
|
-
return "float32";
|
|
2971
|
-
case arrow.Float64:
|
|
2972
|
-
return "float64";
|
|
2973
|
-
case arrow.Utf8:
|
|
2974
|
-
return "utf8";
|
|
2975
|
-
case arrow.Decimal:
|
|
2976
|
-
const decimal = arrowType;
|
|
2977
|
-
return {
|
|
2978
|
-
type: "decimal",
|
|
2979
|
-
bitWidth: decimal.bitWidth,
|
|
2980
|
-
precision: decimal.precision,
|
|
2981
|
-
scale: decimal.scale
|
|
2982
|
-
};
|
|
2983
|
-
case arrow.Date_:
|
|
2984
|
-
const dateUnit = arrowType.unit;
|
|
2985
|
-
return dateUnit === arrow.DateUnit.DAY ? "date-day" : "date-millisecond";
|
|
2986
|
-
case arrow.DateDay:
|
|
2987
|
-
return "date-day";
|
|
2988
|
-
case arrow.DateMillisecond:
|
|
2989
|
-
return "date-millisecond";
|
|
2990
|
-
case arrow.Time:
|
|
2991
|
-
const timeUnit = arrowType.unit;
|
|
2992
|
-
switch (timeUnit) {
|
|
2993
|
-
case arrow.TimeUnit.SECOND:
|
|
2994
|
-
return "time-second";
|
|
2995
|
-
case arrow.TimeUnit.MILLISECOND:
|
|
2996
|
-
return "time-millisecond";
|
|
2997
|
-
case arrow.TimeUnit.MICROSECOND:
|
|
2998
|
-
return "time-microsecond";
|
|
2999
|
-
case arrow.TimeUnit.NANOSECOND:
|
|
3000
|
-
return "time-nanosecond";
|
|
3001
|
-
default:
|
|
3002
|
-
return "time-second";
|
|
3003
|
-
}
|
|
3004
|
-
case arrow.TimeMillisecond:
|
|
3005
|
-
return "time-millisecond";
|
|
3006
|
-
case arrow.TimeSecond:
|
|
3007
|
-
return "time-second";
|
|
3008
|
-
case arrow.TimeMicrosecond:
|
|
3009
|
-
return "time-microsecond";
|
|
3010
|
-
case arrow.TimeNanosecond:
|
|
3011
|
-
return "time-nanosecond";
|
|
3012
|
-
case arrow.Timestamp:
|
|
3013
|
-
const timeStampUnit = arrowType.unit;
|
|
3014
|
-
switch (timeStampUnit) {
|
|
3015
|
-
case arrow.TimeUnit.SECOND:
|
|
3016
|
-
return "timestamp-second";
|
|
3017
|
-
case arrow.TimeUnit.MILLISECOND:
|
|
3018
|
-
return "timestamp-millisecond";
|
|
3019
|
-
case arrow.TimeUnit.MICROSECOND:
|
|
3020
|
-
return "timestamp-microsecond";
|
|
3021
|
-
case arrow.TimeUnit.NANOSECOND:
|
|
3022
|
-
return "timestamp-nanosecond";
|
|
3023
|
-
default:
|
|
3024
|
-
return "timestamp-second";
|
|
3025
|
-
}
|
|
3026
|
-
case arrow.TimestampSecond:
|
|
3027
|
-
return "timestamp-second";
|
|
3028
|
-
case arrow.TimestampMillisecond:
|
|
3029
|
-
return "timestamp-millisecond";
|
|
3030
|
-
case arrow.TimestampMicrosecond:
|
|
3031
|
-
return "timestamp-microsecond";
|
|
3032
|
-
case arrow.TimestampNanosecond:
|
|
3033
|
-
return "timestamp-nanosecond";
|
|
3034
|
-
case arrow.Interval:
|
|
3035
|
-
const intervalUnit = arrowType.unit;
|
|
3036
|
-
switch (intervalUnit) {
|
|
3037
|
-
case arrow.IntervalUnit.DAY_TIME:
|
|
3038
|
-
return "interval-daytime";
|
|
3039
|
-
case arrow.IntervalUnit.YEAR_MONTH:
|
|
3040
|
-
return "interval-yearmonth";
|
|
3041
|
-
default:
|
|
3042
|
-
return "interval-daytime";
|
|
3043
|
-
}
|
|
3044
|
-
case arrow.IntervalDayTime:
|
|
3045
|
-
return "interval-daytime";
|
|
3046
|
-
case arrow.IntervalYearMonth:
|
|
3047
|
-
return "interval-yearmonth";
|
|
3048
|
-
case arrow.Map_:
|
|
3049
|
-
const mapType = arrowType;
|
|
3050
|
-
return {
|
|
3051
|
-
type: "map",
|
|
3052
|
-
keysSorted: mapType.keysSorted,
|
|
3053
|
-
children: mapType.children.map((arrowField) => serializeArrowField(arrowField))
|
|
3054
|
-
};
|
|
3055
|
-
case arrow.List:
|
|
3056
|
-
const listType = arrowType;
|
|
3057
|
-
const listField = listType.valueField;
|
|
3058
|
-
return {
|
|
3059
|
-
type: "list",
|
|
3060
|
-
children: [serializeArrowField(listField)]
|
|
3061
|
-
};
|
|
3062
|
-
case arrow.FixedSizeList:
|
|
3063
|
-
const fixedSizeList = arrowType;
|
|
3064
|
-
return {
|
|
3065
|
-
type: "fixed-size-list",
|
|
3066
|
-
listSize: fixedSizeList.listSize,
|
|
3067
|
-
children: [serializeArrowField(fixedSizeList.children[0])]
|
|
3068
|
-
};
|
|
3069
|
-
case arrow.Struct:
|
|
3070
|
-
const structType = arrowType;
|
|
3071
|
-
return {
|
|
3072
|
-
type: "struct",
|
|
3073
|
-
children: structType.children.map((arrowField) => serializeArrowField(arrowField))
|
|
3074
|
-
};
|
|
3075
|
-
case arrow.SparseUnion:
|
|
3076
|
-
case arrow.DenseUnion:
|
|
3077
|
-
const unionType = arrowType;
|
|
3078
|
-
return {
|
|
3079
|
-
type: unionType instanceof arrow.DenseUnion ? "dense-union" : "sparse-union",
|
|
3080
|
-
typeIds: unionType.typeIds,
|
|
3081
|
-
children: unionType.children.map((arrowField) => serializeArrowField(arrowField)),
|
|
3082
|
-
typeIdToChildIndex: { ...unionType.typeIdToChildIndex }
|
|
3083
|
-
};
|
|
3084
|
-
case arrow.Dictionary:
|
|
3085
|
-
const dictionaryType = arrowType;
|
|
3086
|
-
return {
|
|
3087
|
-
type: "dictionary",
|
|
3088
|
-
id: dictionaryType.id,
|
|
3089
|
-
indices: serializeArrowDictionaryKeyType(dictionaryType.indices),
|
|
3090
|
-
dictionary: serializeArrowType(dictionaryType.dictionary),
|
|
3091
|
-
isOrdered: dictionaryType.isOrdered
|
|
3092
|
-
};
|
|
3093
|
-
default:
|
|
3094
|
-
throw new Error(`arrow type not supported: ${arrowType.constructor.name}`);
|
|
3095
|
-
}
|
|
3096
|
-
}
|
|
3097
|
-
function deserializeArrowType(dataType, options) {
|
|
3098
|
-
if (typeof dataType === "object") {
|
|
3099
|
-
switch (dataType.type) {
|
|
3100
|
-
case "decimal":
|
|
3101
|
-
return new arrow.Decimal(dataType.scale, dataType.precision, dataType.bitWidth);
|
|
3102
|
-
case "map": {
|
|
3103
|
-
const children = dataType.children.map(
|
|
3104
|
-
(arrowField) => deserializeArrowField(arrowField, options)
|
|
3105
|
-
);
|
|
3106
|
-
return new arrow.Map_(children[0], dataType.keysSorted);
|
|
3107
|
-
}
|
|
3108
|
-
case "list": {
|
|
3109
|
-
const field = deserializeArrowField(dataType.children[0], options);
|
|
3110
|
-
return new arrow.List(field);
|
|
3111
|
-
}
|
|
3112
|
-
case "large-list": {
|
|
3113
|
-
const field = deserializeArrowField(dataType.children[0], options);
|
|
3114
|
-
const LargeList = getOptionalArrowConstructor("LargeList");
|
|
3115
|
-
if (!LargeList) {
|
|
3116
|
-
throw new Error(
|
|
3117
|
-
"LargeList requires an Apache Arrow runtime that exports the LargeList constructor"
|
|
3118
|
-
);
|
|
3119
|
-
}
|
|
3120
|
-
return new LargeList(field);
|
|
3121
|
-
}
|
|
3122
|
-
case "fixed-size-list": {
|
|
3123
|
-
const child = deserializeArrowField(dataType.children[0], options);
|
|
3124
|
-
return new arrow.FixedSizeList(dataType.listSize, child);
|
|
3125
|
-
}
|
|
3126
|
-
case "fixed-size-binary":
|
|
3127
|
-
return new arrow.FixedSizeBinary(dataType.byteWidth);
|
|
3128
|
-
case "struct": {
|
|
3129
|
-
const children = dataType.children.map(
|
|
3130
|
-
(arrowField) => deserializeArrowField(arrowField, options)
|
|
3131
|
-
);
|
|
3132
|
-
return new arrow.Struct(children);
|
|
3133
|
-
}
|
|
3134
|
-
case "sparse-union":
|
|
3135
|
-
case "dense-union": {
|
|
3136
|
-
const children = dataType.children.map(
|
|
3137
|
-
(arrowField) => deserializeArrowField(arrowField, options)
|
|
3138
|
-
);
|
|
3139
|
-
return dataType.type === "dense-union" ? new arrow.DenseUnion(dataType.typeIds, children) : new arrow.SparseUnion(dataType.typeIds, children);
|
|
3140
|
-
}
|
|
3141
|
-
case "dictionary": {
|
|
3142
|
-
return new arrow.Dictionary(
|
|
3143
|
-
deserializeArrowType(dataType.dictionary, options),
|
|
3144
|
-
deserializeArrowDictionaryKeyType(dataType.indices),
|
|
3145
|
-
dataType.id,
|
|
3146
|
-
dataType.isOrdered
|
|
3147
|
-
);
|
|
3148
|
-
}
|
|
3149
|
-
default:
|
|
3150
|
-
throw new Error("array type not supported");
|
|
3151
|
-
}
|
|
3152
|
-
}
|
|
3153
|
-
switch (dataType) {
|
|
3154
|
-
case "null":
|
|
3155
|
-
return new arrow.Null();
|
|
3156
|
-
case "binary":
|
|
3157
|
-
return makeVariableWidthArrowType("BinaryView", new arrow.Binary(), options);
|
|
3158
|
-
case "binary-view":
|
|
3159
|
-
return makeRequiredArrowViewType("BinaryView");
|
|
3160
|
-
case "bool":
|
|
3161
|
-
return new arrow.Bool();
|
|
3162
|
-
case "int8":
|
|
3163
|
-
return new arrow.Int8();
|
|
3164
|
-
case "int16":
|
|
3165
|
-
return new arrow.Int16();
|
|
3166
|
-
case "int32":
|
|
3167
|
-
return new arrow.Int32();
|
|
3168
|
-
case "int64":
|
|
3169
|
-
return new arrow.Int64();
|
|
3170
|
-
case "uint8":
|
|
3171
|
-
return new arrow.Uint8();
|
|
3172
|
-
case "uint16":
|
|
3173
|
-
return new arrow.Uint16();
|
|
3174
|
-
case "uint32":
|
|
3175
|
-
return new arrow.Uint32();
|
|
3176
|
-
case "uint64":
|
|
3177
|
-
return new arrow.Uint64();
|
|
3178
|
-
case "float16":
|
|
3179
|
-
return new arrow.Float16();
|
|
3180
|
-
case "float32":
|
|
3181
|
-
return new arrow.Float32();
|
|
3182
|
-
case "float64":
|
|
3183
|
-
return new arrow.Float64();
|
|
3184
|
-
case "utf8":
|
|
3185
|
-
return makeVariableWidthArrowType("Utf8View", new arrow.Utf8(), options);
|
|
3186
|
-
case "utf8-view":
|
|
3187
|
-
return makeRequiredArrowViewType("Utf8View");
|
|
3188
|
-
case "date-day":
|
|
3189
|
-
return new arrow.DateDay();
|
|
3190
|
-
case "date-millisecond":
|
|
3191
|
-
return new arrow.DateMillisecond();
|
|
3192
|
-
case "time-second":
|
|
3193
|
-
return new arrow.TimeSecond();
|
|
3194
|
-
case "time-millisecond":
|
|
3195
|
-
return new arrow.TimeMillisecond();
|
|
3196
|
-
case "time-microsecond":
|
|
3197
|
-
return new arrow.TimeMicrosecond();
|
|
3198
|
-
case "time-nanosecond":
|
|
3199
|
-
return new arrow.TimeNanosecond();
|
|
3200
|
-
case "timestamp-second":
|
|
3201
|
-
return new arrow.TimestampSecond();
|
|
3202
|
-
case "timestamp-millisecond":
|
|
3203
|
-
return new arrow.TimestampMillisecond();
|
|
3204
|
-
case "timestamp-microsecond":
|
|
3205
|
-
return new arrow.TimestampMicrosecond();
|
|
3206
|
-
case "timestamp-nanosecond":
|
|
3207
|
-
return new arrow.TimestampNanosecond();
|
|
3208
|
-
case "interval-daytime":
|
|
3209
|
-
return new arrow.IntervalDayTime();
|
|
3210
|
-
case "interval-yearmonth":
|
|
3211
|
-
return new arrow.IntervalYearMonth();
|
|
3212
|
-
default:
|
|
3213
|
-
throw new Error("array type not supported");
|
|
3214
|
-
}
|
|
3215
|
-
}
|
|
3216
|
-
function getOptionalArrowConstructor(typeName) {
|
|
3217
|
-
return arrow[typeName];
|
|
3218
|
-
}
|
|
3219
|
-
function isArrowViewType(arrowType, viewTypeName) {
|
|
3220
|
-
const constructor = getOptionalArrowConstructor(viewTypeName);
|
|
3221
|
-
if (constructor && arrowType instanceof constructor) {
|
|
3222
|
-
return true;
|
|
3223
|
-
}
|
|
3224
|
-
const guards = arrow.DataType;
|
|
3225
|
-
const guard = viewTypeName === "BinaryView" ? guards.isBinaryView : guards.isUtf8View;
|
|
3226
|
-
return Boolean(guard == null ? void 0 : guard(arrowType));
|
|
3227
|
-
}
|
|
3228
|
-
function isOptionalArrowType(arrowType, typeName) {
|
|
3229
|
-
const constructor = getOptionalArrowConstructor(typeName);
|
|
3230
|
-
return Boolean(constructor && arrowType instanceof constructor);
|
|
3231
|
-
}
|
|
3232
|
-
function makeVariableWidthArrowType(viewTypeName, fallbackType, options) {
|
|
3233
|
-
const viewTypeMode = (options == null ? void 0 : options.viewTypes) || "never";
|
|
3234
|
-
if (viewTypeMode === "never") {
|
|
3235
|
-
return fallbackType;
|
|
3236
|
-
}
|
|
3237
|
-
const constructor = getOptionalArrowConstructor(viewTypeName);
|
|
3238
|
-
if (constructor) {
|
|
3239
|
-
return new constructor();
|
|
3240
|
-
}
|
|
3241
|
-
if (viewTypeMode === "require") {
|
|
3242
|
-
throw new Error(
|
|
3243
|
-
`${viewTypeName} requires apache-arrow 21.2.0 or later; the installed runtime does not support it`
|
|
3244
|
-
);
|
|
3245
|
-
}
|
|
3246
|
-
return fallbackType;
|
|
3247
|
-
}
|
|
3248
|
-
function makeRequiredArrowViewType(viewTypeName) {
|
|
3249
|
-
const constructor = getOptionalArrowConstructor(viewTypeName);
|
|
3250
|
-
if (!constructor) {
|
|
3251
|
-
throw new Error(
|
|
3252
|
-
`${viewTypeName} requires apache-arrow 21.2.0 or later; the installed runtime does not support it`
|
|
3253
|
-
);
|
|
3254
|
-
}
|
|
3255
|
-
return new constructor();
|
|
3256
|
-
}
|
|
3257
|
-
function serializeArrowDictionaryKeyType(arrowType) {
|
|
3258
|
-
if (arrowType instanceof arrow.Int) {
|
|
3259
|
-
const prefix = arrowType.isSigned ? "int" : "uint";
|
|
3260
|
-
const keyType = `${prefix}${arrowType.bitWidth}`;
|
|
3261
|
-
if (isSchemaDictionaryKeyType(keyType)) {
|
|
3262
|
-
return keyType;
|
|
3263
|
-
}
|
|
3264
|
-
}
|
|
3265
|
-
switch (arrowType.constructor) {
|
|
3266
|
-
case arrow.Int8:
|
|
3267
|
-
return "int8";
|
|
3268
|
-
case arrow.Int16:
|
|
3269
|
-
return "int16";
|
|
3270
|
-
case arrow.Int32:
|
|
3271
|
-
return "int32";
|
|
3272
|
-
case arrow.Uint8:
|
|
3273
|
-
return "uint8";
|
|
3274
|
-
case arrow.Uint16:
|
|
3275
|
-
return "uint16";
|
|
3276
|
-
case arrow.Uint32:
|
|
3277
|
-
return "uint32";
|
|
3278
|
-
default:
|
|
3279
|
-
throw new Error(`arrow dictionary index type not supported: ${arrowType.constructor.name}`);
|
|
3280
|
-
}
|
|
3281
|
-
}
|
|
3282
|
-
function isSchemaDictionaryKeyType(keyType) {
|
|
3283
|
-
return ["int8", "int16", "int32", "uint8", "uint16", "uint32"].includes(keyType);
|
|
2944
|
+
// dist/wms/unbundled.js
|
|
2945
|
+
init_wms_capabilities_loader();
|
|
2946
|
+
init_wfs_capabilities_loader();
|
|
2947
|
+
|
|
2948
|
+
// dist/wms/gml-loader-types.js
|
|
2949
|
+
init_wms_format();
|
|
2950
|
+
var VERSION8 = true ? "5.0.0-beta.4" : "latest";
|
|
2951
|
+
async function preload8() {
|
|
2952
|
+
const { GMLLoaderWithParser } = await import("@loaders.gl/ogc/gml-loader");
|
|
2953
|
+
return GMLLoaderWithParser;
|
|
3284
2954
|
}
|
|
3285
|
-
|
|
3286
|
-
switch (keyType) {
|
|
3287
|
-
case "int8":
|
|
3288
|
-
return new arrow.Int8();
|
|
3289
|
-
case "int16":
|
|
3290
|
-
return new arrow.Int16();
|
|
3291
|
-
case "int32":
|
|
3292
|
-
return new arrow.Int32();
|
|
3293
|
-
case "uint8":
|
|
3294
|
-
return new arrow.Uint8();
|
|
3295
|
-
case "uint16":
|
|
3296
|
-
return new arrow.Uint16();
|
|
3297
|
-
case "uint32":
|
|
3298
|
-
return new arrow.Uint32();
|
|
3299
|
-
default:
|
|
3300
|
-
throw new Error(`schema dictionary index type not supported: ${keyType}`);
|
|
3301
|
-
}
|
|
3302
|
-
}
|
|
3303
|
-
var arrow;
|
|
3304
|
-
var init_convert_arrow_schema = __esm({
|
|
3305
|
-
"../core/src/schema-utils/lib/schema/convert-arrow-schema.ts"() {
|
|
3306
|
-
"use strict";
|
|
3307
|
-
arrow = __toESM(require("apache-arrow"), 1);
|
|
3308
|
-
}
|
|
3309
|
-
});
|
|
3310
|
-
|
|
3311
|
-
// ../core/src/schema/metadata.ts
|
|
3312
|
-
function getMetadataValue(metadata2, key) {
|
|
3313
|
-
return metadata2 instanceof Map ? metadata2.get(key) || null : metadata2[key] || null;
|
|
3314
|
-
}
|
|
3315
|
-
function setMetadataValue(metadata2, key, value) {
|
|
3316
|
-
if (metadata2 instanceof Map) {
|
|
3317
|
-
metadata2.set(key, value);
|
|
3318
|
-
} else {
|
|
3319
|
-
metadata2[key] = value;
|
|
3320
|
-
}
|
|
3321
|
-
}
|
|
3322
|
-
function getGeoMetadata(metadata2) {
|
|
3323
|
-
if (!metadata2) {
|
|
3324
|
-
return null;
|
|
3325
|
-
}
|
|
3326
|
-
const stringifiedGeoMetadata = getMetadataValue(metadata2, "geo");
|
|
3327
|
-
const geoMetadata = stringifiedGeoMetadata && parseJSONStringMetadata(stringifiedGeoMetadata);
|
|
3328
|
-
if (!geoMetadata) {
|
|
3329
|
-
return null;
|
|
3330
|
-
}
|
|
3331
|
-
for (const column of Object.values(geoMetadata.columns || {})) {
|
|
3332
|
-
if (column && typeof column === "object" && typeof column.encoding === "string") {
|
|
3333
|
-
column.encoding = column.encoding.toLowerCase();
|
|
3334
|
-
}
|
|
3335
|
-
}
|
|
3336
|
-
return geoMetadata;
|
|
3337
|
-
}
|
|
3338
|
-
function setGeoMetadata(metadata2, geoMetadata) {
|
|
3339
|
-
setMetadataValue(metadata2, "geo", JSON.stringify(geoMetadata));
|
|
3340
|
-
}
|
|
3341
|
-
function parseJSONStringMetadata(stringifiedMetadata) {
|
|
3342
|
-
if (!stringifiedMetadata) {
|
|
3343
|
-
return null;
|
|
3344
|
-
}
|
|
3345
|
-
try {
|
|
3346
|
-
const metadata2 = JSON.parse(stringifiedMetadata);
|
|
3347
|
-
return metadata2 && typeof metadata2 === "object" ? metadata2 : null;
|
|
3348
|
-
} catch {
|
|
3349
|
-
return null;
|
|
3350
|
-
}
|
|
3351
|
-
}
|
|
3352
|
-
var init_metadata = __esm({
|
|
3353
|
-
"../core/src/schema/metadata.ts"() {
|
|
3354
|
-
"use strict";
|
|
3355
|
-
}
|
|
3356
|
-
});
|
|
3357
|
-
|
|
3358
|
-
// ../core/src/schema/index.ts
|
|
3359
|
-
var init_schema = __esm({
|
|
3360
|
-
"../core/src/schema/index.ts"() {
|
|
3361
|
-
"use strict";
|
|
3362
|
-
init_metadata();
|
|
3363
|
-
}
|
|
3364
|
-
});
|
|
3365
|
-
|
|
3366
|
-
// ../core/src/schema-utils/lib/table/batch-builder/arrow-table-builder.ts
|
|
3367
|
-
var arrow2, ArrowTableBuilder;
|
|
3368
|
-
var init_arrow_table_builder = __esm({
|
|
3369
|
-
"../core/src/schema-utils/lib/table/batch-builder/arrow-table-builder.ts"() {
|
|
3370
|
-
"use strict";
|
|
3371
|
-
arrow2 = __toESM(require("apache-arrow"), 1);
|
|
3372
|
-
init_convert_arrow_schema();
|
|
3373
|
-
ArrowTableBuilder = class {
|
|
3374
|
-
schema;
|
|
3375
|
-
arrowSchema;
|
|
3376
|
-
arrowBuilders;
|
|
3377
|
-
length;
|
|
3378
|
-
constructor(schema, options) {
|
|
3379
|
-
this.arrowSchema = convertSchemaToArrow(schema, options);
|
|
3380
|
-
this.schema = (options == null ? void 0 : options.viewTypes) && options.viewTypes !== "never" ? convertArrowToSchema(this.arrowSchema) : schema;
|
|
3381
|
-
this.arrowBuilders = this.arrowSchema.fields.map(
|
|
3382
|
-
(field) => arrow2.makeBuilder({ type: field.type, nullValues: [null] })
|
|
3383
|
-
);
|
|
3384
|
-
this.length = 0;
|
|
3385
|
-
}
|
|
3386
|
-
addObjectRow(row) {
|
|
3387
|
-
for (let i = 0; i < this.arrowBuilders.length; i++) {
|
|
3388
|
-
const columnName = this.schema.fields[i].name;
|
|
3389
|
-
const value = row[columnName];
|
|
3390
|
-
this.arrowBuilders[i].append(value);
|
|
3391
|
-
}
|
|
3392
|
-
this.length++;
|
|
3393
|
-
}
|
|
3394
|
-
addArrayRow(row) {
|
|
3395
|
-
for (let i = 0; i < this.arrowBuilders.length; i++) {
|
|
3396
|
-
this.arrowBuilders[i].append(row[i]);
|
|
3397
|
-
}
|
|
3398
|
-
this.length++;
|
|
3399
|
-
}
|
|
3400
|
-
/** Makes sure that a first batch with schema is sent even if no rows */
|
|
3401
|
-
firstBatch() {
|
|
3402
|
-
const arrowRecordBatch = this._getArrowRecordBatch();
|
|
3403
|
-
if (arrowRecordBatch.numCols !== 0) {
|
|
3404
|
-
return null;
|
|
3405
|
-
}
|
|
3406
|
-
return {
|
|
3407
|
-
shape: "arrow-table",
|
|
3408
|
-
batchType: "data",
|
|
3409
|
-
length: arrowRecordBatch.numRows,
|
|
3410
|
-
schema: this.schema,
|
|
3411
|
-
data: new arrow2.Table(arrowRecordBatch)
|
|
3412
|
-
};
|
|
3413
|
-
}
|
|
3414
|
-
/** Flush the current batch if conditions are right */
|
|
3415
|
-
flushBatch() {
|
|
3416
|
-
const arrowRecordBatch = this._getArrowRecordBatch();
|
|
3417
|
-
if (arrowRecordBatch.numCols === 0) {
|
|
3418
|
-
return null;
|
|
3419
|
-
}
|
|
3420
|
-
return {
|
|
3421
|
-
shape: "arrow-table",
|
|
3422
|
-
batchType: "data",
|
|
3423
|
-
length: arrowRecordBatch.numRows,
|
|
3424
|
-
schema: this.schema,
|
|
3425
|
-
data: new arrow2.Table(arrowRecordBatch)
|
|
3426
|
-
};
|
|
3427
|
-
}
|
|
3428
|
-
/** Get a last batch if any data is left */
|
|
3429
|
-
finishBatch() {
|
|
3430
|
-
const arrowRecordBatch = this._getArrowRecordBatch();
|
|
3431
|
-
this.arrowBuilders.forEach((builder) => builder.finish());
|
|
3432
|
-
if (arrowRecordBatch.numCols === 0 && arrowRecordBatch.numRows === 0) {
|
|
3433
|
-
return null;
|
|
3434
|
-
}
|
|
3435
|
-
return {
|
|
3436
|
-
shape: "arrow-table",
|
|
3437
|
-
batchType: "data",
|
|
3438
|
-
length: arrowRecordBatch.numRows,
|
|
3439
|
-
schema: this.schema,
|
|
3440
|
-
data: new arrow2.Table(arrowRecordBatch)
|
|
3441
|
-
};
|
|
3442
|
-
}
|
|
3443
|
-
/** Return a table with all the accumulated data */
|
|
3444
|
-
finishTable() {
|
|
3445
|
-
const arrowRecordBatch = this._getArrowRecordBatch();
|
|
3446
|
-
this.arrowBuilders.forEach((builder) => builder.finish());
|
|
3447
|
-
return {
|
|
3448
|
-
shape: "arrow-table",
|
|
3449
|
-
schema: this.schema,
|
|
3450
|
-
data: new arrow2.Table(arrowRecordBatch)
|
|
3451
|
-
};
|
|
3452
|
-
}
|
|
3453
|
-
/** Extract a record batch flushing the currently accumulated data in the builders */
|
|
3454
|
-
_getArrowRecordBatch() {
|
|
3455
|
-
var _a;
|
|
3456
|
-
const { arrowBuilders, arrowSchema } = this;
|
|
3457
|
-
const arrowDatas = arrowBuilders.map((builder) => builder.flush());
|
|
3458
|
-
const length = ((_a = arrowDatas[0]) == null ? void 0 : _a.length) || this.length;
|
|
3459
|
-
this.length = 0;
|
|
3460
|
-
const structField = new arrow2.Struct(arrowSchema.fields);
|
|
3461
|
-
const arrowStructData = new arrow2.Data(structField, 0, length, 0, void 0, arrowDatas);
|
|
3462
|
-
const arrowRecordBatch = new arrow2.RecordBatch(arrowSchema, arrowStructData);
|
|
3463
|
-
return arrowRecordBatch;
|
|
3464
|
-
}
|
|
3465
|
-
};
|
|
3466
|
-
}
|
|
3467
|
-
});
|
|
3468
|
-
|
|
3469
|
-
// ../core/src/schema-utils/index.ts
|
|
3470
|
-
var init_schema_utils = __esm({
|
|
3471
|
-
"../core/src/schema-utils/index.ts"() {
|
|
3472
|
-
"use strict";
|
|
3473
|
-
init_convert_arrow_schema();
|
|
3474
|
-
init_arrow_table_builder();
|
|
3475
|
-
}
|
|
3476
|
-
});
|
|
3477
|
-
|
|
3478
|
-
// ../core/src/arrow-geometry/geometry-to-wkt.ts
|
|
3479
|
-
function convertGeometryToWKT(geometry, options) {
|
|
3480
|
-
const dimension = getWKTDimension(geometry, options);
|
|
3481
|
-
if (geometry.type === "GeometryCollection" && !(options == null ? void 0 : options.dimension) && !(options == null ? void 0 : options.hasZ) && !(options == null ? void 0 : options.hasM) && (hasMixedChildDimensions(geometry) || hasDeclaredChildDimensions(geometry))) {
|
|
3482
|
-
if (geometry.geometries.length === 0) return "GEOMETRYCOLLECTION EMPTY";
|
|
3483
|
-
return `GEOMETRYCOLLECTION (${geometry.geometries.map((child) => convertGeometryToWKT(child)).join(", ")})`;
|
|
3484
|
-
}
|
|
3485
|
-
return (0, import_geospatial.formatWKT)(normalizeGeometryDimension(geometry, dimension), dimension);
|
|
3486
|
-
}
|
|
3487
|
-
function normalizeGeometryDimension(geometry, dimension) {
|
|
3488
|
-
if (geometry.type === "GeometryCollection") {
|
|
3489
|
-
return {
|
|
3490
|
-
type: "GeometryCollection",
|
|
3491
|
-
geometries: geometry.geometries.map((child) => normalizeGeometryDimension(child, dimension))
|
|
3492
|
-
};
|
|
3493
|
-
}
|
|
3494
|
-
return {
|
|
3495
|
-
...geometry,
|
|
3496
|
-
coordinates: normalizeCoordinateNesting(geometry.coordinates, getDimensionSize(dimension))
|
|
3497
|
-
};
|
|
3498
|
-
}
|
|
3499
|
-
function normalizeCoordinateNesting(value, dimensionSize) {
|
|
3500
|
-
if (value.length === 0) return value;
|
|
3501
|
-
if (typeof value[0] === "number") {
|
|
3502
|
-
const coordinate = value.slice(0, dimensionSize);
|
|
3503
|
-
while (coordinate.length < dimensionSize) coordinate.push(0);
|
|
3504
|
-
return coordinate;
|
|
3505
|
-
}
|
|
3506
|
-
return value.map((child) => normalizeCoordinateNesting(child, dimensionSize));
|
|
3507
|
-
}
|
|
3508
|
-
function hasMixedChildDimensions(geometry) {
|
|
3509
|
-
const dimensions = geometry.geometries.map((child) => getCoordinateDimension(child));
|
|
3510
|
-
return dimensions.some((dimension) => dimension !== dimensions[0]);
|
|
3511
|
-
}
|
|
3512
|
-
function hasDeclaredChildDimensions(geometry) {
|
|
3513
|
-
return geometry.geometries.some(
|
|
3514
|
-
(child) => Boolean(child.__geoarrowDimension)
|
|
3515
|
-
);
|
|
3516
|
-
}
|
|
3517
|
-
function getCoordinateDimension(geometry) {
|
|
3518
|
-
const declaredDimension = geometry.__geoarrowDimension;
|
|
3519
|
-
if (declaredDimension) return declaredDimension;
|
|
3520
|
-
if (geometry.type === "GeometryCollection") {
|
|
3521
|
-
const childDimensions = geometry.geometries.map(getCoordinateDimension);
|
|
3522
|
-
return childDimensions.length > 0 && childDimensions.every((dimension) => dimension === childDimensions[0]) ? childDimensions[0] : "xy";
|
|
3523
|
-
}
|
|
3524
|
-
const coordinate = getFirstCoordinate(geometry);
|
|
3525
|
-
return coordinate && coordinate.length >= 4 ? "xyzm" : coordinate && coordinate.length >= 3 ? "xyz" : "xy";
|
|
3526
|
-
}
|
|
3527
|
-
function getWKTDimension(geometry, options) {
|
|
3528
|
-
if (options == null ? void 0 : options.dimension) return options.dimension;
|
|
3529
|
-
if ((options == null ? void 0 : options.hasZ) && (options == null ? void 0 : options.hasM)) return "xyzm";
|
|
3530
|
-
if (options == null ? void 0 : options.hasZ) return "xyz";
|
|
3531
|
-
if (options == null ? void 0 : options.hasM) return "xym";
|
|
3532
|
-
return getCoordinateDimension(geometry);
|
|
3533
|
-
}
|
|
3534
|
-
function getFirstCoordinate(geometry) {
|
|
3535
|
-
if (geometry.type === "Point") return geometry.coordinates;
|
|
3536
|
-
if (geometry.type === "GeometryCollection") return null;
|
|
3537
|
-
let value = geometry.coordinates;
|
|
3538
|
-
while (Array.isArray(value) && Array.isArray(value[0])) value = value[0];
|
|
3539
|
-
return Array.isArray(value) ? value : null;
|
|
3540
|
-
}
|
|
3541
|
-
function getDimensionSize(dimension) {
|
|
3542
|
-
return dimension === "xy" ? 2 : dimension === "xyzm" ? 4 : 3;
|
|
3543
|
-
}
|
|
3544
|
-
var import_geospatial;
|
|
3545
|
-
var init_geometry_to_wkt = __esm({
|
|
3546
|
-
"../core/src/arrow-geometry/geometry-to-wkt.ts"() {
|
|
3547
|
-
"use strict";
|
|
3548
|
-
import_geospatial = require("@math.gl/geospatial");
|
|
3549
|
-
}
|
|
3550
|
-
});
|
|
3551
|
-
|
|
3552
|
-
// ../core/src/arrow-geometry/geometry-codecs.ts
|
|
3553
|
-
function convertGeometryToWKB(input, options = {}) {
|
|
3554
|
-
const geometry = input.type === "Feature" ? input.geometry : input;
|
|
3555
|
-
if (!geometry) throw new Error("WKB writer does not support null feature geometry");
|
|
3556
|
-
const dimension = options.hasZ ? options.hasM ? "xyzm" : "xyz" : options.hasM ? "xym" : "xy";
|
|
3557
|
-
const bytes = encodeGeometry(geometry, dimension);
|
|
3558
|
-
return bytes.buffer;
|
|
3559
|
-
}
|
|
3560
|
-
function encodeGeometry(geometry, dimension) {
|
|
3561
|
-
if (geometry.type !== "GeometryCollection") {
|
|
3562
|
-
return (0, import_geospatial2.writeWKB)(geometry, dimension);
|
|
3563
|
-
}
|
|
3564
|
-
const children = geometry.geometries.map(
|
|
3565
|
-
(child) => encodeGeometry(
|
|
3566
|
-
child,
|
|
3567
|
-
child.__geoarrowDimension ?? dimension
|
|
3568
|
-
)
|
|
3569
|
-
);
|
|
3570
|
-
const headerBuilder = new import_geospatial2.WKBBuilder({ mode: "measure", dimension });
|
|
3571
|
-
headerBuilder.beginGeometry("GeometryCollection", children.length);
|
|
3572
|
-
const headerLength = headerBuilder.finishGeometry();
|
|
3573
|
-
const bytes = new Uint8Array(
|
|
3574
|
-
headerLength + children.reduce((total, child) => total + child.length, 0)
|
|
3575
|
-
);
|
|
3576
|
-
const writer = new import_geospatial2.WKBBuilder({ mode: "write", target: bytes, dimension });
|
|
3577
|
-
writer.beginGeometry("GeometryCollection", children.length);
|
|
3578
|
-
let byteOffset = writer.finishGeometry();
|
|
3579
|
-
for (const child of children) {
|
|
3580
|
-
bytes.set(child, byteOffset);
|
|
3581
|
-
byteOffset += child.length;
|
|
3582
|
-
}
|
|
3583
|
-
return bytes;
|
|
3584
|
-
}
|
|
3585
|
-
var import_geospatial2;
|
|
3586
|
-
var init_geometry_codecs = __esm({
|
|
3587
|
-
"../core/src/arrow-geometry/geometry-codecs.ts"() {
|
|
3588
|
-
"use strict";
|
|
3589
|
-
import_geospatial2 = require("@math.gl/geospatial");
|
|
3590
|
-
init_geometry_to_wkt();
|
|
3591
|
-
}
|
|
3592
|
-
});
|
|
3593
|
-
|
|
3594
|
-
// ../core/src/arrow-geometry/geometry-field.ts
|
|
3595
|
-
function makeWKBGeometryField(geometryColumnName = "geometry", nullable = true) {
|
|
3596
|
-
return {
|
|
3597
|
-
name: geometryColumnName,
|
|
3598
|
-
type: "binary",
|
|
3599
|
-
nullable,
|
|
3600
|
-
metadata: {
|
|
3601
|
-
"ARROW:extension:name": "geoarrow.wkb"
|
|
3602
|
-
}
|
|
3603
|
-
};
|
|
3604
|
-
}
|
|
3605
|
-
function setWKBGeometryColumnMetadata(metadata2, options = {}) {
|
|
3606
|
-
const geometryColumnName = options.geometryColumnName || "geometry";
|
|
3607
|
-
const primaryColumnName = options.primaryColumnName || geometryColumnName;
|
|
3608
|
-
const geometryTypes = options.geometryTypes || [];
|
|
3609
|
-
const nextGeoMetadata = getGeoMetadata(metadata2) || { columns: {} };
|
|
3610
|
-
nextGeoMetadata.version = options.version || nextGeoMetadata.version || DEFAULT_GEO_METADATA_VERSION;
|
|
3611
|
-
nextGeoMetadata.primary_column = primaryColumnName;
|
|
3612
|
-
nextGeoMetadata.columns ||= {};
|
|
3613
|
-
nextGeoMetadata.columns[geometryColumnName] = {
|
|
3614
|
-
...nextGeoMetadata.columns[geometryColumnName],
|
|
3615
|
-
...options.columnMetadata,
|
|
3616
|
-
encoding: "wkb",
|
|
3617
|
-
geometry_types: geometryTypes
|
|
3618
|
-
};
|
|
3619
|
-
setGeoMetadata(metadata2, nextGeoMetadata);
|
|
3620
|
-
}
|
|
3621
|
-
function setWKBGeometrySchemaMetadata(schema, options = {}) {
|
|
3622
|
-
schema.metadata ||= {};
|
|
3623
|
-
setWKBGeometryColumnMetadata(schema.metadata, options);
|
|
3624
|
-
return schema;
|
|
3625
|
-
}
|
|
3626
|
-
function encodeWKBGeometryValue(value) {
|
|
3627
|
-
if (value === null || value === void 0) {
|
|
3628
|
-
return null;
|
|
3629
|
-
}
|
|
3630
|
-
if (isGeometry(value)) {
|
|
3631
|
-
return new Uint8Array(convertGeometryToWKB(value, getGeometryWKBOptions(value)));
|
|
3632
|
-
}
|
|
3633
|
-
if (value instanceof ArrayBuffer) {
|
|
3634
|
-
return new Uint8Array(value.slice(0));
|
|
3635
|
-
}
|
|
3636
|
-
if (ArrayBuffer.isView(value)) {
|
|
3637
|
-
return new Uint8Array(
|
|
3638
|
-
value.buffer.slice(value.byteOffset, value.byteOffset + value.byteLength)
|
|
3639
|
-
);
|
|
3640
|
-
}
|
|
3641
|
-
throw new Error("Expected a Geometry, ArrayBuffer, ArrayBufferView, or null for WKB encoding.");
|
|
3642
|
-
}
|
|
3643
|
-
function getGeometryWKBOptions(geometry) {
|
|
3644
|
-
const dimension = getGeometryDimension(geometry);
|
|
3645
|
-
return {
|
|
3646
|
-
hasZ: dimension === "xyz" || dimension === "xyzm",
|
|
3647
|
-
hasM: dimension === "xym" || dimension === "xyzm"
|
|
3648
|
-
};
|
|
3649
|
-
}
|
|
3650
|
-
function getGeometryDimension(geometry) {
|
|
3651
|
-
const declaredDimension = geometry.__geoarrowDimension;
|
|
3652
|
-
if (declaredDimension) return declaredDimension;
|
|
3653
|
-
if ("geometries" in geometry) {
|
|
3654
|
-
let hasZ = false;
|
|
3655
|
-
let hasM = false;
|
|
3656
|
-
for (const child of geometry.geometries) {
|
|
3657
|
-
const childDimension = getGeometryDimension(child);
|
|
3658
|
-
hasZ ||= childDimension === "xyz" || childDimension === "xyzm";
|
|
3659
|
-
hasM ||= childDimension === "xym" || childDimension === "xyzm";
|
|
3660
|
-
}
|
|
3661
|
-
return hasZ && hasM ? "xyzm" : hasZ ? "xyz" : hasM ? "xym" : "xy";
|
|
3662
|
-
}
|
|
3663
|
-
const dimensions = getCoordinateDimensions(getGeometrySampleCoordinates(geometry));
|
|
3664
|
-
return dimensions > 3 ? "xyzm" : dimensions > 2 ? "xyz" : "xy";
|
|
3665
|
-
}
|
|
3666
|
-
function inferGeoParquetGeometryTypes(geometries) {
|
|
3667
|
-
const geometryTypes = /* @__PURE__ */ new Set();
|
|
3668
|
-
for (const geometry of geometries) {
|
|
3669
|
-
if (!geometry) {
|
|
3670
|
-
continue;
|
|
3671
|
-
}
|
|
3672
|
-
const dimension = getGeometryDimension(geometry);
|
|
3673
|
-
geometryTypes.add(`${geometry.type}${getDimensionSuffix(dimension)}`);
|
|
3674
|
-
}
|
|
3675
|
-
return [...geometryTypes];
|
|
3676
|
-
}
|
|
3677
|
-
function getDimensionSuffix(dimension) {
|
|
3678
|
-
return dimension === "xy" ? "" : ` ${dimension === "xyzm" ? "ZM" : dimension.slice(2).toUpperCase()}`;
|
|
3679
|
-
}
|
|
3680
|
-
function getCoordinateDimensions(coordinates) {
|
|
3681
|
-
if (!Array.isArray(coordinates)) {
|
|
3682
|
-
return 2;
|
|
3683
|
-
}
|
|
3684
|
-
if (typeof coordinates[0] === "number") {
|
|
3685
|
-
return coordinates.length;
|
|
3686
|
-
}
|
|
3687
|
-
if (coordinates.length === 0) {
|
|
3688
|
-
return 2;
|
|
3689
|
-
}
|
|
3690
|
-
return getCoordinateDimensions(coordinates[0]);
|
|
3691
|
-
}
|
|
3692
|
-
function getGeometrySampleCoordinates(geometry) {
|
|
3693
|
-
if ("coordinates" in geometry) {
|
|
3694
|
-
return geometry.coordinates;
|
|
3695
|
-
}
|
|
3696
|
-
if ("geometries" in geometry && geometry.geometries.length > 0) {
|
|
3697
|
-
return getGeometrySampleCoordinates(geometry.geometries[0]);
|
|
3698
|
-
}
|
|
3699
|
-
return void 0;
|
|
3700
|
-
}
|
|
3701
|
-
function isGeometry(value) {
|
|
3702
|
-
if (!value || typeof value !== "object") {
|
|
3703
|
-
return false;
|
|
3704
|
-
}
|
|
3705
|
-
return "type" in value && ("coordinates" in value || "geometries" in value);
|
|
3706
|
-
}
|
|
3707
|
-
var DEFAULT_GEO_METADATA_VERSION;
|
|
3708
|
-
var init_geometry_field = __esm({
|
|
3709
|
-
"../core/src/arrow-geometry/geometry-field.ts"() {
|
|
3710
|
-
"use strict";
|
|
3711
|
-
init_geometry_codecs();
|
|
3712
|
-
init_schema();
|
|
3713
|
-
DEFAULT_GEO_METADATA_VERSION = "1.1.0";
|
|
3714
|
-
}
|
|
3715
|
-
});
|
|
3716
|
-
|
|
3717
|
-
// ../core/src/arrow-geometry/geoarrow-builder.ts
|
|
3718
|
-
function makePrimitiveData(values) {
|
|
3719
|
-
return arrow3.makeData({ type: new arrow3.Float64(), data: values });
|
|
3720
|
-
}
|
|
3721
|
-
function getBoxFieldNames(dimension) {
|
|
3722
|
-
const minimumNames = dimension === "xy" ? ["xmin", "ymin"] : dimension === "xyz" ? ["xmin", "ymin", "zmin"] : dimension === "xym" ? ["xmin", "ymin", "mmin"] : ["xmin", "ymin", "zmin", "mmin"];
|
|
3723
|
-
const maximumNames = dimension === "xy" ? ["xmax", "ymax"] : dimension === "xyz" ? ["xmax", "ymax", "zmax"] : dimension === "xym" ? ["xmax", "ymax", "mmax"] : ["xmax", "ymax", "zmax", "mmax"];
|
|
3724
|
-
return [...minimumNames, ...maximumNames];
|
|
3725
|
-
}
|
|
3726
|
-
function getCoordinateSize(dimension) {
|
|
3727
|
-
return dimension === "xy" ? 2 : dimension === "xyzm" ? 4 : 3;
|
|
3728
|
-
}
|
|
3729
|
-
function makeCoordinateData(values, dimension, coordinateLayout) {
|
|
3730
|
-
if (coordinateLayout === "separated") {
|
|
3731
|
-
const coordinateBuffers = values;
|
|
3732
|
-
const coordinateNames = getCoordinateNames(dimension);
|
|
3733
|
-
return arrow3.makeData({
|
|
3734
|
-
type: new arrow3.Struct(
|
|
3735
|
-
coordinateNames.map((name) => new arrow3.Field(name, new arrow3.Float64(), false))
|
|
3736
|
-
),
|
|
3737
|
-
children: coordinateNames.map((name) => makePrimitiveData(coordinateBuffers[name]))
|
|
3738
|
-
});
|
|
3739
|
-
}
|
|
3740
|
-
return arrow3.makeData({
|
|
3741
|
-
type: new arrow3.FixedSizeList(
|
|
3742
|
-
getCoordinateSize(dimension),
|
|
3743
|
-
new arrow3.Field(dimension, new arrow3.Float64(), false)
|
|
3744
|
-
),
|
|
3745
|
-
child: makePrimitiveData(values)
|
|
3746
|
-
});
|
|
3747
|
-
}
|
|
3748
|
-
function makeBoxData(values, dimension) {
|
|
3749
|
-
const names = getBoxFieldNames(dimension);
|
|
3750
|
-
const children = names.map((name, index) => {
|
|
3751
|
-
if (values instanceof Float64Array) {
|
|
3752
|
-
const boxSize = names.length;
|
|
3753
|
-
return makePrimitiveData(
|
|
3754
|
-
Float64Array.from(
|
|
3755
|
-
{ length: values.length / boxSize },
|
|
3756
|
-
(_, rowIndex) => values[rowIndex * boxSize + index]
|
|
3757
|
-
)
|
|
3758
|
-
);
|
|
3759
|
-
}
|
|
3760
|
-
return makePrimitiveData(values[name]);
|
|
3761
|
-
});
|
|
3762
|
-
return arrow3.makeData({
|
|
3763
|
-
type: new arrow3.Struct(names.map((name) => new arrow3.Field(name, new arrow3.Float64(), false))),
|
|
3764
|
-
children
|
|
3765
|
-
});
|
|
3766
|
-
}
|
|
3767
|
-
function makeListData(child, offsets, fieldName, offsetType) {
|
|
3768
|
-
return arrow3.makeData({
|
|
3769
|
-
type: offsetType === "int64" ? makeLargeListType(new arrow3.Field(fieldName, child.type, false)) : new arrow3.List(new arrow3.Field(fieldName, child.type, false)),
|
|
3770
|
-
valueOffsets: offsets,
|
|
3771
|
-
child
|
|
3772
|
-
});
|
|
3773
|
-
}
|
|
3774
|
-
function makeLargeListType(field) {
|
|
3775
|
-
const LargeList = getOptionalArrowConstructor2("LargeList");
|
|
3776
|
-
if (!LargeList) {
|
|
3777
|
-
throw new Error(
|
|
3778
|
-
"64-bit GeoArrow offsets require an Apache Arrow runtime that exports LargeList"
|
|
3779
|
-
);
|
|
3780
|
-
}
|
|
3781
|
-
return new LargeList(field);
|
|
3782
|
-
}
|
|
3783
|
-
function getOptionalArrowConstructor2(typeName) {
|
|
3784
|
-
return arrow3[typeName];
|
|
3785
|
-
}
|
|
3786
|
-
function makeCoordinateBuffers(coordinateCount, dimension, coordinateLayout) {
|
|
3787
|
-
if (coordinateLayout === "interleaved") {
|
|
3788
|
-
return new Float64Array(coordinateCount * getCoordinateSize(dimension));
|
|
3789
|
-
}
|
|
3790
|
-
const coordinateNames = getCoordinateNames(dimension);
|
|
3791
|
-
const buffers = {
|
|
3792
|
-
x: new Float64Array(coordinateCount),
|
|
3793
|
-
y: new Float64Array(coordinateCount)
|
|
3794
|
-
};
|
|
3795
|
-
for (const name of coordinateNames.slice(2)) buffers[name] = new Float64Array(coordinateCount);
|
|
3796
|
-
return buffers;
|
|
3797
|
-
}
|
|
3798
|
-
function makeBoxBuffers(boxCount, dimension, coordinateLayout) {
|
|
3799
|
-
const names = getBoxFieldNames(dimension);
|
|
3800
|
-
if (coordinateLayout === "interleaved") {
|
|
3801
|
-
return new Float64Array(boxCount * names.length);
|
|
3802
|
-
}
|
|
3803
|
-
const buffers = {};
|
|
3804
|
-
for (const name of names) {
|
|
3805
|
-
buffers[name] = new Float64Array(boxCount);
|
|
3806
|
-
}
|
|
3807
|
-
return buffers;
|
|
3808
|
-
}
|
|
3809
|
-
function getBoxValues(dimension, xmin, ymin, xmax, ymax, zmin, zmax, mmin, mmax) {
|
|
3810
|
-
switch (dimension) {
|
|
3811
|
-
case "xy":
|
|
3812
|
-
return [xmin, ymin, xmax, ymax];
|
|
3813
|
-
case "xyz":
|
|
3814
|
-
return [xmin, ymin, zmin ?? Number.NaN, xmax, ymax, zmax ?? Number.NaN];
|
|
3815
|
-
case "xym":
|
|
3816
|
-
return [xmin, ymin, mmin ?? Number.NaN, xmax, ymax, mmax ?? Number.NaN];
|
|
3817
|
-
case "xyzm":
|
|
3818
|
-
return [
|
|
3819
|
-
xmin,
|
|
3820
|
-
ymin,
|
|
3821
|
-
zmin ?? Number.NaN,
|
|
3822
|
-
mmin ?? Number.NaN,
|
|
3823
|
-
xmax,
|
|
3824
|
-
ymax,
|
|
3825
|
-
zmax ?? Number.NaN,
|
|
3826
|
-
mmax ?? Number.NaN
|
|
3827
|
-
];
|
|
3828
|
-
}
|
|
3829
|
-
}
|
|
3830
|
-
function getCoordinateNames(dimension) {
|
|
3831
|
-
switch (dimension) {
|
|
3832
|
-
case "xy":
|
|
3833
|
-
return ["x", "y"];
|
|
3834
|
-
case "xyz":
|
|
3835
|
-
return ["x", "y", "z"];
|
|
3836
|
-
case "xym":
|
|
3837
|
-
return ["x", "y", "m"];
|
|
3838
|
-
case "xyzm":
|
|
3839
|
-
return ["x", "y", "z", "m"];
|
|
3840
|
-
}
|
|
3841
|
-
}
|
|
3842
|
-
function withNulls(data, geometryArray) {
|
|
3843
|
-
return new arrow3.Data(
|
|
3844
|
-
data.type,
|
|
3845
|
-
0,
|
|
3846
|
-
geometryArray.length,
|
|
3847
|
-
geometryArray.nullCount,
|
|
3848
|
-
[
|
|
3849
|
-
data.valueOffsets,
|
|
3850
|
-
data.values,
|
|
3851
|
-
geometryArray.nullCount > 0 ? geometryArray.nullBitmap : void 0
|
|
3852
|
-
],
|
|
3853
|
-
data.children
|
|
3854
|
-
);
|
|
3855
|
-
}
|
|
3856
|
-
var arrow3, GeoArrowBuilder;
|
|
3857
|
-
var init_geoarrow_builder = __esm({
|
|
3858
|
-
"../core/src/arrow-geometry/geoarrow-builder.ts"() {
|
|
3859
|
-
"use strict";
|
|
3860
|
-
arrow3 = __toESM(require("apache-arrow"), 1);
|
|
3861
|
-
GeoArrowBuilder = class _GeoArrowBuilder {
|
|
3862
|
-
/** GeoArrow extension encoding emitted by this builder. */
|
|
3863
|
-
encoding;
|
|
3864
|
-
/** Whether coordinate tuples include Z. */
|
|
3865
|
-
hasZ;
|
|
3866
|
-
/** Whether coordinate tuples include M. */
|
|
3867
|
-
hasM;
|
|
3868
|
-
/** Exact coordinate dimension emitted by this builder. */
|
|
3869
|
-
dimension;
|
|
3870
|
-
state;
|
|
3871
|
-
/** Creates a GeoArrow builder in measure or write mode. */
|
|
3872
|
-
constructor(options) {
|
|
3873
|
-
this.encoding = options.encoding;
|
|
3874
|
-
this.dimension = options.dimension || (options.hasZ && options.hasM ? "xyzm" : options.hasZ ? "xyz" : options.hasM ? "xym" : "xy");
|
|
3875
|
-
this.hasZ = this.dimension === "xyz" || this.dimension === "xyzm";
|
|
3876
|
-
this.hasM = this.dimension === "xym" || this.dimension === "xyzm";
|
|
3877
|
-
const coordinateLayout = options.coordinateLayout || "interleaved";
|
|
3878
|
-
const offsetType = options.offsetType || "int32";
|
|
3879
|
-
this.state = {
|
|
3880
|
-
mode: options.mode,
|
|
3881
|
-
encoding: options.encoding,
|
|
3882
|
-
coordinateSize: getCoordinateSize(this.dimension),
|
|
3883
|
-
coordinateLayout,
|
|
3884
|
-
offsetType,
|
|
3885
|
-
transform: options.transform,
|
|
3886
|
-
length: 0,
|
|
3887
|
-
nullCount: 0,
|
|
3888
|
-
coordinateCount: 0,
|
|
3889
|
-
geometryChildCount: 0,
|
|
3890
|
-
partChildCount: 0,
|
|
3891
|
-
geometryOffsetCount: 1,
|
|
3892
|
-
partOffsetCount: 1,
|
|
3893
|
-
ringOffsetCount: 1,
|
|
3894
|
-
target: options.mode === "write" ? options.target : void 0
|
|
3895
|
-
};
|
|
3896
|
-
this.initializeOffsets();
|
|
3897
|
-
}
|
|
3898
|
-
/** Emits one null geometry row. */
|
|
3899
|
-
writeNullGeometry() {
|
|
3900
|
-
this.state.length++;
|
|
3901
|
-
this.state.nullCount++;
|
|
3902
|
-
if (this.encoding !== "geoarrow.point" && this.encoding !== "geoarrow.box") {
|
|
3903
|
-
this.writeGeometryOffset();
|
|
3904
|
-
}
|
|
3905
|
-
if (this.encoding === "geoarrow.point") this.state.coordinateCount++;
|
|
3906
|
-
}
|
|
3907
|
-
/** Begins one top-level geometry. */
|
|
3908
|
-
beginGeometry(_type, _count) {
|
|
3909
|
-
this.setValid(this.state.length);
|
|
3910
|
-
this.state.length++;
|
|
3911
|
-
}
|
|
3912
|
-
/** Begins one point geometry or nested point. */
|
|
3913
|
-
beginPoint() {
|
|
3914
|
-
if (this.encoding === "geoarrow.point") this.beginGeometry();
|
|
3915
|
-
}
|
|
3916
|
-
/** Begins one axis-aligned GeoArrow box row. */
|
|
3917
|
-
beginBox() {
|
|
3918
|
-
if (this.encoding !== "geoarrow.box") {
|
|
3919
|
-
throw new Error(`Cannot write Box into ${this.encoding}`);
|
|
3920
|
-
}
|
|
3921
|
-
this.beginGeometry();
|
|
3922
|
-
}
|
|
3923
|
-
/** Writes one axis-aligned box in canonical minimum-then-maximum ordinate order. */
|
|
3924
|
-
writeBox(xmin, ymin, xmax, ymax, zmin, zmax, mmin, mmax) {
|
|
3925
|
-
if (this.encoding !== "geoarrow.box") {
|
|
3926
|
-
throw new Error(`Cannot write Box into ${this.encoding}`);
|
|
3927
|
-
}
|
|
3928
|
-
const coordinateIndex = this.state.coordinateCount;
|
|
3929
|
-
const values = getBoxValues(this.dimension, xmin, ymin, xmax, ymax, zmin, zmax, mmin, mmax);
|
|
3930
|
-
if (this.state.mode === "write") {
|
|
3931
|
-
this.writeBoxValues(this.getTarget().coordinates, coordinateIndex, values);
|
|
3932
|
-
}
|
|
3933
|
-
this.state.coordinateCount++;
|
|
3934
|
-
}
|
|
3935
|
-
/** Begins one line string geometry or nested line string. */
|
|
3936
|
-
beginLineString(pointCount) {
|
|
3937
|
-
if (this.encoding === "geoarrow.linestring") {
|
|
3938
|
-
this.beginGeometry();
|
|
3939
|
-
this.writeGeometryOffset(pointCount);
|
|
3940
|
-
return;
|
|
3941
|
-
}
|
|
3942
|
-
if (this.encoding === "geoarrow.multilinestring") {
|
|
3943
|
-
this.writePartOffset(pointCount);
|
|
3944
|
-
return;
|
|
3945
|
-
}
|
|
3946
|
-
throw new Error(`Cannot write LineString into ${this.encoding}`);
|
|
3947
|
-
}
|
|
3948
|
-
/** Begins one polygon geometry or nested polygon. */
|
|
3949
|
-
beginPolygon(ringCount) {
|
|
3950
|
-
if (this.encoding === "geoarrow.polygon") {
|
|
3951
|
-
this.beginGeometry();
|
|
3952
|
-
this.writeGeometryOffset(ringCount);
|
|
3953
|
-
return;
|
|
3954
|
-
}
|
|
3955
|
-
if (this.encoding === "geoarrow.multipolygon") {
|
|
3956
|
-
this.writePartOffset(ringCount);
|
|
3957
|
-
return;
|
|
3958
|
-
}
|
|
3959
|
-
throw new Error(`Cannot write Polygon into ${this.encoding}`);
|
|
3960
|
-
}
|
|
3961
|
-
/** Begins one polygon linear ring. */
|
|
3962
|
-
beginLinearRing(pointCount) {
|
|
3963
|
-
if (this.encoding === "geoarrow.polygon") {
|
|
3964
|
-
this.writePartOffset(pointCount);
|
|
3965
|
-
return;
|
|
3966
|
-
}
|
|
3967
|
-
if (this.encoding === "geoarrow.multipolygon") {
|
|
3968
|
-
this.writeRingOffset(pointCount);
|
|
3969
|
-
return;
|
|
3970
|
-
}
|
|
3971
|
-
throw new Error(`Cannot write LinearRing into ${this.encoding}`);
|
|
3972
|
-
}
|
|
3973
|
-
/** Begins one multipoint geometry. */
|
|
3974
|
-
beginMultiPoint(pointCount) {
|
|
3975
|
-
if (this.encoding !== "geoarrow.multipoint") {
|
|
3976
|
-
throw new Error(`Cannot write MultiPoint into ${this.encoding}`);
|
|
3977
|
-
}
|
|
3978
|
-
this.beginGeometry();
|
|
3979
|
-
this.writeGeometryOffset(pointCount);
|
|
3980
|
-
}
|
|
3981
|
-
/** Begins one multilinestring geometry. */
|
|
3982
|
-
beginMultiLineString(lineCount) {
|
|
3983
|
-
if (this.encoding !== "geoarrow.multilinestring") {
|
|
3984
|
-
throw new Error(`Cannot write MultiLineString into ${this.encoding}`);
|
|
3985
|
-
}
|
|
3986
|
-
this.beginGeometry();
|
|
3987
|
-
this.writeGeometryOffset(lineCount);
|
|
3988
|
-
}
|
|
3989
|
-
/** Begins one multipolygon geometry. */
|
|
3990
|
-
beginMultiPolygon(polygonCount) {
|
|
3991
|
-
if (this.encoding !== "geoarrow.multipolygon") {
|
|
3992
|
-
throw new Error(`Cannot write MultiPolygon into ${this.encoding}`);
|
|
3993
|
-
}
|
|
3994
|
-
this.beginGeometry();
|
|
3995
|
-
this.writeGeometryOffset(polygonCount);
|
|
3996
|
-
}
|
|
3997
|
-
/** Writes one coordinate tuple. The third ordinate is M for an XYM builder. */
|
|
3998
|
-
writeCoordinate(x, y, z, m) {
|
|
3999
|
-
const coordinateIndex = this.state.coordinateCount;
|
|
4000
|
-
if (this.state.mode === "write") {
|
|
4001
|
-
const target = this.getTarget();
|
|
4002
|
-
const coordinate = this.getCoordinateValuesForWrite(x, y, z, m);
|
|
4003
|
-
const transformedCoordinate = this.state.transform ? this.state.transform(coordinate) : coordinate;
|
|
4004
|
-
this.writeCoordinateValues(
|
|
4005
|
-
target.coordinates,
|
|
4006
|
-
coordinateIndex,
|
|
4007
|
-
transformedCoordinate,
|
|
4008
|
-
coordinate
|
|
4009
|
-
);
|
|
4010
|
-
}
|
|
4011
|
-
this.state.coordinateCount++;
|
|
4012
|
-
}
|
|
4013
|
-
/** Completes the current geometry array and returns its row count. */
|
|
4014
|
-
finishGeometry() {
|
|
4015
|
-
return this.state.length;
|
|
4016
|
-
}
|
|
4017
|
-
/** Returns current measured or written array metadata. */
|
|
4018
|
-
getGeometryArray() {
|
|
4019
|
-
return {
|
|
4020
|
-
encoding: this.encoding,
|
|
4021
|
-
coordinateSize: this.state.coordinateSize,
|
|
4022
|
-
dimension: this.dimension,
|
|
4023
|
-
coordinateLayout: this.state.coordinateLayout,
|
|
4024
|
-
offsetType: this.state.offsetType,
|
|
4025
|
-
length: this.state.length,
|
|
4026
|
-
nullCount: this.state.nullCount,
|
|
4027
|
-
nullBitmap: this.getNullBitmap(),
|
|
4028
|
-
coordinates: this.getCoordinateValues(),
|
|
4029
|
-
geometryOffsets: this.getGeometryOffsets(),
|
|
4030
|
-
partOffsets: this.getPartOffsets(),
|
|
4031
|
-
ringOffsets: this.getRingOffsets()
|
|
4032
|
-
};
|
|
4033
|
-
}
|
|
4034
|
-
/** Measures geometry callbacks and returns allocated offsets. */
|
|
4035
|
-
static measureGeometryArray(writers, options) {
|
|
4036
|
-
const builder = new _GeoArrowBuilder({ mode: "measure", ...options });
|
|
4037
|
-
for (const writer of writers) writer ? writer(builder) : builder.writeNullGeometry();
|
|
4038
|
-
builder.finishGeometry();
|
|
4039
|
-
return builder.getGeometryArray();
|
|
4040
|
-
}
|
|
4041
|
-
/** Writes geometry callbacks into a measured target. */
|
|
4042
|
-
static writeGeometryArray(writers, measured, options) {
|
|
4043
|
-
const builder = new _GeoArrowBuilder({ mode: "write", target: measured, ...options });
|
|
4044
|
-
for (const writer of writers) writer ? writer(builder) : builder.writeNullGeometry();
|
|
4045
|
-
builder.finishGeometry();
|
|
4046
|
-
return builder.getGeometryArray();
|
|
4047
|
-
}
|
|
4048
|
-
/** Builds GeoArrow buffers from callbacks in two passes. */
|
|
4049
|
-
static buildGeometryArray(writers, options) {
|
|
4050
|
-
const measured = _GeoArrowBuilder.measureGeometryArray(writers, options);
|
|
4051
|
-
return _GeoArrowBuilder.writeGeometryArray(writers, measured, options);
|
|
4052
|
-
}
|
|
4053
|
-
/** Wraps GeoArrow buffers in an Apache Arrow Data instance. */
|
|
4054
|
-
static makeGeometryData(geometryArray) {
|
|
4055
|
-
if (geometryArray.encoding === "geoarrow.box") {
|
|
4056
|
-
return withNulls(
|
|
4057
|
-
makeBoxData(geometryArray.coordinates, geometryArray.dimension),
|
|
4058
|
-
geometryArray
|
|
4059
|
-
);
|
|
4060
|
-
}
|
|
4061
|
-
const coordinateData = makeCoordinateData(
|
|
4062
|
-
geometryArray.coordinates,
|
|
4063
|
-
geometryArray.dimension,
|
|
4064
|
-
geometryArray.coordinateLayout
|
|
4065
|
-
);
|
|
4066
|
-
let data = coordinateData;
|
|
4067
|
-
switch (geometryArray.encoding) {
|
|
4068
|
-
case "geoarrow.point":
|
|
4069
|
-
return withNulls(data, geometryArray);
|
|
4070
|
-
case "geoarrow.linestring":
|
|
4071
|
-
case "geoarrow.multipoint":
|
|
4072
|
-
data = makeListData(
|
|
4073
|
-
coordinateData,
|
|
4074
|
-
geometryArray.geometryOffsets,
|
|
4075
|
-
"vertices",
|
|
4076
|
-
geometryArray.offsetType
|
|
4077
|
-
);
|
|
4078
|
-
return withNulls(data, geometryArray);
|
|
4079
|
-
case "geoarrow.polygon":
|
|
4080
|
-
case "geoarrow.multilinestring":
|
|
4081
|
-
data = makeListData(
|
|
4082
|
-
coordinateData,
|
|
4083
|
-
geometryArray.partOffsets,
|
|
4084
|
-
"vertices",
|
|
4085
|
-
geometryArray.offsetType
|
|
4086
|
-
);
|
|
4087
|
-
data = makeListData(
|
|
4088
|
-
data,
|
|
4089
|
-
geometryArray.geometryOffsets,
|
|
4090
|
-
"rings",
|
|
4091
|
-
geometryArray.offsetType
|
|
4092
|
-
);
|
|
4093
|
-
return withNulls(data, geometryArray);
|
|
4094
|
-
case "geoarrow.multipolygon":
|
|
4095
|
-
data = makeListData(
|
|
4096
|
-
coordinateData,
|
|
4097
|
-
geometryArray.ringOffsets,
|
|
4098
|
-
"vertices",
|
|
4099
|
-
geometryArray.offsetType
|
|
4100
|
-
);
|
|
4101
|
-
data = makeListData(data, geometryArray.partOffsets, "rings", geometryArray.offsetType);
|
|
4102
|
-
data = makeListData(
|
|
4103
|
-
data,
|
|
4104
|
-
geometryArray.geometryOffsets,
|
|
4105
|
-
"polygons",
|
|
4106
|
-
geometryArray.offsetType
|
|
4107
|
-
);
|
|
4108
|
-
return withNulls(data, geometryArray);
|
|
4109
|
-
default:
|
|
4110
|
-
throw new Error(`Unsupported GeoArrow encoding ${geometryArray.encoding}`);
|
|
4111
|
-
}
|
|
4112
|
-
}
|
|
4113
|
-
initializeOffsets() {
|
|
4114
|
-
if (this.state.mode !== "measure") return;
|
|
4115
|
-
const target = {
|
|
4116
|
-
nullBitmap: new Uint8Array(0),
|
|
4117
|
-
coordinates: makeCoordinateBuffers(0, this.dimension, this.state.coordinateLayout)
|
|
4118
|
-
};
|
|
4119
|
-
if (this.encoding !== "geoarrow.point" && this.encoding !== "geoarrow.box") {
|
|
4120
|
-
target.geometryOffsets = this.makeOffsets(1);
|
|
4121
|
-
}
|
|
4122
|
-
if (this.encoding === "geoarrow.polygon" || this.encoding === "geoarrow.multilinestring" || this.encoding === "geoarrow.multipolygon") {
|
|
4123
|
-
target.partOffsets = this.makeOffsets(1);
|
|
4124
|
-
}
|
|
4125
|
-
if (this.encoding === "geoarrow.multipolygon") target.ringOffsets = this.makeOffsets(1);
|
|
4126
|
-
this.state.target = target;
|
|
4127
|
-
}
|
|
4128
|
-
getCoordinateValuesForWrite(x, y, z, m) {
|
|
4129
|
-
if (this.dimension === "xy") return [x, y];
|
|
4130
|
-
if (this.dimension === "xyz") return [x, y, z ?? Number.NaN];
|
|
4131
|
-
if (this.dimension === "xym") return [x, y, m ?? z ?? Number.NaN];
|
|
4132
|
-
return [x, y, z ?? Number.NaN, m ?? Number.NaN];
|
|
4133
|
-
}
|
|
4134
|
-
writeGeometryOffset(childCount = 0) {
|
|
4135
|
-
if (this.encoding === "geoarrow.point") return;
|
|
4136
|
-
this.state.geometryChildCount += childCount;
|
|
4137
|
-
this.appendOffset("geometryOffsets", this.state.geometryChildCount);
|
|
4138
|
-
}
|
|
4139
|
-
writePartOffset(childCount = 0) {
|
|
4140
|
-
this.state.partChildCount += childCount;
|
|
4141
|
-
this.appendOffset("partOffsets", this.state.partChildCount);
|
|
4142
|
-
}
|
|
4143
|
-
writeRingOffset(childCount = 0) {
|
|
4144
|
-
this.appendOffset("ringOffsets", this.state.coordinateCount + childCount);
|
|
4145
|
-
}
|
|
4146
|
-
appendOffset(name, value) {
|
|
4147
|
-
const target = this.getTarget();
|
|
4148
|
-
const offsets = target[name];
|
|
4149
|
-
if (!offsets) return;
|
|
4150
|
-
if (this.state.mode === "measure") {
|
|
4151
|
-
this.incrementOffsetCount(name);
|
|
4152
|
-
return;
|
|
4153
|
-
}
|
|
4154
|
-
const index = this.getOffsetCount(name);
|
|
4155
|
-
if (index >= offsets.length) throw new Error(`GeoArrowBuilder target ${name} overflow`);
|
|
4156
|
-
offsets[index] = offsets instanceof BigInt64Array ? BigInt(value) : value;
|
|
4157
|
-
this.incrementOffsetCount(name);
|
|
4158
|
-
}
|
|
4159
|
-
getOffsetCount(name) {
|
|
4160
|
-
switch (name) {
|
|
4161
|
-
case "geometryOffsets":
|
|
4162
|
-
return this.state.geometryOffsetCount;
|
|
4163
|
-
case "partOffsets":
|
|
4164
|
-
return this.state.partOffsetCount;
|
|
4165
|
-
case "ringOffsets":
|
|
4166
|
-
return this.state.ringOffsetCount;
|
|
4167
|
-
default:
|
|
4168
|
-
throw new Error(`Unexpected offset buffer ${name}`);
|
|
4169
|
-
}
|
|
4170
|
-
}
|
|
4171
|
-
incrementOffsetCount(name) {
|
|
4172
|
-
switch (name) {
|
|
4173
|
-
case "geometryOffsets":
|
|
4174
|
-
this.state.geometryOffsetCount++;
|
|
4175
|
-
return;
|
|
4176
|
-
case "partOffsets":
|
|
4177
|
-
this.state.partOffsetCount++;
|
|
4178
|
-
return;
|
|
4179
|
-
case "ringOffsets":
|
|
4180
|
-
this.state.ringOffsetCount++;
|
|
4181
|
-
return;
|
|
4182
|
-
default:
|
|
4183
|
-
throw new Error(`Unexpected offset buffer ${name}`);
|
|
4184
|
-
}
|
|
4185
|
-
}
|
|
4186
|
-
setValid(rowIndex) {
|
|
4187
|
-
if (this.state.mode !== "write") return;
|
|
4188
|
-
const bitmap = this.getTarget().nullBitmap;
|
|
4189
|
-
bitmap[rowIndex >> 3] |= 1 << (rowIndex & 7);
|
|
4190
|
-
}
|
|
4191
|
-
getTarget() {
|
|
4192
|
-
if (!this.state.target) throw new Error("GeoArrowBuilder target is not initialized");
|
|
4193
|
-
return this.state.target;
|
|
4194
|
-
}
|
|
4195
|
-
getNullBitmap() {
|
|
4196
|
-
return this.state.mode === "measure" ? new Uint8Array(Math.ceil(this.state.length / 8)) : this.getTarget().nullBitmap;
|
|
4197
|
-
}
|
|
4198
|
-
getCoordinateValues() {
|
|
4199
|
-
return this.state.mode === "measure" ? this.encoding === "geoarrow.box" ? makeBoxBuffers(this.state.coordinateCount, this.dimension, this.state.coordinateLayout) : makeCoordinateBuffers(
|
|
4200
|
-
this.state.coordinateCount,
|
|
4201
|
-
this.dimension,
|
|
4202
|
-
this.state.coordinateLayout
|
|
4203
|
-
) : this.getTarget().coordinates;
|
|
4204
|
-
}
|
|
4205
|
-
getGeometryOffsets() {
|
|
4206
|
-
return this.state.mode === "measure" && this.encoding !== "geoarrow.point" && this.encoding !== "geoarrow.box" ? this.makeOffsets(this.state.geometryOffsetCount) : this.getTarget().geometryOffsets;
|
|
4207
|
-
}
|
|
4208
|
-
getPartOffsets() {
|
|
4209
|
-
return this.state.mode === "measure" && (this.encoding === "geoarrow.polygon" || this.encoding === "geoarrow.multilinestring" || this.encoding === "geoarrow.multipolygon") ? this.makeOffsets(this.state.partOffsetCount) : this.getTarget().partOffsets;
|
|
4210
|
-
}
|
|
4211
|
-
getRingOffsets() {
|
|
4212
|
-
return this.state.mode === "measure" && this.encoding === "geoarrow.multipolygon" ? this.makeOffsets(this.state.ringOffsetCount) : this.getTarget().ringOffsets;
|
|
4213
|
-
}
|
|
4214
|
-
makeOffsets(length) {
|
|
4215
|
-
return this.state.offsetType === "int64" ? new BigInt64Array(length) : new Int32Array(length);
|
|
4216
|
-
}
|
|
4217
|
-
writeCoordinateValues(coordinates, coordinateIndex, transformedCoordinate, originalCoordinate) {
|
|
4218
|
-
if (coordinates instanceof Float64Array) {
|
|
4219
|
-
if (coordinateIndex >= coordinates.length / this.state.coordinateSize) {
|
|
4220
|
-
throw new Error("GeoArrowBuilder target coordinate buffer overflow");
|
|
4221
|
-
}
|
|
4222
|
-
const valueOffset = coordinateIndex * this.state.coordinateSize;
|
|
4223
|
-
for (let dimensionIndex = 0; dimensionIndex < this.state.coordinateSize; dimensionIndex++) {
|
|
4224
|
-
coordinates[valueOffset + dimensionIndex] = transformedCoordinate[dimensionIndex] ?? originalCoordinate[dimensionIndex] ?? Number.NaN;
|
|
4225
|
-
}
|
|
4226
|
-
return;
|
|
4227
|
-
}
|
|
4228
|
-
const coordinateNames = getCoordinateNames(this.dimension);
|
|
4229
|
-
for (let dimensionIndex = 0; dimensionIndex < coordinateNames.length; dimensionIndex++) {
|
|
4230
|
-
const coordinateValues = coordinates[coordinateNames[dimensionIndex]];
|
|
4231
|
-
if (!coordinateValues || coordinateIndex >= coordinateValues.length) {
|
|
4232
|
-
throw new Error("GeoArrowBuilder target coordinate buffer overflow");
|
|
4233
|
-
}
|
|
4234
|
-
coordinateValues[coordinateIndex] = transformedCoordinate[dimensionIndex] ?? originalCoordinate[dimensionIndex] ?? Number.NaN;
|
|
4235
|
-
}
|
|
4236
|
-
}
|
|
4237
|
-
writeBoxValues(coordinates, coordinateIndex, values) {
|
|
4238
|
-
if (coordinates instanceof Float64Array) {
|
|
4239
|
-
const valueOffset = coordinateIndex * values.length;
|
|
4240
|
-
if (valueOffset + values.length > coordinates.length) {
|
|
4241
|
-
throw new Error("GeoArrowBuilder target box buffer overflow");
|
|
4242
|
-
}
|
|
4243
|
-
coordinates.set(values, valueOffset);
|
|
4244
|
-
return;
|
|
4245
|
-
}
|
|
4246
|
-
const boxCoordinates = coordinates;
|
|
4247
|
-
const names = getBoxFieldNames(this.dimension);
|
|
4248
|
-
for (let index = 0; index < names.length; index++) {
|
|
4249
|
-
const valuesBuffer = boxCoordinates[names[index]];
|
|
4250
|
-
if (!(valuesBuffer instanceof Float64Array) || coordinateIndex >= valuesBuffer.length) {
|
|
4251
|
-
throw new Error("GeoArrowBuilder target box buffer overflow");
|
|
4252
|
-
}
|
|
4253
|
-
valuesBuffer[coordinateIndex] = values[index];
|
|
4254
|
-
}
|
|
4255
|
-
}
|
|
4256
|
-
};
|
|
4257
|
-
}
|
|
4258
|
-
});
|
|
4259
|
-
|
|
4260
|
-
// ../core/src/arrow-geometry/feature-table.ts
|
|
4261
|
-
function convertFeaturesToGeoArrowTable(features, options) {
|
|
4262
|
-
const preference = resolveGeoArrowEncodingPreference(options);
|
|
4263
|
-
if (preference === "geoarrow.geometry" || preference === "optimized") {
|
|
4264
|
-
return convertFeaturesToNativeGeoArrowTable(features, options, preference);
|
|
4265
|
-
}
|
|
4266
|
-
const rows = makeGeoArrowFeatureRows(features, options);
|
|
4267
|
-
const schema = makeGeoArrowFeatureSchema(features, options);
|
|
4268
|
-
const arrowTableBuilder = new ArrowTableBuilder(schema);
|
|
4269
|
-
for (const row of rows) {
|
|
4270
|
-
arrowTableBuilder.addObjectRow(row);
|
|
4271
|
-
}
|
|
4272
|
-
return arrowTableBuilder.finishTable();
|
|
4273
|
-
}
|
|
4274
|
-
function convertFeaturesToNativeGeoArrowTable(features, options, preference) {
|
|
4275
|
-
const geometries = features.map((feature) => feature.geometry || null);
|
|
4276
|
-
const dimension = getFeatureDimension(geometries);
|
|
4277
|
-
const encoding = preference === "geoarrow.geometry" ? preference : selectOptimizedEncoding(geometries);
|
|
4278
|
-
const geometryVector = encoding === "geoarrow.geometry" ? makeGeometryUnionVector(geometries, dimension) : makeNativeGeometryVector(geometries, encoding, dimension);
|
|
4279
|
-
const geometryColumnName = (options == null ? void 0 : options.geometryColumnName) || DEFAULT_GEOMETRY_COLUMN_NAME;
|
|
4280
|
-
const propertyRows = features.map((feature) => {
|
|
4281
|
-
const properties = normalizeProperties(feature.properties);
|
|
4282
|
-
assertNoGeometryPropertyCollision(properties, geometryColumnName);
|
|
4283
|
-
return properties;
|
|
4284
|
-
});
|
|
4285
|
-
const propertySchema = (options == null ? void 0 : options.propertySchema) || getPropertySchema(propertyRows);
|
|
4286
|
-
const schema = convertSchemaToArrow(propertySchema);
|
|
4287
|
-
const dimensionSuffix = dimension === "xy" ? "" : ` ${dimension.slice(2).toUpperCase()}`;
|
|
4288
|
-
const inferredGeometryColumnMetadata = {
|
|
4289
|
-
encoding,
|
|
4290
|
-
geometry_types: [
|
|
4291
|
-
...new Set(
|
|
4292
|
-
inferGeoParquetGeometryTypes(geometries).map(
|
|
4293
|
-
(type) => `${type.split(" ")[0]}${dimensionSuffix}`
|
|
4294
|
-
)
|
|
4295
|
-
)
|
|
4296
|
-
]
|
|
4297
|
-
};
|
|
4298
|
-
const existingGeoMetadata = getGeoMetadata(schema.metadata);
|
|
4299
|
-
const existingGeometryColumnMetadata = existingGeoMetadata == null ? void 0 : existingGeoMetadata.columns[geometryColumnName];
|
|
4300
|
-
const geometryColumnMetadata = existingGeometryColumnMetadata ? { ...existingGeometryColumnMetadata } : inferredGeometryColumnMetadata;
|
|
4301
|
-
const extensionMetadata = existingGeometryColumnMetadata ? { ...existingGeometryColumnMetadata } : inferredGeometryColumnMetadata;
|
|
4302
|
-
if (isLegacyGeoJSONCRS(options == null ? void 0 : options.crs)) {
|
|
4303
|
-
const normalizedCRS = normalizeLegacyGeoJSONCRS(options.crs);
|
|
4304
|
-
geometryColumnMetadata.geojson_crs = options.crs;
|
|
4305
|
-
extensionMetadata.geojson_crs = options.crs;
|
|
4306
|
-
if (normalizedCRS) {
|
|
4307
|
-
geometryColumnMetadata.crs = normalizedCRS.projjson;
|
|
4308
|
-
extensionMetadata.crs = normalizedCRS.projjson;
|
|
4309
|
-
extensionMetadata.crs_type = "projjson";
|
|
4310
|
-
}
|
|
4311
|
-
}
|
|
4312
|
-
const geometryField = new arrow4.Field(
|
|
4313
|
-
geometryColumnName,
|
|
4314
|
-
geometryVector.type,
|
|
4315
|
-
true,
|
|
4316
|
-
/* @__PURE__ */ new Map([
|
|
4317
|
-
["ARROW:extension:name", encoding],
|
|
4318
|
-
["ARROW:extension:metadata", JSON.stringify(extensionMetadata)]
|
|
4319
|
-
])
|
|
4320
|
-
);
|
|
4321
|
-
const nextFields = [...schema.fields, geometryField];
|
|
4322
|
-
const nextMetadata = new Map(schema.metadata || []);
|
|
4323
|
-
nextMetadata.set(
|
|
4324
|
-
"geo",
|
|
4325
|
-
JSON.stringify({
|
|
4326
|
-
version: DEFAULT_GEO_METADATA_VERSION2,
|
|
4327
|
-
primary_column: geometryColumnName,
|
|
4328
|
-
columns: {
|
|
4329
|
-
[geometryColumnName]: geometryColumnMetadata
|
|
4330
|
-
}
|
|
4331
|
-
})
|
|
4332
|
-
);
|
|
4333
|
-
const nextSchema = new arrow4.Schema(nextFields, nextMetadata);
|
|
4334
|
-
const propertyTableBuilder = new ArrowTableBuilder(propertySchema);
|
|
4335
|
-
for (const row of propertyRows) {
|
|
4336
|
-
propertyTableBuilder.addObjectRow(row);
|
|
4337
|
-
}
|
|
4338
|
-
const propertyTable = propertyTableBuilder.finishTable().data;
|
|
4339
|
-
const propertyBatch = propertyTable.batches[0];
|
|
4340
|
-
const children = nextFields.map(
|
|
4341
|
-
(field, fieldIndex) => {
|
|
4342
|
-
var _a;
|
|
4343
|
-
return fieldIndex < schema.fields.length ? (_a = propertyBatch == null ? void 0 : propertyBatch.getChildAt(fieldIndex)) == null ? void 0 : _a.data[0] : geometryVector.data[0];
|
|
4344
|
-
}
|
|
4345
|
-
);
|
|
4346
|
-
const data = arrow4.makeData({
|
|
4347
|
-
type: new arrow4.Struct(nextFields),
|
|
4348
|
-
length: features.length,
|
|
4349
|
-
nullCount: 0,
|
|
4350
|
-
children
|
|
4351
|
-
});
|
|
4352
|
-
return {
|
|
4353
|
-
shape: "arrow-table",
|
|
4354
|
-
schema: convertArrowToSchema(nextSchema),
|
|
4355
|
-
data: new arrow4.Table(nextSchema, [new arrow4.RecordBatch(nextSchema, data)])
|
|
4356
|
-
};
|
|
4357
|
-
}
|
|
4358
|
-
function resolveGeoArrowEncodingPreference(options) {
|
|
4359
|
-
var _a;
|
|
4360
|
-
return ((_a = options == null ? void 0 : options.geoarrow) == null ? void 0 : _a.encodingPreference) ?? (options == null ? void 0 : options.encodingPreference);
|
|
4361
|
-
}
|
|
4362
|
-
function selectOptimizedEncoding(geometries) {
|
|
4363
|
-
const geometryKinds = new Set(
|
|
4364
|
-
geometries.filter(Boolean).map((geometry) => geometry.type)
|
|
4365
|
-
);
|
|
4366
|
-
if (geometryKinds.size === 0 || geometryKinds.has("GeometryCollection")) {
|
|
4367
|
-
return "geoarrow.geometry";
|
|
4368
|
-
}
|
|
4369
|
-
if (geometryKinds.size === 1) {
|
|
4370
|
-
return getNativeEncoding([...geometryKinds][0]);
|
|
4371
|
-
}
|
|
4372
|
-
if (geometryKinds.size === 2) {
|
|
4373
|
-
if (geometryKinds.has("Point") && geometryKinds.has("MultiPoint")) {
|
|
4374
|
-
return "geoarrow.multipoint";
|
|
4375
|
-
}
|
|
4376
|
-
if (geometryKinds.has("LineString") && geometryKinds.has("MultiLineString")) {
|
|
4377
|
-
return "geoarrow.multilinestring";
|
|
4378
|
-
}
|
|
4379
|
-
if (geometryKinds.has("Polygon") && geometryKinds.has("MultiPolygon")) {
|
|
4380
|
-
return "geoarrow.multipolygon";
|
|
4381
|
-
}
|
|
4382
|
-
}
|
|
4383
|
-
return "geoarrow.geometry";
|
|
4384
|
-
}
|
|
4385
|
-
function getFeatureDimension(geometries) {
|
|
4386
|
-
let hasZ = false;
|
|
4387
|
-
let hasM = false;
|
|
4388
|
-
for (const geometry of geometries) {
|
|
4389
|
-
if (!geometry) continue;
|
|
4390
|
-
const dimensions = getGeometryWKBOptions(geometry);
|
|
4391
|
-
hasZ ||= Boolean(dimensions.hasZ);
|
|
4392
|
-
hasM ||= Boolean(dimensions.hasM);
|
|
4393
|
-
if (geometry.type === "GeometryCollection") {
|
|
4394
|
-
const childDimension = getFeatureDimension(geometry.geometries);
|
|
4395
|
-
hasZ ||= childDimension === "xyz" || childDimension === "xyzm";
|
|
4396
|
-
hasM ||= childDimension === "xym" || childDimension === "xyzm";
|
|
4397
|
-
}
|
|
4398
|
-
}
|
|
4399
|
-
return hasZ ? hasM ? "xyzm" : "xyz" : hasM ? "xym" : "xy";
|
|
4400
|
-
}
|
|
4401
|
-
function makeNativeGeometryVector(geometries, encoding, dimension) {
|
|
4402
|
-
const writers = geometries.map(
|
|
4403
|
-
(geometry) => geometry ? (builder) => writeGeometryToBuilder(builder, geometry, encoding) : null
|
|
4404
|
-
);
|
|
4405
|
-
const geometryArray = GeoArrowBuilder.buildGeometryArray(writers, { encoding, dimension });
|
|
4406
|
-
return arrow4.makeVector(GeoArrowBuilder.makeGeometryData(geometryArray));
|
|
4407
|
-
}
|
|
4408
|
-
function makeGeometryUnionVector(geometries, dimension, includeGeometryCollections = true) {
|
|
4409
|
-
const childRows = /* @__PURE__ */ new Map();
|
|
4410
|
-
const typeIds = [];
|
|
4411
|
-
const valueOffsets = [];
|
|
4412
|
-
const nullCarrierKind = "Point";
|
|
4413
|
-
const allGeometryKinds = [
|
|
4414
|
-
"Point",
|
|
4415
|
-
"LineString",
|
|
4416
|
-
"Polygon",
|
|
4417
|
-
"MultiPoint",
|
|
4418
|
-
"MultiLineString",
|
|
4419
|
-
"MultiPolygon",
|
|
4420
|
-
...includeGeometryCollections ? ["GeometryCollection"] : []
|
|
4421
|
-
];
|
|
4422
|
-
for (const geometryKind of allGeometryKinds) {
|
|
4423
|
-
childRows.set(geometryKind, []);
|
|
4424
|
-
}
|
|
4425
|
-
for (const geometry of geometries) {
|
|
4426
|
-
const kind = (geometry == null ? void 0 : geometry.type) || nullCarrierKind;
|
|
4427
|
-
const rows = childRows.get(kind) || [];
|
|
4428
|
-
valueOffsets.push(rows.length);
|
|
4429
|
-
typeIds.push(getUnionTypeId(kind, dimension));
|
|
4430
|
-
rows.push(geometry);
|
|
4431
|
-
childRows.set(kind, rows);
|
|
4432
|
-
}
|
|
4433
|
-
const orderedKinds = [...childRows.keys()].sort(
|
|
4434
|
-
(left, right) => getUnionTypeId(left, dimension) - getUnionTypeId(right, dimension)
|
|
4435
|
-
);
|
|
4436
|
-
const fields = orderedKinds.map(
|
|
4437
|
-
(kind) => new arrow4.Field(
|
|
4438
|
-
getUnionFieldName(kind, dimension),
|
|
4439
|
-
kind === "GeometryCollection" ? makeGeometryCollectionVector(childRows.get(kind), dimension).type : makeNativeGeometryVector(childRows.get(kind), getNativeEncoding(kind), dimension).type,
|
|
4440
|
-
true
|
|
4441
|
-
)
|
|
4442
|
-
);
|
|
4443
|
-
const children = orderedKinds.map((kind) => {
|
|
4444
|
-
if (kind === "GeometryCollection") {
|
|
4445
|
-
return makeGeometryCollectionVector(childRows.get(kind), dimension).data[0];
|
|
4446
|
-
}
|
|
4447
|
-
return makeNativeGeometryVector(childRows.get(kind), getNativeEncoding(kind), dimension).data[0];
|
|
4448
|
-
});
|
|
4449
|
-
const unionType = new arrow4.DenseUnion(
|
|
4450
|
-
orderedKinds.map((kind) => getUnionTypeId(kind, dimension)),
|
|
4451
|
-
fields
|
|
4452
|
-
);
|
|
4453
|
-
return arrow4.makeVector(
|
|
4454
|
-
arrow4.makeData({
|
|
4455
|
-
type: unionType,
|
|
4456
|
-
length: geometries.length,
|
|
4457
|
-
nullCount: 0,
|
|
4458
|
-
typeIds: Int8Array.from(typeIds),
|
|
4459
|
-
valueOffsets: Int32Array.from(valueOffsets),
|
|
4460
|
-
children
|
|
4461
|
-
})
|
|
4462
|
-
);
|
|
4463
|
-
}
|
|
4464
|
-
function makeGeometryCollectionVector(geometries, dimension) {
|
|
4465
|
-
const flattenedGeometries = [];
|
|
4466
|
-
const offsets = [0];
|
|
4467
|
-
for (const geometry of geometries) {
|
|
4468
|
-
if ((geometry == null ? void 0 : geometry.type) === "GeometryCollection") {
|
|
4469
|
-
appendGeometryCollectionMembers(flattenedGeometries, geometry.geometries);
|
|
4470
|
-
}
|
|
4471
|
-
offsets.push(flattenedGeometries.length);
|
|
4472
|
-
}
|
|
4473
|
-
const memberUnion = makeGeometryUnionVector(flattenedGeometries, dimension, false);
|
|
4474
|
-
const listType = new arrow4.List(new arrow4.Field("geometries", memberUnion.type, true));
|
|
4475
|
-
return arrow4.makeVector(
|
|
4476
|
-
arrow4.makeData({
|
|
4477
|
-
type: listType,
|
|
4478
|
-
length: geometries.length,
|
|
4479
|
-
nullCount: 0,
|
|
4480
|
-
valueOffsets: Int32Array.from(offsets),
|
|
4481
|
-
child: memberUnion.data[0]
|
|
4482
|
-
})
|
|
4483
|
-
);
|
|
4484
|
-
}
|
|
4485
|
-
function appendGeometryCollectionMembers(target, geometries) {
|
|
4486
|
-
for (const geometry of geometries) {
|
|
4487
|
-
if ((geometry == null ? void 0 : geometry.type) === "GeometryCollection") {
|
|
4488
|
-
appendGeometryCollectionMembers(target, geometry.geometries);
|
|
4489
|
-
} else {
|
|
4490
|
-
target.push(geometry);
|
|
4491
|
-
}
|
|
4492
|
-
}
|
|
4493
|
-
}
|
|
4494
|
-
function writeGeometryToBuilder(builder, geometry, encoding) {
|
|
4495
|
-
const dimensions = getGeometryWKBOptions(geometry);
|
|
4496
|
-
switch (geometry.type) {
|
|
4497
|
-
case "Point":
|
|
4498
|
-
if (encoding === "geoarrow.multipoint") builder.beginMultiPoint(1);
|
|
4499
|
-
builder.beginPoint();
|
|
4500
|
-
writeCoordinateToBuilder(builder, geometry.coordinates, dimensions);
|
|
4501
|
-
return;
|
|
4502
|
-
case "MultiPoint":
|
|
4503
|
-
builder.beginMultiPoint(geometry.coordinates.length);
|
|
4504
|
-
for (const coordinate of geometry.coordinates) {
|
|
4505
|
-
builder.beginPoint();
|
|
4506
|
-
writeCoordinateToBuilder(builder, coordinate, dimensions);
|
|
4507
|
-
}
|
|
4508
|
-
return;
|
|
4509
|
-
case "LineString":
|
|
4510
|
-
if (encoding === "geoarrow.multilinestring") builder.beginMultiLineString(1);
|
|
4511
|
-
writeLineStringToBuilder(builder, geometry.coordinates, dimensions);
|
|
4512
|
-
return;
|
|
4513
|
-
case "MultiLineString":
|
|
4514
|
-
builder.beginMultiLineString(geometry.coordinates.length);
|
|
4515
|
-
for (const line of geometry.coordinates) writeLineStringToBuilder(builder, line, dimensions);
|
|
4516
|
-
return;
|
|
4517
|
-
case "Polygon":
|
|
4518
|
-
if (encoding === "geoarrow.multipolygon") builder.beginMultiPolygon(1);
|
|
4519
|
-
writePolygonToBuilder(builder, geometry.coordinates, dimensions);
|
|
4520
|
-
return;
|
|
4521
|
-
case "MultiPolygon":
|
|
4522
|
-
builder.beginMultiPolygon(geometry.coordinates.length);
|
|
4523
|
-
for (const polygon of geometry.coordinates)
|
|
4524
|
-
writePolygonToBuilder(builder, polygon, dimensions);
|
|
4525
|
-
return;
|
|
4526
|
-
case "GeometryCollection":
|
|
4527
|
-
throw new Error("GeometryCollection must be written through the dense union builder.");
|
|
4528
|
-
}
|
|
4529
|
-
}
|
|
4530
|
-
function writeLineStringToBuilder(builder, coordinates, dimensions) {
|
|
4531
|
-
builder.beginLineString(coordinates.length);
|
|
4532
|
-
for (const coordinate of coordinates) writeCoordinateToBuilder(builder, coordinate, dimensions);
|
|
4533
|
-
}
|
|
4534
|
-
function writePolygonToBuilder(builder, coordinates, dimensions) {
|
|
4535
|
-
builder.beginPolygon(coordinates.length);
|
|
4536
|
-
for (const ring of coordinates) {
|
|
4537
|
-
builder.beginLinearRing(ring.length);
|
|
4538
|
-
for (const coordinate of ring) writeCoordinateToBuilder(builder, coordinate, dimensions);
|
|
4539
|
-
}
|
|
4540
|
-
}
|
|
4541
|
-
function writeCoordinateToBuilder(builder, coordinate, dimensions) {
|
|
4542
|
-
builder.writeCoordinate(
|
|
4543
|
-
coordinate[0] ?? Number.NaN,
|
|
4544
|
-
coordinate[1] ?? Number.NaN,
|
|
4545
|
-
dimensions.hasZ ? coordinate[2] : void 0,
|
|
4546
|
-
dimensions.hasM ? coordinate[dimensions.hasZ ? 3 : 2] : void 0
|
|
4547
|
-
);
|
|
4548
|
-
}
|
|
4549
|
-
function getNativeEncoding(kind) {
|
|
4550
|
-
switch (kind) {
|
|
4551
|
-
case "Point":
|
|
4552
|
-
return "geoarrow.point";
|
|
4553
|
-
case "LineString":
|
|
4554
|
-
return "geoarrow.linestring";
|
|
4555
|
-
case "Polygon":
|
|
4556
|
-
return "geoarrow.polygon";
|
|
4557
|
-
case "MultiPoint":
|
|
4558
|
-
return "geoarrow.multipoint";
|
|
4559
|
-
case "MultiLineString":
|
|
4560
|
-
return "geoarrow.multilinestring";
|
|
4561
|
-
case "MultiPolygon":
|
|
4562
|
-
return "geoarrow.multipolygon";
|
|
4563
|
-
default:
|
|
4564
|
-
throw new Error(`No native GeoArrow encoding exists for ${kind}.`);
|
|
4565
|
-
}
|
|
4566
|
-
}
|
|
4567
|
-
function getUnionTypeId(kind, dimension) {
|
|
4568
|
-
const baseTypeId = {
|
|
4569
|
-
Point: 1,
|
|
4570
|
-
LineString: 2,
|
|
4571
|
-
Polygon: 3,
|
|
4572
|
-
MultiPoint: 4,
|
|
4573
|
-
MultiLineString: 5,
|
|
4574
|
-
MultiPolygon: 6,
|
|
4575
|
-
GeometryCollection: 7
|
|
4576
|
-
};
|
|
4577
|
-
const dimensionOffset = dimension === "xyz" ? 10 : dimension === "xym" ? 20 : dimension === "xyzm" ? 30 : 0;
|
|
4578
|
-
return baseTypeId[kind] + dimensionOffset;
|
|
4579
|
-
}
|
|
4580
|
-
function getUnionFieldName(kind, dimension) {
|
|
4581
|
-
return dimension === "xy" ? kind : `${kind} ${dimension.slice(2).toUpperCase()}`;
|
|
4582
|
-
}
|
|
4583
|
-
function makeGeoArrowFeatureRows(features, options) {
|
|
4584
|
-
const geometryColumnName = (options == null ? void 0 : options.geometryColumnName) || DEFAULT_GEOMETRY_COLUMN_NAME;
|
|
4585
|
-
const encoding = (options == null ? void 0 : options.encoding) || "wkb";
|
|
4586
|
-
return features.map((feature) => {
|
|
4587
|
-
const properties = normalizeProperties(feature.properties);
|
|
4588
|
-
assertNoGeometryPropertyCollision(properties, geometryColumnName);
|
|
4589
|
-
return {
|
|
4590
|
-
...properties,
|
|
4591
|
-
[geometryColumnName]: encodeGeoArrowGeometry(feature.geometry, encoding)
|
|
4592
|
-
};
|
|
4593
|
-
});
|
|
4594
|
-
}
|
|
4595
|
-
function makeGeoArrowFeatureSchema(features, options) {
|
|
4596
|
-
const geometryColumnName = (options == null ? void 0 : options.geometryColumnName) || DEFAULT_GEOMETRY_COLUMN_NAME;
|
|
4597
|
-
const encoding = (options == null ? void 0 : options.encoding) || "wkb";
|
|
4598
|
-
const propertyRows = features.map((feature) => {
|
|
4599
|
-
const properties = normalizeProperties(feature.properties);
|
|
4600
|
-
assertNoGeometryPropertyCollision(properties, geometryColumnName);
|
|
4601
|
-
return properties;
|
|
4602
|
-
});
|
|
4603
|
-
const propertySchema = getPropertySchema(propertyRows);
|
|
4604
|
-
const geometryField = encoding === "wkb" ? makeWKBGeometryField(geometryColumnName, true) : {
|
|
4605
|
-
name: geometryColumnName,
|
|
4606
|
-
type: "utf8",
|
|
4607
|
-
nullable: true,
|
|
4608
|
-
metadata: {}
|
|
4609
|
-
};
|
|
4610
|
-
const schema = {
|
|
4611
|
-
fields: [...propertySchema.fields, geometryField],
|
|
4612
|
-
metadata: { ...propertySchema.metadata || {} }
|
|
4613
|
-
};
|
|
4614
|
-
if (encoding === "wkb") {
|
|
4615
|
-
setWKBGeometrySchemaMetadata(schema, {
|
|
4616
|
-
geometryColumnName,
|
|
4617
|
-
primaryColumnName: geometryColumnName,
|
|
4618
|
-
geometryTypes: inferGeoParquetGeometryTypes(features.map((feature) => feature.geometry))
|
|
4619
|
-
});
|
|
4620
|
-
} else {
|
|
4621
|
-
schema.metadata.geo = JSON.stringify({
|
|
4622
|
-
version: DEFAULT_GEO_METADATA_VERSION2,
|
|
4623
|
-
primary_column: geometryColumnName,
|
|
4624
|
-
columns: {
|
|
4625
|
-
[geometryColumnName]: {
|
|
4626
|
-
encoding,
|
|
4627
|
-
geometry_types: inferGeoParquetGeometryTypes(features.map((feature) => feature.geometry))
|
|
4628
|
-
}
|
|
4629
|
-
}
|
|
4630
|
-
});
|
|
4631
|
-
}
|
|
4632
|
-
applyLegacyGeoJSONCRSToSchema(schema, geometryColumnName, options == null ? void 0 : options.crs);
|
|
4633
|
-
return schema;
|
|
4634
|
-
}
|
|
4635
|
-
function applyLegacyGeoJSONCRSToSchema(schema, geometryColumnName, crs) {
|
|
4636
|
-
if (!isLegacyGeoJSONCRS(crs)) {
|
|
4637
|
-
return schema;
|
|
4638
|
-
}
|
|
4639
|
-
const geometryField = schema.fields.find((field) => field.name === geometryColumnName);
|
|
4640
|
-
if (!geometryField) {
|
|
4641
|
-
return schema;
|
|
4642
|
-
}
|
|
4643
|
-
const normalizedCRS = normalizeLegacyGeoJSONCRS(crs);
|
|
4644
|
-
const columnMetadata = {
|
|
4645
|
-
[GEOJSON_CRS_METADATA_KEY]: crs
|
|
4646
|
-
};
|
|
4647
|
-
if (normalizedCRS) {
|
|
4648
|
-
columnMetadata.crs = normalizedCRS.projjson;
|
|
4649
|
-
}
|
|
4650
|
-
schema.metadata ||= {};
|
|
4651
|
-
const geoMetadata = getGeoMetadata(schema.metadata) || {
|
|
4652
|
-
version: DEFAULT_GEO_METADATA_VERSION2,
|
|
4653
|
-
primary_column: geometryColumnName,
|
|
4654
|
-
columns: {}
|
|
4655
|
-
};
|
|
4656
|
-
geoMetadata.version ||= DEFAULT_GEO_METADATA_VERSION2;
|
|
4657
|
-
geoMetadata.primary_column ||= geometryColumnName;
|
|
4658
|
-
geoMetadata.columns ||= {};
|
|
4659
|
-
const existingColumnMetadata = geoMetadata.columns[geometryColumnName] || {
|
|
4660
|
-
encoding: geometryField.type === "utf8" ? "wkt" : "wkb",
|
|
4661
|
-
geometry_types: []
|
|
4662
|
-
};
|
|
4663
|
-
geoMetadata.columns[geometryColumnName] = {
|
|
4664
|
-
...existingColumnMetadata,
|
|
4665
|
-
...columnMetadata
|
|
4666
|
-
};
|
|
4667
|
-
setGeoMetadata(schema.metadata, geoMetadata);
|
|
4668
|
-
geometryField.metadata ||= {};
|
|
4669
|
-
const extensionMetadata = parseExtensionMetadata(
|
|
4670
|
-
geometryField.metadata[GEOARROW_EXTENSION_METADATA_KEY]
|
|
4671
|
-
);
|
|
4672
|
-
extensionMetadata[GEOJSON_CRS_METADATA_KEY] = crs;
|
|
4673
|
-
if (normalizedCRS) {
|
|
4674
|
-
extensionMetadata.crs = normalizedCRS.projjson;
|
|
4675
|
-
extensionMetadata.crs_type = "projjson";
|
|
4676
|
-
}
|
|
4677
|
-
geometryField.metadata[GEOARROW_EXTENSION_METADATA_KEY] = JSON.stringify(extensionMetadata);
|
|
4678
|
-
return schema;
|
|
4679
|
-
}
|
|
4680
|
-
function encodeGeoArrowGeometry(geometry, encoding) {
|
|
4681
|
-
if (!geometry) {
|
|
4682
|
-
return null;
|
|
4683
|
-
}
|
|
4684
|
-
return encoding === "wkt" ? convertGeometryToWKT(geometry) : encodeWKBGeometryValue(geometry);
|
|
4685
|
-
}
|
|
4686
|
-
function normalizeProperties(properties) {
|
|
4687
|
-
if (!properties || typeof properties !== "object") {
|
|
4688
|
-
return {};
|
|
4689
|
-
}
|
|
4690
|
-
const normalizedProperties = {};
|
|
4691
|
-
for (const [propertyName, propertyValue] of Object.entries(properties)) {
|
|
4692
|
-
normalizedProperties[propertyName] = normalizePropertyValue(propertyValue);
|
|
4693
|
-
}
|
|
4694
|
-
return normalizedProperties;
|
|
4695
|
-
}
|
|
4696
|
-
function normalizePropertyValue(propertyValue) {
|
|
4697
|
-
if (propertyValue === null || propertyValue === void 0 || typeof propertyValue === "string" || typeof propertyValue === "number" || typeof propertyValue === "boolean") {
|
|
4698
|
-
return propertyValue ?? null;
|
|
4699
|
-
}
|
|
4700
|
-
if (propertyValue instanceof Date) {
|
|
4701
|
-
return propertyValue.toISOString();
|
|
4702
|
-
}
|
|
4703
|
-
return JSON.stringify(propertyValue);
|
|
4704
|
-
}
|
|
4705
|
-
function getPropertySchema(propertyRows) {
|
|
4706
|
-
if (propertyRows.length === 0) {
|
|
4707
|
-
return { fields: [], metadata: {} };
|
|
4708
|
-
}
|
|
4709
|
-
const fieldNames = getFieldNames(propertyRows);
|
|
4710
|
-
return {
|
|
4711
|
-
metadata: {},
|
|
4712
|
-
fields: fieldNames.map((fieldName) => {
|
|
4713
|
-
const inferredType = getPropertyFieldType(
|
|
4714
|
-
propertyRows.map((propertyRow) => propertyRow[fieldName])
|
|
4715
|
-
);
|
|
4716
|
-
return {
|
|
4717
|
-
name: fieldName,
|
|
4718
|
-
type: inferredType.type === "float32" ? "float64" : inferredType.type,
|
|
4719
|
-
nullable: inferredType.nullable
|
|
4720
|
-
};
|
|
4721
|
-
})
|
|
4722
|
-
};
|
|
4723
|
-
}
|
|
4724
|
-
function getPropertyFieldType(values) {
|
|
4725
|
-
let type = "null";
|
|
4726
|
-
let nullable = false;
|
|
4727
|
-
for (const value of values) {
|
|
4728
|
-
if (value === null || value === void 0) {
|
|
4729
|
-
nullable = true;
|
|
4730
|
-
continue;
|
|
4731
|
-
}
|
|
4732
|
-
const valueType = getPropertyValueType(value);
|
|
4733
|
-
if (type === "null") {
|
|
4734
|
-
type = valueType;
|
|
4735
|
-
continue;
|
|
4736
|
-
}
|
|
4737
|
-
if (type !== valueType) {
|
|
4738
|
-
throw new Error(`GeoJSONLoader: incompatible property types ${type} and ${valueType}`);
|
|
4739
|
-
}
|
|
4740
|
-
}
|
|
4741
|
-
return { type, nullable };
|
|
4742
|
-
}
|
|
4743
|
-
function getPropertyValueType(value) {
|
|
4744
|
-
switch (typeof value) {
|
|
4745
|
-
case "boolean":
|
|
4746
|
-
return "bool";
|
|
4747
|
-
case "number":
|
|
4748
|
-
return "float64";
|
|
4749
|
-
case "string":
|
|
4750
|
-
return "utf8";
|
|
4751
|
-
default:
|
|
4752
|
-
return "null";
|
|
4753
|
-
}
|
|
4754
|
-
}
|
|
4755
|
-
function isLegacyGeoJSONCRS(value) {
|
|
4756
|
-
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
4757
|
-
}
|
|
4758
|
-
function normalizeLegacyGeoJSONCRS(crs) {
|
|
4759
|
-
const name = getLegacyGeoJSONCRSName(crs);
|
|
4760
|
-
if (!name) {
|
|
4761
|
-
return null;
|
|
4762
|
-
}
|
|
4763
|
-
const normalizedName = name.toLowerCase();
|
|
4764
|
-
if (normalizedName === "crs84" || normalizedName === "ogc:crs84" || normalizedName === "urn:ogc:def:crs:ogc:1.3:crs84" || normalizedName === "urn:ogc:def:crs:ogc::crs84" || normalizedName === "http://www.opengis.net/def/crs/ogc/1.3/crs84") {
|
|
4765
|
-
return { name, projjson: cloneJSON(CRS84_PROJJSON) };
|
|
4766
|
-
}
|
|
4767
|
-
if (normalizedName === "epsg:4326" || normalizedName === "urn:ogc:def:crs:epsg::4326" || normalizedName === "urn:ogc:def:crs:epsg:6.6:4326" || normalizedName === "http://www.opengis.net/def/crs/epsg/0/4326") {
|
|
4768
|
-
return { name, projjson: cloneJSON(EPSG_4326_PROJJSON) };
|
|
4769
|
-
}
|
|
4770
|
-
return null;
|
|
4771
|
-
}
|
|
4772
|
-
function getLegacyGeoJSONCRSName(crs) {
|
|
4773
|
-
var _a;
|
|
4774
|
-
if (typeof ((_a = crs.properties) == null ? void 0 : _a.name) === "string") {
|
|
4775
|
-
return crs.properties.name;
|
|
4776
|
-
}
|
|
4777
|
-
if (typeof crs.name === "string") {
|
|
4778
|
-
return crs.name;
|
|
4779
|
-
}
|
|
4780
|
-
return null;
|
|
4781
|
-
}
|
|
4782
|
-
function parseExtensionMetadata(metadata2) {
|
|
4783
|
-
if (!metadata2) {
|
|
4784
|
-
return {};
|
|
4785
|
-
}
|
|
4786
|
-
try {
|
|
4787
|
-
const parsedMetadata = JSON.parse(metadata2);
|
|
4788
|
-
return parsedMetadata && typeof parsedMetadata === "object" && !Array.isArray(parsedMetadata) ? parsedMetadata : {};
|
|
4789
|
-
} catch {
|
|
4790
|
-
return {};
|
|
4791
|
-
}
|
|
4792
|
-
}
|
|
4793
|
-
function cloneJSON(value) {
|
|
4794
|
-
return JSON.parse(JSON.stringify(value));
|
|
4795
|
-
}
|
|
4796
|
-
function getFieldNames(propertyRows) {
|
|
4797
|
-
const fieldNames = /* @__PURE__ */ new Set();
|
|
4798
|
-
for (const propertyRow of propertyRows) {
|
|
4799
|
-
for (const fieldName of Object.keys(propertyRow)) {
|
|
4800
|
-
fieldNames.add(fieldName);
|
|
4801
|
-
}
|
|
4802
|
-
}
|
|
4803
|
-
return [...fieldNames];
|
|
4804
|
-
}
|
|
4805
|
-
function assertNoGeometryPropertyCollision(properties, geometryColumnName) {
|
|
4806
|
-
if (Object.prototype.hasOwnProperty.call(properties, geometryColumnName)) {
|
|
4807
|
-
throw new Error(
|
|
4808
|
-
`GeoArrow conversion: GeoJSON property "${geometryColumnName}" conflicts with the geometry column name`
|
|
4809
|
-
);
|
|
4810
|
-
}
|
|
4811
|
-
}
|
|
4812
|
-
var arrow4, DEFAULT_GEOMETRY_COLUMN_NAME, DEFAULT_GEO_METADATA_VERSION2, GEOJSON_CRS_METADATA_KEY, GEOARROW_EXTENSION_METADATA_KEY, CRS84_PROJJSON, EPSG_4326_PROJJSON;
|
|
4813
|
-
var init_feature_table = __esm({
|
|
4814
|
-
"../core/src/arrow-geometry/feature-table.ts"() {
|
|
4815
|
-
"use strict";
|
|
4816
|
-
arrow4 = __toESM(require("apache-arrow"), 1);
|
|
4817
|
-
init_schema_utils();
|
|
4818
|
-
init_geometry_codecs();
|
|
4819
|
-
init_geometry_field();
|
|
4820
|
-
init_schema();
|
|
4821
|
-
init_geoarrow_builder();
|
|
4822
|
-
DEFAULT_GEOMETRY_COLUMN_NAME = "geometry";
|
|
4823
|
-
DEFAULT_GEO_METADATA_VERSION2 = "1.1.0";
|
|
4824
|
-
GEOJSON_CRS_METADATA_KEY = "geojson_crs";
|
|
4825
|
-
GEOARROW_EXTENSION_METADATA_KEY = "ARROW:extension:metadata";
|
|
4826
|
-
CRS84_PROJJSON = {
|
|
4827
|
-
$schema: "https://proj.org/schemas/v0.7/projjson.schema.json",
|
|
4828
|
-
type: "GeographicCRS",
|
|
4829
|
-
name: "WGS 84 longitude-latitude",
|
|
4830
|
-
datum_ensemble: {
|
|
4831
|
-
name: "World Geodetic System 1984 ensemble",
|
|
4832
|
-
members: [
|
|
4833
|
-
{ name: "World Geodetic System 1984 (Transit)" },
|
|
4834
|
-
{ name: "World Geodetic System 1984 (G730)" },
|
|
4835
|
-
{ name: "World Geodetic System 1984 (G873)" },
|
|
4836
|
-
{ name: "World Geodetic System 1984 (G1150)" },
|
|
4837
|
-
{ name: "World Geodetic System 1984 (G1674)" },
|
|
4838
|
-
{ name: "World Geodetic System 1984 (G1762)" },
|
|
4839
|
-
{ name: "World Geodetic System 1984 (G2139)" }
|
|
4840
|
-
],
|
|
4841
|
-
ellipsoid: {
|
|
4842
|
-
name: "WGS 84",
|
|
4843
|
-
semi_major_axis: 6378137,
|
|
4844
|
-
inverse_flattening: 298.257223563
|
|
4845
|
-
},
|
|
4846
|
-
accuracy: "2.0",
|
|
4847
|
-
id: {
|
|
4848
|
-
authority: "EPSG",
|
|
4849
|
-
code: 6326
|
|
4850
|
-
}
|
|
4851
|
-
},
|
|
4852
|
-
coordinate_system: {
|
|
4853
|
-
subtype: "ellipsoidal",
|
|
4854
|
-
axis: [
|
|
4855
|
-
{
|
|
4856
|
-
name: "Geodetic longitude",
|
|
4857
|
-
abbreviation: "Lon",
|
|
4858
|
-
direction: "east",
|
|
4859
|
-
unit: "degree"
|
|
4860
|
-
},
|
|
4861
|
-
{
|
|
4862
|
-
name: "Geodetic latitude",
|
|
4863
|
-
abbreviation: "Lat",
|
|
4864
|
-
direction: "north",
|
|
4865
|
-
unit: "degree"
|
|
4866
|
-
}
|
|
4867
|
-
]
|
|
4868
|
-
},
|
|
4869
|
-
id: {
|
|
4870
|
-
authority: "OGC",
|
|
4871
|
-
code: "CRS84"
|
|
4872
|
-
}
|
|
4873
|
-
};
|
|
4874
|
-
EPSG_4326_PROJJSON = {
|
|
4875
|
-
...CRS84_PROJJSON,
|
|
4876
|
-
name: "WGS 84",
|
|
4877
|
-
coordinate_system: {
|
|
4878
|
-
subtype: "ellipsoidal",
|
|
4879
|
-
axis: [
|
|
4880
|
-
{
|
|
4881
|
-
name: "Geodetic latitude",
|
|
4882
|
-
abbreviation: "Lat",
|
|
4883
|
-
direction: "north",
|
|
4884
|
-
unit: "degree"
|
|
4885
|
-
},
|
|
4886
|
-
{
|
|
4887
|
-
name: "Geodetic longitude",
|
|
4888
|
-
abbreviation: "Lon",
|
|
4889
|
-
direction: "east",
|
|
4890
|
-
unit: "degree"
|
|
4891
|
-
}
|
|
4892
|
-
]
|
|
4893
|
-
},
|
|
4894
|
-
id: {
|
|
4895
|
-
authority: "EPSG",
|
|
4896
|
-
code: 4326
|
|
4897
|
-
}
|
|
4898
|
-
};
|
|
4899
|
-
}
|
|
4900
|
-
});
|
|
4901
|
-
|
|
4902
|
-
// ../core/src/arrow-geometry/feature-collection-to-arrow.ts
|
|
4903
|
-
function convertFeaturesToWKBArrowTable(features, options = {}) {
|
|
4904
|
-
const encodingPreference = resolveGeoArrowEncodingPreference(options);
|
|
4905
|
-
if (encodingPreference && encodingPreference !== "geoarrow.wkb") {
|
|
4906
|
-
return convertFeaturesToGeoArrowTable(features, options);
|
|
4907
|
-
}
|
|
4908
|
-
const hasFeatureIds = features.some((feature) => feature.id !== void 0);
|
|
4909
|
-
const propertyRows = features.map((feature) => {
|
|
4910
|
-
const properties = normalizeProperties2(feature.properties);
|
|
4911
|
-
if (hasFeatureIds) {
|
|
4912
|
-
properties.id = normalizePropertyValue2(feature.id);
|
|
4913
|
-
}
|
|
4914
|
-
return properties;
|
|
4915
|
-
});
|
|
4916
|
-
const propertySchema = getPropertySchema2(propertyRows);
|
|
4917
|
-
const schema = buildFeatureArrowSchema(propertySchema, features);
|
|
4918
|
-
const arrowTableBuilder = new ArrowTableBuilder(schema);
|
|
4919
|
-
for (let featureIndex = 0; featureIndex < features.length; featureIndex++) {
|
|
4920
|
-
arrowTableBuilder.addObjectRow({
|
|
4921
|
-
...propertyRows[featureIndex],
|
|
4922
|
-
[GEOMETRY_COLUMN_NAME]: encodeWKBGeometryValue(features[featureIndex].geometry)
|
|
4923
|
-
});
|
|
4924
|
-
}
|
|
4925
|
-
return arrowTableBuilder.finishTable();
|
|
4926
|
-
}
|
|
4927
|
-
function buildFeatureArrowSchema(propertySchema, features) {
|
|
4928
|
-
const geometryField = makeWKBGeometryField(GEOMETRY_COLUMN_NAME);
|
|
4929
|
-
const schema = {
|
|
4930
|
-
fields: [...propertySchema.fields, geometryField],
|
|
4931
|
-
metadata: { ...propertySchema.metadata || {} }
|
|
4932
|
-
};
|
|
4933
|
-
setWKBGeometrySchemaMetadata(schema, {
|
|
4934
|
-
geometryColumnName: GEOMETRY_COLUMN_NAME,
|
|
4935
|
-
geometryTypes: inferGeoParquetGeometryTypes(features.map((feature) => feature.geometry))
|
|
4936
|
-
});
|
|
4937
|
-
return schema;
|
|
4938
|
-
}
|
|
4939
|
-
function normalizeProperties2(properties) {
|
|
4940
|
-
if (!properties || typeof properties !== "object") {
|
|
4941
|
-
return {};
|
|
4942
|
-
}
|
|
4943
|
-
const normalizedProperties = {};
|
|
4944
|
-
for (const [propertyName, propertyValue] of Object.entries(properties)) {
|
|
4945
|
-
normalizedProperties[propertyName] = normalizePropertyValue2(propertyValue);
|
|
4946
|
-
}
|
|
4947
|
-
return normalizedProperties;
|
|
4948
|
-
}
|
|
4949
|
-
function normalizePropertyValue2(propertyValue) {
|
|
4950
|
-
if (propertyValue === null || propertyValue === void 0 || typeof propertyValue === "string" || typeof propertyValue === "number" || typeof propertyValue === "boolean") {
|
|
4951
|
-
return propertyValue ?? null;
|
|
4952
|
-
}
|
|
4953
|
-
if (propertyValue instanceof Date) {
|
|
4954
|
-
return propertyValue.toISOString();
|
|
4955
|
-
}
|
|
4956
|
-
return JSON.stringify(propertyValue);
|
|
4957
|
-
}
|
|
4958
|
-
function getPropertySchema2(propertyRows) {
|
|
4959
|
-
if (propertyRows.length === 0) {
|
|
4960
|
-
return { fields: [], metadata: {} };
|
|
4961
|
-
}
|
|
4962
|
-
const fieldNames = getFieldNames2(propertyRows);
|
|
4963
|
-
return {
|
|
4964
|
-
metadata: {},
|
|
4965
|
-
fields: fieldNames.map((fieldName) => {
|
|
4966
|
-
const values = propertyRows.map((propertyRow) => propertyRow[fieldName]);
|
|
4967
|
-
const firstDefinedValue = values.find((value) => value !== null && value !== void 0);
|
|
4968
|
-
const inferredType = {
|
|
4969
|
-
type: getPropertyDataType(firstDefinedValue),
|
|
4970
|
-
nullable: true
|
|
4971
|
-
};
|
|
4972
|
-
return {
|
|
4973
|
-
name: fieldName,
|
|
4974
|
-
type: inferredType.type === "float32" ? "float64" : inferredType.type,
|
|
4975
|
-
nullable: inferredType.nullable
|
|
4976
|
-
};
|
|
4977
|
-
})
|
|
4978
|
-
};
|
|
4979
|
-
}
|
|
4980
|
-
function getPropertyDataType(value) {
|
|
4981
|
-
if (typeof value === "number") {
|
|
4982
|
-
return "float64";
|
|
4983
|
-
}
|
|
4984
|
-
if (typeof value === "boolean") {
|
|
4985
|
-
return "bool";
|
|
4986
|
-
}
|
|
4987
|
-
if (typeof value === "string") {
|
|
4988
|
-
return "utf8";
|
|
4989
|
-
}
|
|
4990
|
-
return "null";
|
|
4991
|
-
}
|
|
4992
|
-
function getFieldNames2(propertyRows) {
|
|
4993
|
-
const fieldNames = /* @__PURE__ */ new Set();
|
|
4994
|
-
for (const propertyRow of propertyRows) {
|
|
4995
|
-
for (const fieldName of Object.keys(propertyRow)) {
|
|
4996
|
-
fieldNames.add(fieldName);
|
|
4997
|
-
}
|
|
4998
|
-
}
|
|
4999
|
-
return [...fieldNames];
|
|
5000
|
-
}
|
|
5001
|
-
var GEOMETRY_COLUMN_NAME;
|
|
5002
|
-
var init_feature_collection_to_arrow = __esm({
|
|
5003
|
-
"../core/src/arrow-geometry/feature-collection-to-arrow.ts"() {
|
|
5004
|
-
"use strict";
|
|
5005
|
-
init_schema_utils();
|
|
5006
|
-
init_geometry_field();
|
|
5007
|
-
init_feature_table();
|
|
5008
|
-
GEOMETRY_COLUMN_NAME = "geometry";
|
|
5009
|
-
}
|
|
5010
|
-
});
|
|
5011
|
-
|
|
5012
|
-
// src/wms/lib/parsers/gml/deep-strict-equal.ts
|
|
5013
|
-
function deepStrictEqual(actual, expected, strict) {
|
|
5014
|
-
if (actual === expected) {
|
|
5015
|
-
return true;
|
|
5016
|
-
} else if (actual instanceof Date && expected instanceof Date) {
|
|
5017
|
-
return actual.getTime() === expected.getTime();
|
|
5018
|
-
} else if (actual instanceof RegExp && expected instanceof RegExp) {
|
|
5019
|
-
return actual.source === expected.source && actual.global === expected.global && actual.multiline === expected.multiline && actual.lastIndex === expected.lastIndex && actual.ignoreCase === expected.ignoreCase;
|
|
5020
|
-
} else if ((actual === null || typeof actual !== "object") && (expected === null || typeof expected !== "object")) {
|
|
5021
|
-
return strict ? actual === expected : actual === expected;
|
|
5022
|
-
}
|
|
5023
|
-
return objEquiv(actual, expected, strict);
|
|
5024
|
-
}
|
|
5025
|
-
function isPrimitive(arg) {
|
|
5026
|
-
return arg === null || typeof arg !== "object" && typeof arg !== "function";
|
|
5027
|
-
}
|
|
5028
|
-
function isArguments(object) {
|
|
5029
|
-
return Object.prototype.toString.call(object) === "[object Arguments]";
|
|
5030
|
-
}
|
|
5031
|
-
function objEquiv(a, b, strict) {
|
|
5032
|
-
if (a === null || a === void 0 || b === null || b === void 0) return false;
|
|
5033
|
-
if (isPrimitive(a) || isPrimitive(b)) return a === b;
|
|
5034
|
-
if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b)) return false;
|
|
5035
|
-
const aIsArgs = isArguments(a);
|
|
5036
|
-
const bIsArgs = isArguments(b);
|
|
5037
|
-
if (aIsArgs && !bIsArgs || !aIsArgs && bIsArgs) return false;
|
|
5038
|
-
if (aIsArgs) {
|
|
5039
|
-
a = pSlice.call(a);
|
|
5040
|
-
b = pSlice.call(b);
|
|
5041
|
-
return deepStrictEqual(a, b, strict);
|
|
5042
|
-
}
|
|
5043
|
-
const ka = Object.keys(a);
|
|
5044
|
-
const kb = Object.keys(b);
|
|
5045
|
-
let key;
|
|
5046
|
-
let i;
|
|
5047
|
-
if (ka.length !== kb.length) return false;
|
|
5048
|
-
ka.sort();
|
|
5049
|
-
kb.sort();
|
|
5050
|
-
for (i = ka.length - 1; i >= 0; i--) {
|
|
5051
|
-
if (ka[i] !== kb[i]) return false;
|
|
5052
|
-
}
|
|
5053
|
-
for (i = ka.length - 1; i >= 0; i--) {
|
|
5054
|
-
key = ka[i];
|
|
5055
|
-
if (!deepStrictEqual(a[key], b[key], strict)) return false;
|
|
5056
|
-
}
|
|
5057
|
-
return true;
|
|
5058
|
-
}
|
|
5059
|
-
var pSlice;
|
|
5060
|
-
var init_deep_strict_equal = __esm({
|
|
5061
|
-
"src/wms/lib/parsers/gml/deep-strict-equal.ts"() {
|
|
5062
|
-
"use strict";
|
|
5063
|
-
pSlice = Array.prototype.slice;
|
|
5064
|
-
}
|
|
5065
|
-
});
|
|
5066
|
-
|
|
5067
|
-
// src/wms/lib/parsers/gml/rewind-geometry.ts
|
|
5068
|
-
function rewindGeometry(geometry) {
|
|
5069
|
-
switch (geometry.type) {
|
|
5070
|
-
case "Polygon":
|
|
5071
|
-
rewindPolygon(geometry.coordinates);
|
|
5072
|
-
break;
|
|
5073
|
-
case "MultiPolygon":
|
|
5074
|
-
for (const polygon of geometry.coordinates) rewindPolygon(polygon);
|
|
5075
|
-
break;
|
|
5076
|
-
case "LineString":
|
|
5077
|
-
rewindCoordinates(geometry.coordinates, true);
|
|
5078
|
-
break;
|
|
5079
|
-
case "MultiLineString":
|
|
5080
|
-
for (const line of geometry.coordinates) rewindCoordinates(line, true);
|
|
5081
|
-
break;
|
|
5082
|
-
case "GeometryCollection":
|
|
5083
|
-
for (const child of geometry.geometries) rewindGeometry(child);
|
|
5084
|
-
break;
|
|
5085
|
-
}
|
|
5086
|
-
return geometry;
|
|
5087
|
-
}
|
|
5088
|
-
function rewindPolygon(rings) {
|
|
5089
|
-
for (let ringIndex = 0; ringIndex < rings.length; ringIndex++) {
|
|
5090
|
-
rewindCoordinates(rings[ringIndex], ringIndex > 0);
|
|
5091
|
-
}
|
|
5092
|
-
}
|
|
5093
|
-
function rewindCoordinates(coordinates, clockwise) {
|
|
5094
|
-
let windingSum = 0;
|
|
5095
|
-
for (let pointIndex = 1; pointIndex < coordinates.length; pointIndex++) {
|
|
5096
|
-
const previousPoint = coordinates[pointIndex - 1];
|
|
5097
|
-
const currentPoint = coordinates[pointIndex];
|
|
5098
|
-
windingSum += (currentPoint[0] - previousPoint[0]) * (currentPoint[1] + previousPoint[1]);
|
|
5099
|
-
}
|
|
5100
|
-
if (windingSum > 0 !== clockwise) coordinates.reverse();
|
|
5101
|
-
}
|
|
5102
|
-
var init_rewind_geometry = __esm({
|
|
5103
|
-
"src/wms/lib/parsers/gml/rewind-geometry.ts"() {
|
|
5104
|
-
"use strict";
|
|
5105
|
-
}
|
|
5106
|
-
});
|
|
5107
|
-
|
|
5108
|
-
// src/wms/lib/parsers/gml/parse-gml.ts
|
|
5109
|
-
function noTransform(...coords) {
|
|
5110
|
-
return coords;
|
|
5111
|
-
}
|
|
5112
|
-
function parseGML(text2, options) {
|
|
5113
|
-
const parsedXML = parseXMLTextSync2(text2, options);
|
|
5114
|
-
options = { transformCoords: noTransform, stride: 2, ...options };
|
|
5115
|
-
const featureCollection = parseGMLFeatureCollection(parsedXML, options);
|
|
5116
|
-
if (featureCollection) {
|
|
5117
|
-
return featureCollection;
|
|
5118
|
-
}
|
|
5119
|
-
const context = createChildContext(parsedXML, options, {});
|
|
5120
|
-
return parseGMLToGeometry(parsedXML, options, context);
|
|
5121
|
-
}
|
|
5122
|
-
function parseGMLFeatureCollection(inputXML, options = {}) {
|
|
5123
|
-
const featureMembers = findFeatureMembers(inputXML);
|
|
5124
|
-
const collectionEntry = Object.entries(inputXML || {}).find(
|
|
5125
|
-
([key]) => stripNamespace(key) === "FeatureCollection"
|
|
5126
|
-
);
|
|
5127
|
-
const collection = collectionEntry == null ? void 0 : collectionEntry[1];
|
|
5128
|
-
if (featureMembers.length === 0 && !collectionEntry) {
|
|
5129
|
-
return null;
|
|
5130
|
-
}
|
|
5131
|
-
const result = {
|
|
5132
|
-
type: "FeatureCollection",
|
|
5133
|
-
features: featureMembers.map((featureMember) => parseGMLFeature(featureMember, options))
|
|
5134
|
-
};
|
|
5135
|
-
for (const [name, value] of Object.entries((collection == null ? void 0 : collection.attributes) || collection || {})) {
|
|
5136
|
-
const key = stripNamespace(name);
|
|
5137
|
-
if (key === "numberMatched" && value === "unknown") result.numberMatched = "unknown";
|
|
5138
|
-
else if (key === "numberMatched" || key === "numberReturned") {
|
|
5139
|
-
const count = Number(value);
|
|
5140
|
-
if (!String(value).trim() || !Number.isSafeInteger(count) || count < 0)
|
|
5141
|
-
throw new Error(`Invalid WFS ${key} count`);
|
|
5142
|
-
result[key] = count;
|
|
5143
|
-
} else if (key === "next" || key === "previous") result[key] = String(value);
|
|
5144
|
-
}
|
|
5145
|
-
return result;
|
|
5146
|
-
}
|
|
5147
|
-
function parseGMLFeature(inputXML, options = {}) {
|
|
5148
|
-
var _a;
|
|
5149
|
-
const feature = unwrapFeatureMember(inputXML);
|
|
5150
|
-
const geometryElement = findGeometryElement(feature);
|
|
5151
|
-
const geometry = geometryElement ? parseGMLToGeometry(
|
|
5152
|
-
{ [geometryElement.key]: geometryElement.value },
|
|
5153
|
-
options,
|
|
5154
|
-
createChildContext(feature, options, {})
|
|
5155
|
-
) : null;
|
|
5156
|
-
const properties = {};
|
|
5157
|
-
for (const [key, value] of Object.entries(feature || {})) {
|
|
5158
|
-
if (key === "attributes" || key === (geometryElement == null ? void 0 : geometryElement.propertyKey) || key.startsWith("gml:")) {
|
|
5159
|
-
continue;
|
|
5160
|
-
}
|
|
5161
|
-
const propertyName = stripNamespace(key);
|
|
5162
|
-
properties[propertyName] = extractXMLValue(value, (_a = options.propertyTypes) == null ? void 0 : _a[propertyName]);
|
|
5163
|
-
}
|
|
5164
|
-
const id = findFeatureId(feature);
|
|
5165
|
-
return { type: "Feature", id: id ? String(id) : void 0, geometry, properties };
|
|
5166
|
-
}
|
|
5167
|
-
function parseGMLToGeometry(inputXML, options, context) {
|
|
5168
|
-
const childContext = createChildContext(inputXML, options, context);
|
|
5169
|
-
let geometry = null;
|
|
5170
|
-
const [name, xml3] = getFirstKeyValue(inputXML);
|
|
5171
|
-
switch (stripNamespace(name)) {
|
|
5172
|
-
case "Point":
|
|
5173
|
-
geometry = { type: "Point", coordinates: parsePoint(xml3, options, childContext) };
|
|
5174
|
-
break;
|
|
5175
|
-
case "MultiPoint":
|
|
5176
|
-
geometry = { type: "MultiPoint", coordinates: parseMultiPoint(xml3, options, childContext) };
|
|
5177
|
-
break;
|
|
5178
|
-
case "LineString":
|
|
5179
|
-
geometry = {
|
|
5180
|
-
type: "LineString",
|
|
5181
|
-
coordinates: parseLinearRingOrLineString(xml3, options, childContext)
|
|
5182
|
-
};
|
|
5183
|
-
break;
|
|
5184
|
-
case "Curve":
|
|
5185
|
-
geometry = { type: "LineString", coordinates: parseCurve(xml3, options, childContext) };
|
|
5186
|
-
break;
|
|
5187
|
-
case "MultiLineString":
|
|
5188
|
-
case "MultiCurve":
|
|
5189
|
-
geometry = {
|
|
5190
|
-
type: "MultiLineString",
|
|
5191
|
-
coordinates: parseMultiLineString(xml3, options, childContext)
|
|
5192
|
-
};
|
|
5193
|
-
break;
|
|
5194
|
-
case "MultiPolygon":
|
|
5195
|
-
geometry = {
|
|
5196
|
-
type: "MultiPolygon",
|
|
5197
|
-
coordinates: parseMultiPolygon(xml3, options, childContext)
|
|
5198
|
-
};
|
|
5199
|
-
break;
|
|
5200
|
-
case "Polygon":
|
|
5201
|
-
case "Rectangle":
|
|
5202
|
-
geometry = {
|
|
5203
|
-
type: "Polygon",
|
|
5204
|
-
coordinates: parsePolygonOrRectangle(xml3, options, childContext)
|
|
5205
|
-
};
|
|
5206
|
-
break;
|
|
5207
|
-
case "Surface":
|
|
5208
|
-
geometry = {
|
|
5209
|
-
type: "MultiPolygon",
|
|
5210
|
-
coordinates: parseSurface(xml3, options, childContext)
|
|
5211
|
-
};
|
|
5212
|
-
break;
|
|
5213
|
-
case "MultiSurface":
|
|
5214
|
-
geometry = {
|
|
5215
|
-
type: "MultiPolygon",
|
|
5216
|
-
coordinates: parseMultiSurface(xml3, options, childContext)
|
|
5217
|
-
};
|
|
5218
|
-
break;
|
|
5219
|
-
default:
|
|
5220
|
-
return null;
|
|
5221
|
-
}
|
|
5222
|
-
return rewindGeometry(geometry);
|
|
5223
|
-
}
|
|
5224
|
-
function parseCoords(s, options, context) {
|
|
5225
|
-
var _a;
|
|
5226
|
-
const stride = context.srsDimension || options.stride || 2;
|
|
5227
|
-
const coords = s.replace(/\s+/g, " ").trim().split(" ");
|
|
5228
|
-
if (coords.length === 0 || coords.length % stride !== 0) {
|
|
5229
|
-
throw new Error(`invalid coordinates list (stride ${stride})`);
|
|
5230
|
-
}
|
|
5231
|
-
const points = [];
|
|
5232
|
-
for (let i = 0; i < coords.length - 1; i += stride) {
|
|
5233
|
-
const point = coords.slice(i, i + stride).map(parseFloat);
|
|
5234
|
-
points.push(((_a = options.transformCoords) == null ? void 0 : _a.call(options, ...point)) || point);
|
|
5235
|
-
}
|
|
5236
|
-
return points;
|
|
5237
|
-
}
|
|
5238
|
-
function parsePosList(xml3, options, context) {
|
|
5239
|
-
const childContext = createChildContext(xml3, options, context);
|
|
5240
|
-
const coords = textOf(xml3);
|
|
5241
|
-
if (!coords) {
|
|
5242
|
-
throw new Error("invalid gml:posList element");
|
|
5243
|
-
}
|
|
5244
|
-
return parseCoords(coords, options, childContext);
|
|
5245
|
-
}
|
|
5246
|
-
function parsePos(xml3, options, context) {
|
|
5247
|
-
const childContext = createChildContext(xml3, options, context);
|
|
5248
|
-
const coords = textOf(xml3);
|
|
5249
|
-
if (!coords) {
|
|
5250
|
-
throw new Error("invalid gml:pos element");
|
|
5251
|
-
}
|
|
5252
|
-
const points = parseCoords(coords, options, childContext);
|
|
5253
|
-
if (points.length !== 1) {
|
|
5254
|
-
throw new Error("gml:pos must have 1 point");
|
|
5255
|
-
}
|
|
5256
|
-
return points[0];
|
|
5257
|
-
}
|
|
5258
|
-
function parsePoint(xml3, options, context) {
|
|
5259
|
-
var _a;
|
|
5260
|
-
const childContext = createChildContext(xml3, options, context);
|
|
5261
|
-
const pos = findIn(xml3, "gml:pos");
|
|
5262
|
-
if (pos) {
|
|
5263
|
-
return parsePos(pos, options, childContext);
|
|
5264
|
-
}
|
|
5265
|
-
const coord = findIn(xml3, "gml:coord");
|
|
5266
|
-
if (coord) {
|
|
5267
|
-
const x = textOf(findIn(coord, "gml:X"));
|
|
5268
|
-
const y = textOf(findIn(coord, "gml:Y"));
|
|
5269
|
-
const z = findIn(coord, "gml:Z");
|
|
5270
|
-
const point = [x, y, ...z ? [textOf(z)] : []].map(Number);
|
|
5271
|
-
return ((_a = options.transformCoords) == null ? void 0 : _a.call(options, ...point)) || point;
|
|
5272
|
-
}
|
|
5273
|
-
const coordinates = findIn(xml3, "gml:coordinates");
|
|
5274
|
-
if (coordinates) {
|
|
5275
|
-
const points = parseLegacyCoordinates(textOf(coordinates), options, childContext);
|
|
5276
|
-
if (points.length === 1) {
|
|
5277
|
-
return points[0];
|
|
5278
|
-
}
|
|
5279
|
-
}
|
|
5280
|
-
throw new Error("invalid gml:Point element, expected gml:pos, gml:coord, or gml:coordinates");
|
|
5281
|
-
}
|
|
5282
|
-
function parseMultiPoint(xml3, options, context) {
|
|
5283
|
-
const points = [];
|
|
5284
|
-
for (const member of getMembers(xml3, ["gml:pointMember", "gml:pointMembers"])) {
|
|
5285
|
-
const point = findIn(member, "gml:Point");
|
|
5286
|
-
if (point) {
|
|
5287
|
-
points.push(parsePoint(point, options, context));
|
|
5288
|
-
}
|
|
5289
|
-
}
|
|
5290
|
-
if (points.length === 0) {
|
|
5291
|
-
throw new Error(`${xml3.name} must have > 0 points`);
|
|
5292
|
-
}
|
|
5293
|
-
return points;
|
|
5294
|
-
}
|
|
5295
|
-
function parseCurve(xml3, options, context) {
|
|
5296
|
-
const segments = findIn(xml3, "gml:segments");
|
|
5297
|
-
if (!segments) {
|
|
5298
|
-
throw new Error("gml:Curve must contain gml:segments");
|
|
5299
|
-
}
|
|
5300
|
-
return parseCurveSegments(segments, options, context);
|
|
5301
|
-
}
|
|
5302
|
-
function parseMultiLineString(xml3, options, context) {
|
|
5303
|
-
const lines = [];
|
|
5304
|
-
for (const member of getMembers(xml3, ["gml:lineStringMember", "gml:lineStringMembers", "gml:curveMember", "gml:curveMembers"])) {
|
|
5305
|
-
const lineString = findIn(member, "gml:LineString");
|
|
5306
|
-
const curve = findIn(member, "gml:Curve");
|
|
5307
|
-
if (lineString) {
|
|
5308
|
-
lines.push(parseLinearRingOrLineString(lineString, options, context));
|
|
5309
|
-
} else if (curve) {
|
|
5310
|
-
lines.push(parseCurve(curve, options, context));
|
|
5311
|
-
}
|
|
5312
|
-
}
|
|
5313
|
-
if (lines.length === 0) {
|
|
5314
|
-
throw new Error(`${xml3.name} must have > 0 line strings`);
|
|
5315
|
-
}
|
|
5316
|
-
return lines;
|
|
5317
|
-
}
|
|
5318
|
-
function parseMultiPolygon(xml3, options, context) {
|
|
5319
|
-
const polygons = [];
|
|
5320
|
-
for (const member of getMembers(xml3, ["gml:polygonMember", "gml:polygonMembers"])) {
|
|
5321
|
-
const polygon = findIn(member, "gml:Polygon");
|
|
5322
|
-
if (polygon) {
|
|
5323
|
-
polygons.push(parsePolygonOrRectangle(polygon, options, context));
|
|
5324
|
-
}
|
|
5325
|
-
}
|
|
5326
|
-
if (polygons.length === 0) {
|
|
5327
|
-
throw new Error(`${xml3.name} must have > 0 polygons`);
|
|
5328
|
-
}
|
|
5329
|
-
return polygons;
|
|
5330
|
-
}
|
|
5331
|
-
function parseLinearRingOrLineString(xml3, options, context) {
|
|
5332
|
-
const childContext = createChildContext(xml3, options, context);
|
|
5333
|
-
let points = [];
|
|
5334
|
-
const posList = findIn(xml3, "gml:posList");
|
|
5335
|
-
if (posList) {
|
|
5336
|
-
points = parsePosList(posList, options, childContext);
|
|
5337
|
-
} else {
|
|
5338
|
-
for (const [childName, childXML] of Object.entries(xml3)) {
|
|
5339
|
-
switch (stripNamespace(childName)) {
|
|
5340
|
-
case "Point":
|
|
5341
|
-
points.push(parsePoint(childXML, options, childContext));
|
|
5342
|
-
break;
|
|
5343
|
-
case "pos":
|
|
5344
|
-
points.push(parsePos(childXML, options, childContext));
|
|
5345
|
-
break;
|
|
5346
|
-
case "coord":
|
|
5347
|
-
for (const coord of Array.isArray(childXML) ? childXML : [childXML]) {
|
|
5348
|
-
points.push(parseLegacyCoord(coord, options));
|
|
5349
|
-
}
|
|
5350
|
-
break;
|
|
5351
|
-
case "coordinates":
|
|
5352
|
-
points.push(...parseLegacyCoordinates(textOf(childXML), options, childContext));
|
|
5353
|
-
break;
|
|
5354
|
-
default:
|
|
5355
|
-
continue;
|
|
5356
|
-
}
|
|
5357
|
-
}
|
|
5358
|
-
}
|
|
5359
|
-
if (points.length === 0) {
|
|
5360
|
-
throw new Error(`${xml3.name} must have > 0 points`);
|
|
5361
|
-
}
|
|
5362
|
-
return points;
|
|
5363
|
-
}
|
|
5364
|
-
function parseCurveSegments(xml3, options, context) {
|
|
5365
|
-
const points = [];
|
|
5366
|
-
for (const [childName, childXML] of Object.entries(xml3)) {
|
|
5367
|
-
switch (stripNamespace(childName)) {
|
|
5368
|
-
case "LineStringSegment":
|
|
5369
|
-
const points2 = parseLinearRingOrLineString(childXML, options, context);
|
|
5370
|
-
const end = points[points.length - 1];
|
|
5371
|
-
const start = points2[0];
|
|
5372
|
-
if (end && start && deepStrictEqual(end, start)) {
|
|
5373
|
-
points2.shift();
|
|
5374
|
-
}
|
|
5375
|
-
points.push(...points2);
|
|
5376
|
-
break;
|
|
5377
|
-
default:
|
|
5378
|
-
continue;
|
|
5379
|
-
}
|
|
5380
|
-
}
|
|
5381
|
-
if (points.length === 0) {
|
|
5382
|
-
throw new Error("gml:Curve > gml:segments must have > 0 points");
|
|
5383
|
-
}
|
|
5384
|
-
return points;
|
|
5385
|
-
}
|
|
5386
|
-
function parseRing(xml3, options, context) {
|
|
5387
|
-
const childContext = createChildContext(xml3, options, context);
|
|
5388
|
-
const points = [];
|
|
5389
|
-
for (const [childName, childXML] of Object.entries(xml3)) {
|
|
5390
|
-
switch (stripNamespace(childName)) {
|
|
5391
|
-
case "curveMember":
|
|
5392
|
-
let points2;
|
|
5393
|
-
const lineString = findIn(childXML, "gml:LineString");
|
|
5394
|
-
if (lineString) {
|
|
5395
|
-
points2 = parseLinearRingOrLineString(lineString, options, childContext);
|
|
5396
|
-
} else {
|
|
5397
|
-
const segments = findIn(childXML, "gml:Curve", "gml:segments");
|
|
5398
|
-
if (!segments) {
|
|
5399
|
-
throw new Error(`invalid ${childName} element`);
|
|
5400
|
-
}
|
|
5401
|
-
points2 = parseCurveSegments(segments, options, childContext);
|
|
5402
|
-
}
|
|
5403
|
-
const end = points[points.length - 1];
|
|
5404
|
-
const start = points2[0];
|
|
5405
|
-
if (end && start && deepStrictEqual(end, start)) {
|
|
5406
|
-
points2.shift();
|
|
5407
|
-
}
|
|
5408
|
-
points.push(...points2);
|
|
5409
|
-
break;
|
|
5410
|
-
}
|
|
5411
|
-
}
|
|
5412
|
-
if (points.length < 4) {
|
|
5413
|
-
throw new Error(`${xml3.name} must have >= 4 points`);
|
|
5414
|
-
}
|
|
5415
|
-
return points;
|
|
5416
|
-
}
|
|
5417
|
-
function parseExteriorOrInterior(xml3, options, context) {
|
|
5418
|
-
const linearRing = findIn(xml3, "gml:LinearRing");
|
|
5419
|
-
if (linearRing) {
|
|
5420
|
-
return parseLinearRingOrLineString(linearRing, options, context);
|
|
5421
|
-
}
|
|
5422
|
-
const ring = findIn(xml3, "gml:Ring");
|
|
5423
|
-
if (!ring) {
|
|
5424
|
-
throw new Error(`invalid ${xml3.name} element`);
|
|
5425
|
-
}
|
|
5426
|
-
return parseRing(ring, options, context);
|
|
5427
|
-
}
|
|
5428
|
-
function parsePolygonOrRectangle(xml3, options, context) {
|
|
5429
|
-
const childContext = createChildContext(xml3, options, context);
|
|
5430
|
-
const exterior = findIn(xml3, "gml:exterior");
|
|
5431
|
-
if (!exterior) {
|
|
5432
|
-
throw new Error(`invalid ${xml3.name} element`);
|
|
5433
|
-
}
|
|
5434
|
-
const pointLists = [parseExteriorOrInterior(exterior, options, childContext)];
|
|
5435
|
-
const interiors = Object.entries(xml3 || {}).filter(([key]) => stripNamespace(key) === "interior").flatMap(([, value]) => Array.isArray(value) ? value : [value]);
|
|
5436
|
-
for (const interior of interiors) {
|
|
5437
|
-
pointLists.push(parseExteriorOrInterior(interior, options, childContext));
|
|
5438
|
-
}
|
|
5439
|
-
return pointLists;
|
|
5440
|
-
}
|
|
5441
|
-
function parseSurface(xml3, options, context) {
|
|
5442
|
-
const childContext = createChildContext(xml3, options, context);
|
|
5443
|
-
const patches = findIn(xml3, "gml:patches");
|
|
5444
|
-
if (!patches) {
|
|
5445
|
-
throw new Error(`invalid ${xml3.name} element`);
|
|
5446
|
-
}
|
|
5447
|
-
const polygons = [];
|
|
5448
|
-
for (const [childName, childXML] of Object.entries(patches)) {
|
|
5449
|
-
switch (stripNamespace(childName)) {
|
|
5450
|
-
case "PolygonPatch":
|
|
5451
|
-
case "Rectangle":
|
|
5452
|
-
polygons.push(parsePolygonOrRectangle(childXML, options, childContext));
|
|
5453
|
-
break;
|
|
5454
|
-
default:
|
|
5455
|
-
continue;
|
|
5456
|
-
}
|
|
5457
|
-
}
|
|
5458
|
-
if (polygons.length === 0) {
|
|
5459
|
-
throw new Error(`${xml3.name} must have > 0 polygons`);
|
|
5460
|
-
}
|
|
5461
|
-
return polygons;
|
|
5462
|
-
}
|
|
5463
|
-
function parseCompositeSurface(xml3, options, context) {
|
|
5464
|
-
const childContext = createChildContext(xml3, options, context);
|
|
5465
|
-
const polygons = [];
|
|
5466
|
-
for (const [childName, childXML] of Object.entries(xml3)) {
|
|
5467
|
-
switch (stripNamespace(childName)) {
|
|
5468
|
-
case "surfaceMember":
|
|
5469
|
-
case "surfaceMembers":
|
|
5470
|
-
const [c2Name, c2Xml] = getFirstKeyValue(childXML);
|
|
5471
|
-
switch (stripNamespace(c2Name)) {
|
|
5472
|
-
case "Surface":
|
|
5473
|
-
polygons.push(...parseSurface(c2Xml, options, childContext));
|
|
5474
|
-
break;
|
|
5475
|
-
case "Polygon":
|
|
5476
|
-
polygons.push(parsePolygonOrRectangle(c2Xml, options, childContext));
|
|
5477
|
-
break;
|
|
5478
|
-
}
|
|
5479
|
-
break;
|
|
5480
|
-
}
|
|
5481
|
-
}
|
|
5482
|
-
if (polygons.length === 0) {
|
|
5483
|
-
throw new Error(`${xml3.name} must have > 0 polygons`);
|
|
5484
|
-
}
|
|
5485
|
-
return polygons;
|
|
5486
|
-
}
|
|
5487
|
-
function parseMultiSurface(xml3, options, context) {
|
|
5488
|
-
const polygons = [];
|
|
5489
|
-
for (const member of getMembers(xml3, ["gml:surfaceMember", "gml:surfaceMembers"])) {
|
|
5490
|
-
const polygon = findIn(member, "gml:Polygon");
|
|
5491
|
-
const surface = findIn(member, "gml:Surface");
|
|
5492
|
-
const compositeSurface = findIn(member, "gml:CompositeSurface");
|
|
5493
|
-
if (polygon) {
|
|
5494
|
-
polygons.push(parsePolygonOrRectangle(polygon, options, context));
|
|
5495
|
-
} else if (surface) {
|
|
5496
|
-
polygons.push(...parseSurface(surface, options, context));
|
|
5497
|
-
} else if (compositeSurface) {
|
|
5498
|
-
polygons.push(...parseCompositeSurface(compositeSurface, options, context));
|
|
5499
|
-
}
|
|
5500
|
-
}
|
|
5501
|
-
if (polygons.length === 0) {
|
|
5502
|
-
throw new Error(`${xml3.name} must have > 0 polygons`);
|
|
5503
|
-
}
|
|
5504
|
-
return polygons;
|
|
5505
|
-
}
|
|
5506
|
-
function findFeatureMembers(root) {
|
|
5507
|
-
if (!root || typeof root !== "object") return [];
|
|
5508
|
-
for (const [key, value] of Object.entries(root)) {
|
|
5509
|
-
if (stripNamespace(key) === "featureMember" || stripNamespace(key) === "member") {
|
|
5510
|
-
return Array.isArray(value) ? value : [value];
|
|
5511
|
-
}
|
|
5512
|
-
if (stripNamespace(key) === "featureMembers") {
|
|
5513
|
-
const members = [];
|
|
5514
|
-
for (const member of Array.isArray(value) ? value : [value]) {
|
|
5515
|
-
for (const [featureKey, featureValue] of Object.entries(member || {})) {
|
|
5516
|
-
if (featureKey !== "attributes") {
|
|
5517
|
-
for (const item of Array.isArray(featureValue) ? featureValue : [featureValue]) {
|
|
5518
|
-
members.push({ [featureKey]: item });
|
|
5519
|
-
}
|
|
5520
|
-
}
|
|
5521
|
-
}
|
|
5522
|
-
}
|
|
5523
|
-
return members;
|
|
5524
|
-
}
|
|
5525
|
-
if (key !== "attributes" && value && typeof value === "object") {
|
|
5526
|
-
const nested = findFeatureMembers(Array.isArray(value) ? value[0] : value);
|
|
5527
|
-
if (nested.length) return nested;
|
|
5528
|
-
}
|
|
5529
|
-
}
|
|
5530
|
-
return [];
|
|
5531
|
-
}
|
|
5532
|
-
function unwrapFeatureMember(member) {
|
|
5533
|
-
if (!member || typeof member !== "object") return {};
|
|
5534
|
-
const entries = Object.entries(member).filter(([key]) => key !== "attributes");
|
|
5535
|
-
return entries.length === 1 && !stripNamespace(entries[0][0]).startsWith("gml:") ? entries[0][1] : member;
|
|
5536
|
-
}
|
|
5537
|
-
function findGeometryElement(feature, propertyKey) {
|
|
5538
|
-
if (!feature || typeof feature !== "object") return null;
|
|
5539
|
-
for (const [key, value] of Object.entries(feature)) {
|
|
5540
|
-
if (GEOMETRY_NAMES.has(stripNamespace(key))) {
|
|
5541
|
-
return {
|
|
5542
|
-
key,
|
|
5543
|
-
value: Array.isArray(value) ? value[0] : value,
|
|
5544
|
-
propertyKey: propertyKey || key
|
|
5545
|
-
};
|
|
5546
|
-
}
|
|
5547
|
-
if (key !== "attributes" && value && typeof value === "object") {
|
|
5548
|
-
const nested = findGeometryElement(Array.isArray(value) ? value[0] : value, propertyKey || key);
|
|
5549
|
-
if (nested) return nested;
|
|
5550
|
-
}
|
|
5551
|
-
}
|
|
5552
|
-
return null;
|
|
5553
|
-
}
|
|
5554
|
-
function stripNamespace(key) {
|
|
5555
|
-
return key.includes(":") ? key.slice(key.indexOf(":") + 1) : key;
|
|
5556
|
-
}
|
|
5557
|
-
function extractXMLValue(value, propertyType) {
|
|
5558
|
-
if (Array.isArray(value)) return value.map((item) => extractXMLValue(item, propertyType));
|
|
5559
|
-
if (value && typeof value === "object") {
|
|
5560
|
-
if ("value" in value) return extractXMLValue(value.value, propertyType);
|
|
5561
|
-
if ("#text" in value) return extractXMLValue(value["#text"], propertyType);
|
|
5562
|
-
}
|
|
5563
|
-
if (propertyType === "boolean") return value === true || value === "true" || value === "1";
|
|
5564
|
-
if (propertyType === "integer") return Number.parseInt(String(value), 10);
|
|
5565
|
-
if (propertyType === "number") return Number(value);
|
|
5566
|
-
if (propertyType === "date" || propertyType === "date-time") return String(value);
|
|
5567
|
-
return value;
|
|
5568
|
-
}
|
|
5569
|
-
function findFeatureId(value) {
|
|
5570
|
-
var _a, _b;
|
|
5571
|
-
if (!value || typeof value !== "object") return void 0;
|
|
5572
|
-
const directId = value.id || value["gml:id"] || value.fid || ((_a = Object.entries(value).find(([key]) => stripNamespace(key) === "id")) == null ? void 0 : _a[1]);
|
|
5573
|
-
if (directId !== void 0 && typeof directId !== "object") return String(directId);
|
|
5574
|
-
const attributes = value.attributes;
|
|
5575
|
-
if (attributes) {
|
|
5576
|
-
const id = attributes.id || attributes["gml:id"] || attributes.fid || ((_b = Object.entries(attributes).find(([key]) => stripNamespace(key) === "id")) == null ? void 0 : _b[1]);
|
|
5577
|
-
if (id !== void 0) return String(id);
|
|
5578
|
-
}
|
|
5579
|
-
return void 0;
|
|
5580
|
-
}
|
|
5581
|
-
function textOf(el) {
|
|
5582
|
-
if (typeof el === "number") {
|
|
5583
|
-
return String(el);
|
|
5584
|
-
}
|
|
5585
|
-
if (el && typeof el === "object" && "value" in el) {
|
|
5586
|
-
return textOf(el.value);
|
|
5587
|
-
}
|
|
5588
|
-
if (typeof el !== "string") {
|
|
5589
|
-
throw new Error("expected string");
|
|
5590
|
-
}
|
|
5591
|
-
return el;
|
|
5592
|
-
}
|
|
5593
|
-
function findIn(root, ...tags) {
|
|
5594
|
-
var _a;
|
|
5595
|
-
let el = root;
|
|
5596
|
-
for (const tag of tags) {
|
|
5597
|
-
const child = (_a = Object.entries(el || {}).find(
|
|
5598
|
-
([key]) => key === tag || stripNamespace(key) === stripNamespace(tag)
|
|
5599
|
-
)) == null ? void 0 : _a[1];
|
|
5600
|
-
if (!child) {
|
|
5601
|
-
return null;
|
|
5602
|
-
}
|
|
5603
|
-
el = child;
|
|
5604
|
-
}
|
|
5605
|
-
return el;
|
|
5606
|
-
}
|
|
5607
|
-
function getFirstKeyValue(object) {
|
|
5608
|
-
if (object && typeof object === "object") {
|
|
5609
|
-
for (const [key, value] of Object.entries(object)) {
|
|
5610
|
-
return [key, value];
|
|
5611
|
-
}
|
|
5612
|
-
}
|
|
5613
|
-
return ["", null];
|
|
5614
|
-
}
|
|
5615
|
-
function getMembers(root, names) {
|
|
5616
|
-
var _a;
|
|
5617
|
-
const members = [];
|
|
5618
|
-
for (const name of names) {
|
|
5619
|
-
const value = (_a = Object.entries(root || {}).find(
|
|
5620
|
-
([key]) => key === name || stripNamespace(key) === stripNamespace(name)
|
|
5621
|
-
)) == null ? void 0 : _a[1];
|
|
5622
|
-
if (!value) {
|
|
5623
|
-
continue;
|
|
5624
|
-
}
|
|
5625
|
-
if (name.endsWith("Members")) {
|
|
5626
|
-
if (Array.isArray(value)) {
|
|
5627
|
-
members.push(...value);
|
|
5628
|
-
continue;
|
|
5629
|
-
}
|
|
5630
|
-
for (const [memberName, memberValue] of Object.entries(value)) {
|
|
5631
|
-
if (memberName !== "attributes") {
|
|
5632
|
-
for (const item of Array.isArray(memberValue) ? memberValue : [memberValue]) {
|
|
5633
|
-
members.push({ [memberName]: item });
|
|
5634
|
-
}
|
|
5635
|
-
}
|
|
5636
|
-
}
|
|
5637
|
-
} else if (Array.isArray(value)) {
|
|
5638
|
-
members.push(...value);
|
|
5639
|
-
} else if (value) {
|
|
5640
|
-
members.push(value);
|
|
5641
|
-
}
|
|
5642
|
-
}
|
|
5643
|
-
return members;
|
|
5644
|
-
}
|
|
5645
|
-
function parseLegacyCoord(xml3, options) {
|
|
5646
|
-
var _a;
|
|
5647
|
-
const x = Number(textOf(findIn(xml3, "gml:X")));
|
|
5648
|
-
const y = Number(textOf(findIn(xml3, "gml:Y")));
|
|
5649
|
-
const z = findIn(xml3, "gml:Z");
|
|
5650
|
-
const point = [x, y, ...z ? [Number(textOf(z))] : []];
|
|
5651
|
-
return ((_a = options.transformCoords) == null ? void 0 : _a.call(options, ...point)) || point;
|
|
5652
|
-
}
|
|
5653
|
-
function parseLegacyCoordinates(text2, options, context) {
|
|
5654
|
-
const coordinatePairs = text2.trim().split(/\s+/).filter(Boolean);
|
|
5655
|
-
return coordinatePairs.map((coordinatePair) => {
|
|
5656
|
-
var _a;
|
|
5657
|
-
const point = coordinatePair.split(",").map(Number);
|
|
5658
|
-
const stride = context.srsDimension || options.stride || 2;
|
|
5659
|
-
if (point.length !== stride || point.some(Number.isNaN)) {
|
|
5660
|
-
throw new Error(`invalid GML 2 coordinates list (stride ${stride})`);
|
|
5661
|
-
}
|
|
5662
|
-
return ((_a = options.transformCoords) == null ? void 0 : _a.call(options, ...point)) || point;
|
|
5663
|
-
});
|
|
5664
|
-
}
|
|
5665
|
-
function createChildContext(xml3, options, context) {
|
|
5666
|
-
var _a;
|
|
5667
|
-
const attributes = (xml3 == null ? void 0 : xml3.attributes) || xml3 || {};
|
|
5668
|
-
const srsDimensionAttribute = attributes.srsDimension || attributes["@_srsDimension"] || ((_a = Object.entries(attributes).find(([key]) => stripNamespace(key).toLowerCase() === "srsdimension")) == null ? void 0 : _a[1]);
|
|
5669
|
-
if (srsDimensionAttribute) {
|
|
5670
|
-
const srsDimension = parseInt(srsDimensionAttribute);
|
|
5671
|
-
if (Number.isNaN(srsDimension) || srsDimension <= 0) {
|
|
5672
|
-
throw new Error(
|
|
5673
|
-
`invalid srsDimension attribute value "${srsDimensionAttribute}", expected a positive integer`
|
|
5674
|
-
);
|
|
5675
|
-
}
|
|
5676
|
-
const childContext = Object.create(context);
|
|
5677
|
-
childContext.srsDimension = srsDimension;
|
|
5678
|
-
return childContext;
|
|
5679
|
-
}
|
|
5680
|
-
return context;
|
|
5681
|
-
}
|
|
5682
|
-
var GEOMETRY_NAMES;
|
|
5683
|
-
var init_parse_gml = __esm({
|
|
5684
|
-
"src/wms/lib/parsers/gml/parse-gml.ts"() {
|
|
5685
|
-
"use strict";
|
|
5686
|
-
init_deep_strict_equal();
|
|
5687
|
-
init_parse_xml_text2();
|
|
5688
|
-
init_rewind_geometry();
|
|
5689
|
-
GEOMETRY_NAMES = /* @__PURE__ */ new Set([
|
|
5690
|
-
"Point",
|
|
5691
|
-
"MultiPoint",
|
|
5692
|
-
"LineString",
|
|
5693
|
-
"Curve",
|
|
5694
|
-
"MultiLineString",
|
|
5695
|
-
"MultiCurve",
|
|
5696
|
-
"Polygon",
|
|
5697
|
-
"Rectangle",
|
|
5698
|
-
"Surface",
|
|
5699
|
-
"MultiPolygon",
|
|
5700
|
-
"MultiSurface"
|
|
5701
|
-
]);
|
|
5702
|
-
}
|
|
5703
|
-
});
|
|
5704
|
-
|
|
5705
|
-
// src/wms/gml-loader-types.ts
|
|
5706
|
-
async function preload8() {
|
|
5707
|
-
const { GMLLoaderWithParser: GMLLoaderWithParser2 } = await Promise.resolve().then(() => (init_gml_loader(), gml_loader_exports));
|
|
5708
|
-
return GMLLoaderWithParser2;
|
|
5709
|
-
}
|
|
5710
|
-
function testXMLFile8(text2) {
|
|
5711
|
-
return text2.startsWith("<?xml");
|
|
5712
|
-
}
|
|
5713
|
-
var VERSION8, GMLLoader;
|
|
5714
|
-
var init_gml_loader_types = __esm({
|
|
5715
|
-
"src/wms/gml-loader-types.ts"() {
|
|
5716
|
-
"use strict";
|
|
5717
|
-
init_wms_format2();
|
|
5718
|
-
VERSION8 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
5719
|
-
GMLLoader = {
|
|
5720
|
-
...GMLFormat2,
|
|
5721
|
-
dataType: null,
|
|
5722
|
-
batchType: null,
|
|
5723
|
-
name: "GML",
|
|
5724
|
-
id: "gml",
|
|
5725
|
-
module: "ogc",
|
|
5726
|
-
version: VERSION8,
|
|
5727
|
-
worker: false,
|
|
5728
|
-
encoding: "xml",
|
|
5729
|
-
format: "gml",
|
|
5730
|
-
text: true,
|
|
5731
|
-
extensions: ["xml"],
|
|
5732
|
-
mimeTypes: ["application/vnd.ogc.gml", "application/xml", "text/xml"],
|
|
5733
|
-
testText: testXMLFile8,
|
|
5734
|
-
options: {
|
|
5735
|
-
gml: { shape: "arrow-table" }
|
|
5736
|
-
},
|
|
5737
|
-
preload: preload8
|
|
5738
|
-
};
|
|
5739
|
-
}
|
|
5740
|
-
});
|
|
5741
|
-
|
|
5742
|
-
// src/wms/gml-loader.ts
|
|
5743
|
-
var gml_loader_exports = {};
|
|
5744
|
-
__export(gml_loader_exports, {
|
|
5745
|
-
GMLLoaderWithParser: () => GMLLoaderWithParser
|
|
5746
|
-
});
|
|
5747
|
-
function parseGMLText(text2, options) {
|
|
5748
|
-
var _a;
|
|
5749
|
-
const result = parseGML(text2, { ...options, ...options == null ? void 0 : options.gml });
|
|
5750
|
-
if (((_a = options == null ? void 0 : options.gml) == null ? void 0 : _a.shape) === "geojson") return result;
|
|
5751
|
-
const features = (result == null ? void 0 : result.type) === "FeatureCollection" ? result.features : result ? [{ type: "Feature", geometry: result, properties: {} }] : [];
|
|
5752
|
-
return makeGMLArrowTable(features);
|
|
5753
|
-
}
|
|
5754
|
-
function makeGMLArrowTable(features) {
|
|
5755
|
-
const hasFeatureIds = features.some((feature) => feature.id !== void 0);
|
|
5756
|
-
for (const feature of features) {
|
|
5757
|
-
if (Object.hasOwn(feature.properties, "geometry") || hasFeatureIds && Object.hasOwn(feature.properties, "id")) {
|
|
5758
|
-
throw new Error(
|
|
5759
|
-
'GMLLoader: property collides with an Arrow geometry or id column; use gml.shape: "geojson" to preserve both'
|
|
5760
|
-
);
|
|
5761
|
-
}
|
|
5762
|
-
}
|
|
5763
|
-
const table = convertFeaturesToWKBArrowTable(features);
|
|
5764
|
-
const geoMetadata = getGeoMetadata(table.data.schema.metadata);
|
|
5765
|
-
geoMetadata.columns.geometry.crs = null;
|
|
5766
|
-
setGeoMetadata(table.data.schema.metadata, geoMetadata);
|
|
5767
|
-
const geometryField = table.data.schema.fields.find((field) => field.name === "geometry");
|
|
5768
|
-
geometryField == null ? void 0 : geometryField.metadata.set("ARROW:extension:metadata", JSON.stringify({ crs: null }));
|
|
5769
|
-
if (table.schema) {
|
|
5770
|
-
table.schema.metadata = Object.fromEntries(table.data.schema.metadata);
|
|
5771
|
-
const field = table.schema.fields.find((field2) => field2.name === "geometry");
|
|
5772
|
-
if (field) field.metadata = Object.fromEntries(geometryField.metadata);
|
|
5773
|
-
}
|
|
5774
|
-
return table;
|
|
5775
|
-
}
|
|
5776
|
-
async function* parseGMLInRequestedShape(iterator, options) {
|
|
5777
|
-
var _a;
|
|
5778
|
-
for await (const collection of parseGMLInBatches(iterator, options)) {
|
|
5779
|
-
if (((_a = options == null ? void 0 : options.gml) == null ? void 0 : _a.shape) === "geojson") {
|
|
5780
|
-
yield collection;
|
|
5781
|
-
} else {
|
|
5782
|
-
const table = makeGMLArrowTable(collection.features);
|
|
5783
|
-
yield makeTableScanBatch(table);
|
|
5784
|
-
}
|
|
5785
|
-
}
|
|
5786
|
-
}
|
|
5787
|
-
async function* parseGMLInBatches(iterator, options) {
|
|
5788
|
-
var _a;
|
|
5789
|
-
const decoder = new TextDecoder();
|
|
5790
|
-
const parser = new GMLFeatureStreamParser();
|
|
5791
|
-
let features = [];
|
|
5792
|
-
const batchSize = ((_a = options == null ? void 0 : options.gml) == null ? void 0 : _a.batchSize) || 1e3;
|
|
5793
|
-
for await (const chunk of iterator) {
|
|
5794
|
-
const fragments = parser.push(
|
|
5795
|
-
decoder.decode(chunk instanceof ArrayBuffer ? new Uint8Array(chunk) : chunk, {
|
|
5796
|
-
stream: true
|
|
5797
|
-
})
|
|
5798
|
-
);
|
|
5799
|
-
for (const fragment of fragments) {
|
|
5800
|
-
const parsed = parseGMLFeatureFragment(fragment, { ...options, ...options == null ? void 0 : options.gml });
|
|
5801
|
-
if (parsed && parsed.type === "FeatureCollection") features.push(...parsed.features);
|
|
5802
|
-
if (features.length >= batchSize) {
|
|
5803
|
-
yield { type: "FeatureCollection", features: features.splice(0, batchSize) };
|
|
5804
|
-
}
|
|
5805
|
-
}
|
|
5806
|
-
}
|
|
5807
|
-
for (const fragment of parser.finish(decoder.decode())) {
|
|
5808
|
-
const parsed = parseGMLFeatureFragment(fragment, { ...options, ...options == null ? void 0 : options.gml });
|
|
5809
|
-
if (parsed && parsed.type === "FeatureCollection") features.push(...parsed.features);
|
|
5810
|
-
}
|
|
5811
|
-
if (features.length) yield { type: "FeatureCollection", features };
|
|
5812
|
-
}
|
|
5813
|
-
function parseGMLFeatureFragment(fragment, options) {
|
|
5814
|
-
return fragment.match(/<[^/!?][^>]*featureMember\b/i) ? parseGML(fragment, options) : parseGML(`<gml:featureMember>${fragment}</gml:featureMember>`, options);
|
|
5815
|
-
}
|
|
5816
|
-
var _GMLLoaderPreload, GMLLoaderMetadataWithoutPreload, GMLLoaderWithParser, GMLFeatureStreamParser;
|
|
5817
|
-
var init_gml_loader = __esm({
|
|
5818
|
-
"src/wms/gml-loader.ts"() {
|
|
5819
|
-
"use strict";
|
|
5820
|
-
init_loader_utils();
|
|
5821
|
-
init_feature_collection_to_arrow();
|
|
5822
|
-
init_schema();
|
|
5823
|
-
init_parse_gml();
|
|
5824
|
-
init_gml_loader_types();
|
|
5825
|
-
({ preload: _GMLLoaderPreload, ...GMLLoaderMetadataWithoutPreload } = GMLLoader);
|
|
5826
|
-
GMLLoaderWithParser = {
|
|
5827
|
-
...GMLLoaderMetadataWithoutPreload,
|
|
5828
|
-
parse: async (arrayBuffer, options) => parseGMLText(new TextDecoder().decode(arrayBuffer), options),
|
|
5829
|
-
parseTextSync: parseGMLText,
|
|
5830
|
-
parseInBatches: parseGMLInRequestedShape
|
|
5831
|
-
};
|
|
5832
|
-
GMLFeatureStreamParser = class {
|
|
5833
|
-
_text = "";
|
|
5834
|
-
_insideFeatureMembers = false;
|
|
5835
|
-
_featureMemberStart = -1;
|
|
5836
|
-
_featureMemberDepth = 0;
|
|
5837
|
-
_featureStart = -1;
|
|
5838
|
-
_featureDepth = 0;
|
|
5839
|
-
push(text2) {
|
|
5840
|
-
this._text += text2;
|
|
5841
|
-
return this._scan(false);
|
|
5842
|
-
}
|
|
5843
|
-
finish(text2) {
|
|
5844
|
-
this._text += text2;
|
|
5845
|
-
return this._scan(true);
|
|
5846
|
-
}
|
|
5847
|
-
_scan(isFinal) {
|
|
5848
|
-
const fragments = [];
|
|
5849
|
-
const tokenPattern = /<!--[\s\S]*?-->|<\?[\s\S]*?\?>|<\/?\s*([A-Za-z_][\w.-]*(?::[A-Za-z_][\w.-]*)?)\b[^>]*?>/g;
|
|
5850
|
-
let consumedTextLength = 0;
|
|
5851
|
-
let match = tokenPattern.exec(this._text);
|
|
5852
|
-
while (match) {
|
|
5853
|
-
const token = match[0];
|
|
5854
|
-
if (token.startsWith("<!--") || token.startsWith("<?")) {
|
|
5855
|
-
match = tokenPattern.exec(this._text);
|
|
5856
|
-
continue;
|
|
5857
|
-
}
|
|
5858
|
-
const localName = match[1].split(":").pop();
|
|
5859
|
-
const isClosing = token.startsWith("</");
|
|
5860
|
-
const isSelfClosing = /\/\s*>$/.test(token);
|
|
5861
|
-
if (!isClosing && localName === "featureMember") {
|
|
5862
|
-
this._featureMemberStart = match.index;
|
|
5863
|
-
this._featureMemberDepth = isSelfClosing ? 0 : 1;
|
|
5864
|
-
if (isSelfClosing) {
|
|
5865
|
-
fragments.push(this._text.slice(this._featureMemberStart, tokenPattern.lastIndex));
|
|
5866
|
-
consumedTextLength = tokenPattern.lastIndex;
|
|
5867
|
-
this._featureMemberStart = -1;
|
|
5868
|
-
}
|
|
5869
|
-
match = tokenPattern.exec(this._text);
|
|
5870
|
-
continue;
|
|
5871
|
-
}
|
|
5872
|
-
if (this._featureMemberDepth > 0) {
|
|
5873
|
-
if (!isClosing && !isSelfClosing) this._featureMemberDepth++;
|
|
5874
|
-
if (isClosing) this._featureMemberDepth--;
|
|
5875
|
-
if (this._featureMemberDepth === 0) {
|
|
5876
|
-
fragments.push(this._text.slice(this._featureMemberStart, tokenPattern.lastIndex));
|
|
5877
|
-
consumedTextLength = tokenPattern.lastIndex;
|
|
5878
|
-
this._featureMemberStart = -1;
|
|
5879
|
-
}
|
|
5880
|
-
match = tokenPattern.exec(this._text);
|
|
5881
|
-
continue;
|
|
5882
|
-
}
|
|
5883
|
-
if (!isClosing && localName === "featureMembers") {
|
|
5884
|
-
this._insideFeatureMembers = true;
|
|
5885
|
-
match = tokenPattern.exec(this._text);
|
|
5886
|
-
continue;
|
|
5887
|
-
}
|
|
5888
|
-
if (this._insideFeatureMembers && this._featureDepth === 0 && !isClosing && localName !== "featureMembers") {
|
|
5889
|
-
this._featureStart = match.index;
|
|
5890
|
-
this._featureDepth = isSelfClosing ? 0 : 1;
|
|
5891
|
-
if (isSelfClosing) {
|
|
5892
|
-
fragments.push(this._text.slice(this._featureStart, tokenPattern.lastIndex));
|
|
5893
|
-
consumedTextLength = tokenPattern.lastIndex;
|
|
5894
|
-
this._featureStart = -1;
|
|
5895
|
-
}
|
|
5896
|
-
match = tokenPattern.exec(this._text);
|
|
5897
|
-
continue;
|
|
5898
|
-
}
|
|
5899
|
-
if (this._featureDepth > 0) {
|
|
5900
|
-
if (!isClosing && !isSelfClosing) this._featureDepth++;
|
|
5901
|
-
if (isClosing) this._featureDepth--;
|
|
5902
|
-
if (this._featureDepth === 0) {
|
|
5903
|
-
fragments.push(this._text.slice(this._featureStart, tokenPattern.lastIndex));
|
|
5904
|
-
consumedTextLength = tokenPattern.lastIndex;
|
|
5905
|
-
this._featureStart = -1;
|
|
5906
|
-
}
|
|
5907
|
-
}
|
|
5908
|
-
if (isClosing && localName === "featureMembers") this._insideFeatureMembers = false;
|
|
5909
|
-
match = tokenPattern.exec(this._text);
|
|
5910
|
-
}
|
|
5911
|
-
if (consumedTextLength > 0) {
|
|
5912
|
-
this._text = this._text.slice(consumedTextLength);
|
|
5913
|
-
} else if (isFinal && this._text.trim()) {
|
|
5914
|
-
this._text = "";
|
|
5915
|
-
}
|
|
5916
|
-
return fragments;
|
|
5917
|
-
}
|
|
5918
|
-
};
|
|
5919
|
-
}
|
|
5920
|
-
});
|
|
5921
|
-
|
|
5922
|
-
// dist/wms/unbundled.js
|
|
5923
|
-
var unbundled_exports = {};
|
|
5924
|
-
__export(unbundled_exports, {
|
|
5925
|
-
CSWCapabilitiesLoader: () => CSWCapabilitiesLoader,
|
|
5926
|
-
CSWDomainLoader: () => CSWDomainLoader,
|
|
5927
|
-
CSWRecordsLoader: () => CSWRecordsLoader,
|
|
5928
|
-
GMLLoader: () => GMLLoader2,
|
|
5929
|
-
WMSCapabilitiesLoader: () => WMSCapabilitiesLoader,
|
|
5930
|
-
WMSErrorLoader: () => WMSErrorLoader,
|
|
5931
|
-
WMTSCapabilitiesLoader: () => WMTSCapabilitiesLoader2,
|
|
5932
|
-
_GMLLoader: () => GMLLoader2,
|
|
5933
|
-
_WFSCapabilitiesLoader: () => WFSCapabilitiesLoader
|
|
5934
|
-
});
|
|
5935
|
-
module.exports = __toCommonJS(unbundled_exports);
|
|
5936
|
-
init_csw_capabilities_loader();
|
|
5937
|
-
init_csw_domain_loader();
|
|
5938
|
-
init_csw_records_loader();
|
|
5939
|
-
init_wms_error_loader();
|
|
5940
|
-
|
|
5941
|
-
// dist/wms/wmts-capabilities-loader.js
|
|
5942
|
-
init_wms_format();
|
|
5943
|
-
var WMTSCapabilitiesLoader2 = {
|
|
5944
|
-
...WMTSCapabilitiesFormat,
|
|
5945
|
-
dataType: null,
|
|
5946
|
-
batchType: null,
|
|
5947
|
-
name: "WMTS Capabilities",
|
|
5948
|
-
id: "wmts-capabilities",
|
|
5949
|
-
module: "ogc",
|
|
5950
|
-
version: "0.0.0",
|
|
5951
|
-
worker: false,
|
|
5952
|
-
encoding: "xml",
|
|
5953
|
-
format: "wmts-capabilities",
|
|
5954
|
-
text: true,
|
|
5955
|
-
extensions: ["xml"],
|
|
5956
|
-
mimeTypes: ["application/vnd.ogc.wmts_xml", "application/xml", "text/xml"],
|
|
5957
|
-
options: { wmts: {} },
|
|
5958
|
-
preload: async () => (await Promise.resolve().then(() => (init_wmts_capabilities_loader_with_parser(), wmts_capabilities_loader_with_parser_exports))).WMTSCapabilitiesLoaderWithParser
|
|
5959
|
-
};
|
|
5960
|
-
|
|
5961
|
-
// dist/wms/unbundled.js
|
|
5962
|
-
init_wms_capabilities_loader();
|
|
5963
|
-
init_wfs_capabilities_loader();
|
|
5964
|
-
|
|
5965
|
-
// dist/wms/gml-loader-types.js
|
|
5966
|
-
init_wms_format();
|
|
5967
|
-
var VERSION9 = true ? "5.0.0-beta.1" : "latest";
|
|
5968
|
-
async function preload9() {
|
|
5969
|
-
const { GMLLoaderWithParser: GMLLoaderWithParser2 } = await Promise.resolve().then(() => (init_gml_loader(), gml_loader_exports));
|
|
5970
|
-
return GMLLoaderWithParser2;
|
|
5971
|
-
}
|
|
5972
|
-
var GMLLoader2 = {
|
|
2955
|
+
var GMLLoader = {
|
|
5973
2956
|
...GMLFormat,
|
|
5974
2957
|
dataType: null,
|
|
5975
2958
|
batchType: null,
|
|
5976
2959
|
name: "GML",
|
|
5977
2960
|
id: "gml",
|
|
5978
2961
|
module: "ogc",
|
|
5979
|
-
version:
|
|
2962
|
+
version: VERSION8,
|
|
5980
2963
|
worker: false,
|
|
5981
2964
|
encoding: "xml",
|
|
5982
2965
|
format: "gml",
|
|
5983
2966
|
text: true,
|
|
5984
2967
|
extensions: ["xml"],
|
|
5985
2968
|
mimeTypes: ["application/vnd.ogc.gml", "application/xml", "text/xml"],
|
|
5986
|
-
testText:
|
|
2969
|
+
testText: testXMLFile8,
|
|
5987
2970
|
options: {
|
|
5988
2971
|
gml: { shape: "arrow-table" }
|
|
5989
2972
|
},
|
|
5990
|
-
preload:
|
|
2973
|
+
preload: preload8
|
|
5991
2974
|
};
|
|
5992
|
-
function
|
|
2975
|
+
function testXMLFile8(text2) {
|
|
5993
2976
|
return text2.startsWith("<?xml");
|
|
5994
2977
|
}
|
|
5995
2978
|
//# sourceMappingURL=unbundled.cjs.map
|