turf icon indicating copy to clipboard operation
turf copied to clipboard

The @turf/tesselate function fails to properly process GeoJSON Polygon data that includes elevation.

Open Seungup opened this issue 1 year ago • 0 comments

Description

The @turf/tesselate function fails to properly process GeoJSON Polygon data that includes elevation.

Reproduction

The issue can be reproduced with the following GeoJSON file:

{
  "type": "Feature",
  "geometry": {
    "type": "Polygon",
    "coordinates": [
      [
        [130.2138542686084, 36.85831846193179, 0],
        [121.54982788145819, 34.421266048716696, 0],
        [131.58908870149648, 33.113275358661966, 0],
        [130.2138542686084, 36.85831846193179, 0]
      ]
    ]
  },
  "properties": {}
}

Code Location

The problem occurs in the following code location: https://github.com/Turfjs/turf/blob/cc680d3837b966d037bbb801a07d70482035fa15/packages/turf-tesselate/index.ts#L52-L62

Expected Behavior

The tesselate function should handle GeoJSON Polygons with elevation data correctly, as specified in RFC 7946 Section 3.1.1. According to the RFC, a position is an array of numbers with the first two elements being longitude and latitude, and an optional third element for altitude or elevation.

Actual Behavior

The tesselate function fails to process the provided GeoJSON Polygon, resulting in an error.

Additional Information

Please provide any additional information here that may be useful.

Seungup avatar Aug 06 '24 02:08 Seungup