@tmcw/togeojson 6.0.0-0 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -2
- package/dist/togeojson.cjs +153 -155
- package/dist/togeojson.cjs.map +1 -1
- package/dist/togeojson.es.mjs +153 -153
- package/dist/togeojson.es.mjs.map +1 -1
- package/dist/togeojson.umd.js +1 -1
- package/dist/togeojson.umd.js.map +1 -1
- package/package.json +24 -25
- package/CHANGELOG.md +0 -432
package/dist/togeojson.es.mjs
CHANGED
|
@@ -12,7 +12,7 @@ function $ns(element, tagName, ns) {
|
|
|
12
12
|
*/
|
|
13
13
|
function nodeVal(node) {
|
|
14
14
|
node?.normalize();
|
|
15
|
-
return
|
|
15
|
+
return node?.textContent || "";
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* Get one Y child of X, if any, otherwise null
|
|
@@ -42,16 +42,16 @@ function val1(node, tagName, callback) {
|
|
|
42
42
|
return {};
|
|
43
43
|
}
|
|
44
44
|
function $num(node, tagName, callback) {
|
|
45
|
-
const val = parseFloat(nodeVal(get1(node, tagName)));
|
|
46
|
-
if (isNaN(val))
|
|
45
|
+
const val = Number.parseFloat(nodeVal(get1(node, tagName)));
|
|
46
|
+
if (Number.isNaN(val))
|
|
47
47
|
return undefined;
|
|
48
48
|
if (val && callback)
|
|
49
49
|
return callback(val) || {};
|
|
50
50
|
return {};
|
|
51
51
|
}
|
|
52
52
|
function num1(node, tagName, callback) {
|
|
53
|
-
const val = parseFloat(nodeVal(get1(node, tagName)));
|
|
54
|
-
if (isNaN(val))
|
|
53
|
+
const val = Number.parseFloat(nodeVal(get1(node, tagName)));
|
|
54
|
+
if (Number.isNaN(val))
|
|
55
55
|
return undefined;
|
|
56
56
|
if (callback)
|
|
57
57
|
callback(val);
|
|
@@ -70,20 +70,6 @@ function isElement(node) {
|
|
|
70
70
|
return node?.nodeType === 1;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
function getLineStyle(node) {
|
|
74
|
-
return get(node, "line", (lineStyle) => {
|
|
75
|
-
const val = Object.assign({}, val1(lineStyle, "color", (color) => {
|
|
76
|
-
return { stroke: `#${color}` };
|
|
77
|
-
}), $num(lineStyle, "opacity", (opacity) => {
|
|
78
|
-
return { "stroke-opacity": opacity };
|
|
79
|
-
}), $num(lineStyle, "width", (width) => {
|
|
80
|
-
// GPX width is in mm, convert to px with 96 px per inch
|
|
81
|
-
return { "stroke-width": (width * 96) / 25.4 };
|
|
82
|
-
}));
|
|
83
|
-
return val;
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
|
|
87
73
|
function getExtensions(node) {
|
|
88
74
|
let values = [];
|
|
89
75
|
if (node === null)
|
|
@@ -108,16 +94,16 @@ function abbreviateName(name) {
|
|
|
108
94
|
return ["heart", "gpxtpx:hr", "hr"].includes(name) ? "heart" : name;
|
|
109
95
|
}
|
|
110
96
|
function parseNumeric(val) {
|
|
111
|
-
const num = parseFloat(val);
|
|
112
|
-
return isNaN(num) ? val : num;
|
|
97
|
+
const num = Number.parseFloat(val);
|
|
98
|
+
return Number.isNaN(num) ? val : num;
|
|
113
99
|
}
|
|
114
100
|
|
|
115
101
|
function coordPair$1(node) {
|
|
116
102
|
const ll = [
|
|
117
|
-
parseFloat(node.getAttribute("lon") || ""),
|
|
118
|
-
parseFloat(node.getAttribute("lat") || ""),
|
|
103
|
+
Number.parseFloat(node.getAttribute("lon") || ""),
|
|
104
|
+
Number.parseFloat(node.getAttribute("lat") || ""),
|
|
119
105
|
];
|
|
120
|
-
if (isNaN(ll[0]) || isNaN(ll[1])) {
|
|
106
|
+
if (Number.isNaN(ll[0]) || Number.isNaN(ll[1])) {
|
|
121
107
|
return null;
|
|
122
108
|
}
|
|
123
109
|
num1(node, "ele", (val) => {
|
|
@@ -131,6 +117,20 @@ function coordPair$1(node) {
|
|
|
131
117
|
};
|
|
132
118
|
}
|
|
133
119
|
|
|
120
|
+
function getLineStyle(node) {
|
|
121
|
+
return get(node, "line", (lineStyle) => {
|
|
122
|
+
const val = Object.assign({}, val1(lineStyle, "color", (color) => {
|
|
123
|
+
return { stroke: `#${color}` };
|
|
124
|
+
}), $num(lineStyle, "opacity", (opacity) => {
|
|
125
|
+
return { "stroke-opacity": opacity };
|
|
126
|
+
}), $num(lineStyle, "width", (width) => {
|
|
127
|
+
// GPX width is in mm, convert to px with 96 px per inch
|
|
128
|
+
return { "stroke-width": (width * 96) / 25.4 };
|
|
129
|
+
}));
|
|
130
|
+
return val;
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
|
|
134
134
|
function extractProperties(ns, node) {
|
|
135
135
|
const properties = getMulti(node, [
|
|
136
136
|
"name",
|
|
@@ -169,7 +169,7 @@ function getPoints$1(node, pointname) {
|
|
|
169
169
|
if (c.time)
|
|
170
170
|
times.push(c.time);
|
|
171
171
|
for (const [name, val] of c.extendedValues) {
|
|
172
|
-
const plural = name === "heart" ? name : name.replace("gpxtpx:", "")
|
|
172
|
+
const plural = name === "heart" ? name : `${name.replace("gpxtpx:", "")}s`;
|
|
173
173
|
if (!extendedValues[plural]) {
|
|
174
174
|
extendedValues[plural] = Array(pts.length).fill(null);
|
|
175
175
|
}
|
|
@@ -210,7 +210,7 @@ function getTrack(ns, node) {
|
|
|
210
210
|
const line = getPoints$1(segment, "trkpt");
|
|
211
211
|
if (line) {
|
|
212
212
|
extractedLines.push(line);
|
|
213
|
-
if (line.times
|
|
213
|
+
if (line.times?.length)
|
|
214
214
|
times.push(line.times);
|
|
215
215
|
}
|
|
216
216
|
}
|
|
@@ -357,8 +357,8 @@ function getProperties(node, attributeNames) {
|
|
|
357
357
|
elem = elements[0];
|
|
358
358
|
}
|
|
359
359
|
}
|
|
360
|
-
const val = parseFloat(nodeVal(elem));
|
|
361
|
-
if (!isNaN(val)) {
|
|
360
|
+
const val = Number.parseFloat(nodeVal(elem));
|
|
361
|
+
if (!Number.isNaN(val)) {
|
|
362
362
|
properties.push([alias, val]);
|
|
363
363
|
}
|
|
364
364
|
}
|
|
@@ -367,23 +367,23 @@ function getProperties(node, attributeNames) {
|
|
|
367
367
|
function coordPair(node) {
|
|
368
368
|
const ll = [num1(node, "LongitudeDegrees"), num1(node, "LatitudeDegrees")];
|
|
369
369
|
if (ll[0] === undefined ||
|
|
370
|
-
isNaN(ll[0]) ||
|
|
370
|
+
Number.isNaN(ll[0]) ||
|
|
371
371
|
ll[1] === undefined ||
|
|
372
|
-
isNaN(ll[1])) {
|
|
372
|
+
Number.isNaN(ll[1])) {
|
|
373
373
|
return null;
|
|
374
374
|
}
|
|
375
375
|
const heartRate = get1(node, "HeartRateBpm");
|
|
376
376
|
const time = nodeVal(get1(node, "Time"));
|
|
377
377
|
get1(node, "AltitudeMeters", (alt) => {
|
|
378
|
-
const a = parseFloat(nodeVal(alt));
|
|
379
|
-
if (!isNaN(a)) {
|
|
378
|
+
const a = Number.parseFloat(nodeVal(alt));
|
|
379
|
+
if (!Number.isNaN(a)) {
|
|
380
380
|
ll.push(a);
|
|
381
381
|
}
|
|
382
382
|
});
|
|
383
383
|
return {
|
|
384
384
|
coordinates: ll,
|
|
385
385
|
time: time || null,
|
|
386
|
-
heartRate: heartRate ? parseFloat(nodeVal(heartRate)) : null,
|
|
386
|
+
heartRate: heartRate ? Number.parseFloat(nodeVal(heartRate)) : null,
|
|
387
387
|
extensions: getProperties(node, TRACKPOINT_ATTRIBUTES),
|
|
388
388
|
};
|
|
389
389
|
}
|
|
@@ -515,17 +515,18 @@ function tcx(node) {
|
|
|
515
515
|
|
|
516
516
|
function fixColor(v, prefix) {
|
|
517
517
|
const properties = {};
|
|
518
|
-
const colorProp = prefix
|
|
518
|
+
const colorProp = prefix === "stroke" || prefix === "fill" ? prefix : `${prefix}-color`;
|
|
519
519
|
if (v[0] === "#") {
|
|
520
520
|
v = v.substring(1);
|
|
521
521
|
}
|
|
522
522
|
if (v.length === 6 || v.length === 3) {
|
|
523
|
-
properties[colorProp] =
|
|
523
|
+
properties[colorProp] = `#${v}`;
|
|
524
524
|
}
|
|
525
525
|
else if (v.length === 8) {
|
|
526
|
-
properties[prefix
|
|
526
|
+
properties[`${prefix}-opacity`] =
|
|
527
|
+
Number.parseInt(v.substring(0, 2), 16) / 255;
|
|
527
528
|
properties[colorProp] =
|
|
528
|
-
|
|
529
|
+
`#${v.substring(6, 8)}${v.substring(4, 6)}${v.substring(2, 4)}`;
|
|
529
530
|
}
|
|
530
531
|
return properties;
|
|
531
532
|
}
|
|
@@ -551,11 +552,11 @@ function extractIconHref(node) {
|
|
|
551
552
|
function extractIcon(node) {
|
|
552
553
|
return get(node, "IconStyle", (iconStyle) => {
|
|
553
554
|
return Object.assign(getColor(iconStyle, "icon"), numericProperty(iconStyle, "scale", "icon-scale"), numericProperty(iconStyle, "heading", "icon-heading"), get(iconStyle, "hotSpot", (hotspot) => {
|
|
554
|
-
const left = parseFloat(hotspot.getAttribute("x") || "");
|
|
555
|
-
const top = parseFloat(hotspot.getAttribute("y") || "");
|
|
555
|
+
const left = Number.parseFloat(hotspot.getAttribute("x") || "");
|
|
556
|
+
const top = Number.parseFloat(hotspot.getAttribute("y") || "");
|
|
556
557
|
const xunits = hotspot.getAttribute("xunits") || "";
|
|
557
558
|
const yunits = hotspot.getAttribute("yunits") || "";
|
|
558
|
-
if (!isNaN(left) && !isNaN(top))
|
|
559
|
+
if (!Number.isNaN(left) && !Number.isNaN(top))
|
|
559
560
|
return {
|
|
560
561
|
"icon-offset": [left, top],
|
|
561
562
|
"icon-offset-units": [xunits, yunits],
|
|
@@ -589,71 +590,6 @@ function extractStyle(node) {
|
|
|
589
590
|
return Object.assign({}, extractPoly(node), extractLine(node), extractLabel(node), extractIcon(node));
|
|
590
591
|
}
|
|
591
592
|
|
|
592
|
-
const toNumber = (x) => Number(x);
|
|
593
|
-
const typeConverters = {
|
|
594
|
-
string: (x) => x,
|
|
595
|
-
int: toNumber,
|
|
596
|
-
uint: toNumber,
|
|
597
|
-
short: toNumber,
|
|
598
|
-
ushort: toNumber,
|
|
599
|
-
float: toNumber,
|
|
600
|
-
double: toNumber,
|
|
601
|
-
bool: (x) => Boolean(x),
|
|
602
|
-
};
|
|
603
|
-
function extractExtendedData(node, schema) {
|
|
604
|
-
return get(node, "ExtendedData", (extendedData, properties) => {
|
|
605
|
-
for (const data of $(extendedData, "Data")) {
|
|
606
|
-
properties[data.getAttribute("name") || ""] = nodeVal(get1(data, "value"));
|
|
607
|
-
}
|
|
608
|
-
for (const simpleData of $(extendedData, "SimpleData")) {
|
|
609
|
-
const name = simpleData.getAttribute("name") || "";
|
|
610
|
-
const typeConverter = schema[name] || typeConverters.string;
|
|
611
|
-
properties[name] = typeConverter(nodeVal(simpleData));
|
|
612
|
-
}
|
|
613
|
-
return properties;
|
|
614
|
-
});
|
|
615
|
-
}
|
|
616
|
-
function getMaybeHTMLDescription(node) {
|
|
617
|
-
const descriptionNode = get1(node, "description");
|
|
618
|
-
for (const c of Array.from(descriptionNode?.childNodes || [])) {
|
|
619
|
-
if (c.nodeType === 4) {
|
|
620
|
-
return {
|
|
621
|
-
description: {
|
|
622
|
-
"@type": "html",
|
|
623
|
-
value: nodeVal(c),
|
|
624
|
-
},
|
|
625
|
-
};
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
return {};
|
|
629
|
-
}
|
|
630
|
-
function extractTimeSpan(node) {
|
|
631
|
-
return get(node, "TimeSpan", (timeSpan) => {
|
|
632
|
-
return {
|
|
633
|
-
timespan: {
|
|
634
|
-
begin: nodeVal(get1(timeSpan, "begin")),
|
|
635
|
-
end: nodeVal(get1(timeSpan, "end")),
|
|
636
|
-
},
|
|
637
|
-
};
|
|
638
|
-
});
|
|
639
|
-
}
|
|
640
|
-
function extractTimeStamp(node) {
|
|
641
|
-
return get(node, "TimeStamp", (timeStamp) => {
|
|
642
|
-
return { timestamp: nodeVal(get1(timeStamp, "when")) };
|
|
643
|
-
});
|
|
644
|
-
}
|
|
645
|
-
function extractCascadedStyle(node, styleMap) {
|
|
646
|
-
return val1(node, "styleUrl", (styleUrl) => {
|
|
647
|
-
styleUrl = normalizeId(styleUrl);
|
|
648
|
-
if (styleMap[styleUrl]) {
|
|
649
|
-
return Object.assign({ styleUrl }, styleMap[styleUrl]);
|
|
650
|
-
}
|
|
651
|
-
// For backward-compatibility. Should we still include
|
|
652
|
-
// styleUrl even if it's not resolved?
|
|
653
|
-
return { styleUrl };
|
|
654
|
-
});
|
|
655
|
-
}
|
|
656
|
-
|
|
657
593
|
const removeSpace = /\s*/g;
|
|
658
594
|
const trimSpace = /^\s*|\s*$/g;
|
|
659
595
|
const splitSpace = /\s+/;
|
|
@@ -664,8 +600,8 @@ function coord1(value) {
|
|
|
664
600
|
return value
|
|
665
601
|
.replace(removeSpace, "")
|
|
666
602
|
.split(",")
|
|
667
|
-
.map(parseFloat)
|
|
668
|
-
.filter((num) => !isNaN(num))
|
|
603
|
+
.map(Number.parseFloat)
|
|
604
|
+
.filter((num) => !Number.isNaN(num))
|
|
669
605
|
.slice(0, 3);
|
|
670
606
|
}
|
|
671
607
|
/**
|
|
@@ -686,7 +622,7 @@ function gxCoords(node) {
|
|
|
686
622
|
elems = $ns(node, "coord", "*");
|
|
687
623
|
}
|
|
688
624
|
const coordinates = elems.map((elem) => {
|
|
689
|
-
return nodeVal(elem).split(" ").map(parseFloat);
|
|
625
|
+
return nodeVal(elem).split(" ").map(Number.parseFloat);
|
|
690
626
|
});
|
|
691
627
|
if (coordinates.length === 0) {
|
|
692
628
|
return null;
|
|
@@ -796,47 +732,69 @@ function getGeometry(node) {
|
|
|
796
732
|
};
|
|
797
733
|
}
|
|
798
734
|
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
735
|
+
const toNumber = (x) => Number(x);
|
|
736
|
+
const typeConverters = {
|
|
737
|
+
string: (x) => x,
|
|
738
|
+
int: toNumber,
|
|
739
|
+
uint: toNumber,
|
|
740
|
+
short: toNumber,
|
|
741
|
+
ushort: toNumber,
|
|
742
|
+
float: toNumber,
|
|
743
|
+
double: toNumber,
|
|
744
|
+
bool: (x) => Boolean(x),
|
|
745
|
+
};
|
|
746
|
+
function extractExtendedData(node, schema) {
|
|
747
|
+
return get(node, "ExtendedData", (extendedData, properties) => {
|
|
748
|
+
for (const data of $(extendedData, "Data")) {
|
|
749
|
+
properties[data.getAttribute("name") || ""] = nodeVal(get1(data, "value"));
|
|
750
|
+
}
|
|
751
|
+
for (const simpleData of $(extendedData, "SimpleData")) {
|
|
752
|
+
const name = simpleData.getAttribute("name") || "";
|
|
753
|
+
const typeConverter = schema[name] || typeConverters.string;
|
|
754
|
+
properties[name] = typeConverter(nodeVal(simpleData));
|
|
755
|
+
}
|
|
756
|
+
return properties;
|
|
757
|
+
});
|
|
808
758
|
}
|
|
809
|
-
function
|
|
810
|
-
const
|
|
811
|
-
const
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
geometry,
|
|
818
|
-
properties: Object.assign(getMulti(node, [
|
|
819
|
-
"name",
|
|
820
|
-
"address",
|
|
821
|
-
"visibility",
|
|
822
|
-
"open",
|
|
823
|
-
"phoneNumber",
|
|
824
|
-
"description",
|
|
825
|
-
]), getMaybeHTMLDescription(node), extractCascadedStyle(node, styleMap), extractStyle(node), extractExtendedData(node, schema), extractTimeSpan(node), extractTimeStamp(node), coordTimes.length
|
|
826
|
-
? {
|
|
827
|
-
coordinateProperties: {
|
|
828
|
-
times: coordTimes.length === 1 ? coordTimes[0] : coordTimes,
|
|
759
|
+
function getMaybeHTMLDescription(node) {
|
|
760
|
+
const descriptionNode = get1(node, "description");
|
|
761
|
+
for (const c of Array.from(descriptionNode?.childNodes || [])) {
|
|
762
|
+
if (c.nodeType === 4) {
|
|
763
|
+
return {
|
|
764
|
+
description: {
|
|
765
|
+
"@type": "html",
|
|
766
|
+
value: nodeVal(c),
|
|
829
767
|
},
|
|
830
|
-
}
|
|
831
|
-
|
|
832
|
-
};
|
|
833
|
-
if (feature.properties?.visibility !== undefined) {
|
|
834
|
-
feature.properties.visibility = feature.properties.visibility !== "0";
|
|
768
|
+
};
|
|
769
|
+
}
|
|
835
770
|
}
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
return
|
|
771
|
+
return {};
|
|
772
|
+
}
|
|
773
|
+
function extractTimeSpan(node) {
|
|
774
|
+
return get(node, "TimeSpan", (timeSpan) => {
|
|
775
|
+
return {
|
|
776
|
+
timespan: {
|
|
777
|
+
begin: nodeVal(get1(timeSpan, "begin")),
|
|
778
|
+
end: nodeVal(get1(timeSpan, "end")),
|
|
779
|
+
},
|
|
780
|
+
};
|
|
781
|
+
});
|
|
782
|
+
}
|
|
783
|
+
function extractTimeStamp(node) {
|
|
784
|
+
return get(node, "TimeStamp", (timeStamp) => {
|
|
785
|
+
return { timestamp: nodeVal(get1(timeStamp, "when")) };
|
|
786
|
+
});
|
|
787
|
+
}
|
|
788
|
+
function extractCascadedStyle(node, styleMap) {
|
|
789
|
+
return val1(node, "styleUrl", (styleUrl) => {
|
|
790
|
+
styleUrl = normalizeId(styleUrl);
|
|
791
|
+
if (styleMap[styleUrl]) {
|
|
792
|
+
return Object.assign({ styleUrl }, styleMap[styleUrl]);
|
|
793
|
+
}
|
|
794
|
+
// For backward-compatibility. Should we still include
|
|
795
|
+
// styleUrl even if it's not resolved?
|
|
796
|
+
return { styleUrl };
|
|
797
|
+
});
|
|
840
798
|
}
|
|
841
799
|
|
|
842
800
|
function getGroundOverlayBox(node) {
|
|
@@ -859,7 +817,7 @@ function rotateBox(bbox, coordinates, rotation) {
|
|
|
859
817
|
coordinates[0].map((coordinate) => {
|
|
860
818
|
const dy = coordinate[1] - center[1];
|
|
861
819
|
const dx = coordinate[0] - center[0];
|
|
862
|
-
const distance = Math.sqrt(
|
|
820
|
+
const distance = Math.sqrt(dy ** 2 + dx ** 2);
|
|
863
821
|
const angle = Math.atan2(dy, dx) + rotation * DEGREES_TO_RADIANS;
|
|
864
822
|
return [
|
|
865
823
|
center[0] + Math.cos(angle) * distance,
|
|
@@ -883,10 +841,10 @@ function getLatLonBox(node) {
|
|
|
883
841
|
const bbox = [west, south, east, north];
|
|
884
842
|
let coordinates = [
|
|
885
843
|
[
|
|
886
|
-
[west, north],
|
|
887
|
-
[east, north],
|
|
888
|
-
[east, south],
|
|
889
|
-
[west, south],
|
|
844
|
+
[west, north], // top left
|
|
845
|
+
[east, north], // top right
|
|
846
|
+
[east, south], // top right
|
|
847
|
+
[west, south], // bottom left
|
|
890
848
|
[west, north], // top left (again)
|
|
891
849
|
],
|
|
892
850
|
];
|
|
@@ -939,6 +897,49 @@ function getGroundOverlay(node, styleMap, schema, options) {
|
|
|
939
897
|
return feature;
|
|
940
898
|
}
|
|
941
899
|
|
|
900
|
+
function geometryListToGeometry(geometries) {
|
|
901
|
+
return geometries.length === 0
|
|
902
|
+
? null
|
|
903
|
+
: geometries.length === 1
|
|
904
|
+
? geometries[0]
|
|
905
|
+
: {
|
|
906
|
+
type: "GeometryCollection",
|
|
907
|
+
geometries,
|
|
908
|
+
};
|
|
909
|
+
}
|
|
910
|
+
function getPlacemark(node, styleMap, schema, options) {
|
|
911
|
+
const { coordTimes, geometries } = getGeometry(node);
|
|
912
|
+
const geometry = geometryListToGeometry(geometries);
|
|
913
|
+
if (!geometry && options.skipNullGeometry) {
|
|
914
|
+
return null;
|
|
915
|
+
}
|
|
916
|
+
const feature = {
|
|
917
|
+
type: "Feature",
|
|
918
|
+
geometry,
|
|
919
|
+
properties: Object.assign(getMulti(node, [
|
|
920
|
+
"name",
|
|
921
|
+
"address",
|
|
922
|
+
"visibility",
|
|
923
|
+
"open",
|
|
924
|
+
"phoneNumber",
|
|
925
|
+
"description",
|
|
926
|
+
]), getMaybeHTMLDescription(node), extractCascadedStyle(node, styleMap), extractStyle(node), extractExtendedData(node, schema), extractTimeSpan(node), extractTimeStamp(node), coordTimes.length
|
|
927
|
+
? {
|
|
928
|
+
coordinateProperties: {
|
|
929
|
+
times: coordTimes.length === 1 ? coordTimes[0] : coordTimes,
|
|
930
|
+
},
|
|
931
|
+
}
|
|
932
|
+
: {}),
|
|
933
|
+
};
|
|
934
|
+
if (feature.properties?.visibility !== undefined) {
|
|
935
|
+
feature.properties.visibility = feature.properties.visibility !== "0";
|
|
936
|
+
}
|
|
937
|
+
const id = node.getAttribute("id");
|
|
938
|
+
if (id !== null && id !== "")
|
|
939
|
+
feature.id = id;
|
|
940
|
+
return feature;
|
|
941
|
+
}
|
|
942
|
+
|
|
942
943
|
function getStyleId(style) {
|
|
943
944
|
let id = style.getAttribute("id");
|
|
944
945
|
const parentNode = style.parentNode;
|
|
@@ -969,8 +970,7 @@ function buildSchema(node) {
|
|
|
969
970
|
const schema = {};
|
|
970
971
|
for (const field of $(node, "SimpleField")) {
|
|
971
972
|
schema[field.getAttribute("name") || ""] =
|
|
972
|
-
typeConverters[field.getAttribute("type") || ""] ||
|
|
973
|
-
typeConverters["string"];
|
|
973
|
+
typeConverters[field.getAttribute("type") || ""] || typeConverters.string;
|
|
974
974
|
}
|
|
975
975
|
return schema;
|
|
976
976
|
}
|