Merge pull request #11721 from mike-000/patch-21

Handle empty Z coordinates in KML
This commit is contained in:
Andreas Hocevar
2020-11-06 13:38:06 +01:00
committed by GitHub
2 changed files with 50 additions and 1 deletions

View File

@@ -1117,7 +1117,8 @@ export function readFlatCoordinates(node) {
const flatCoordinates = [];
// The KML specification states that coordinate tuples should not include
// spaces, but we tolerate them.
const re = /^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)\s*,\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)(?:\s*,\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?))?\s*/i;
s = s.replace(/\s*,\s*/g, ',');
const re = /^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?),([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)(?:\s+|,|$)(?:([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)(?:\s+|$))?\s*/i;
let m;
while ((m = re.exec(s))) {
const x = parseFloat(m[1]);