Skip to content

booleanEqual() sometimes outputs false by internal cleanCoords() #2406

@naoak

Description

@naoak

Both of these polygons have the same shape and are in the same location. The length of the coordinates is also the same. The only difference is the order of the coordinates.

A:

{
  "type": "Feature", 
  "properties": {},
  "geometry": {
    "type": "Polygon",
    "coordinates": [
      [
        [1, 3], [3, 3], [3, 1], [3, -3], [-3, -3], [-3, 3], [1, 3]
      ]
    ]
  }
}

B:

{
  "type": "Feature",
  "properties": {},
  "geometry": {
    "type": "Polygon",
    "coordinates": [
      [
        [-3, -3], [-3, 3], [1, 3], [3, 3], [3, 1], [3, -3], [-3, -3]
      ]
    ]
  }
}

cleanCoords() drops [3,1] from A, whereas it does [1,3] and [3,1] from B. Therefore, the lengths of the coordinates are different and the result of booleanEqual is false. In polygon A, [1,3] is at the starting point, so it seems to make that difference.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions