mapbox/wellknown

Does not support 4d geometries

Closed this issue · 0 comments

The readme indicates 4d is supported, but it's actually not due to this part of the tuple regex:

'(\\s' + numberRegexp.source + ')?'

The last ? matches 0 or 1 times, meaning only 3 dimensions can be parsed. In fact, attempting to parse a EWKT string with 4 dimensions breaks the parser entirely.

stringify also does not support 4d:

  function pairWKT (c) {
    if (c.length === 2) {
      return c[0] + ' ' + c[1];
    } else if (c.length === 3) {
      return c[0] + ' ' + c[1] + ' ' + c[2];
    }
  }