mapbox/wellknown

empty wkt multipolygon does not roundtrip

Opened this issue · 0 comments

If you start with

const wkt = 'MULTIPOLYGON EMPTY'

and then try to roundtrip it using

const newWkt = stringify(parse(wkt))

you end up with MULTIPOLYGON (). which in turn parses to null (which cannot be stringified anymore).

So in summary:

  • MULTIPOLYGON EMPTY parses just fine, to a geometry with empty coordinates array
  • a multipolygon geometry with empty coordinates array stringifies to MULTIPOLYGON () instead of MULTIPOLYGON EMPTY, and is treated as invalid syntax when re-parsing it, resulting in a null parsing result