Skip to content
This repository has been archived by the owner on May 29, 2024. It is now read-only.

Right hand rule for polygons + outdated NPM #82

Closed
oyvindi opened this issue Dec 17, 2020 · 1 comment
Closed

Right hand rule for polygons + outdated NPM #82

oyvindi opened this issue Dec 17, 2020 · 1 comment

Comments

@oyvindi
Copy link

oyvindi commented Dec 17, 2020

The current version is not handling RHR correctly, but seems like @rurban made a fix (see #81)

According to RFC 7946, exterior rings are counter-clockwise, and opposite for interiors.

Would be nice to have this merged to master, and publish a new NPM (the latest version there is 2.0.0)

Here is a sample MultiPolygon that should be correct, but fails validation:

{
  "type":"MultiPolygon",
  "coordinates":[
    [
      [
        [
          -149.92383493947585,
          -107.20901451037372
        ],
        [
          -259.59381502763006,
          -109.20301414834012
        ],
        [
          -258.2644819356524,
          -134.460342895915
        ],
        [
          -203.09715861858095,
          -141.77167490179193
        ],
        [
          -140.61850329563254,
          -125.81967779806041
        ],
        [
          -149.92383493947585,
          -107.20901451037372
        ]
      ],
      [
        [
          -254.4534848633285,
          -128.68537469897
        ],
        [
          -252.63985750747375,
          -113.16878509887954
        ],
        [
          -241.1746460656409,
          -113.77221728002854
        ],
        [
          -239.54032744438703,
          -128.88966452662675
        ],
        [
          -254.4534848633285,
          -128.68537469897
        ]
      ],
      [
        [
          -211.55262105541485,
          -114.18079693534207
        ],
        [
          -198.47807208538396,
          -125.41673745646227
        ],
        [
          -222.17569209356486,
          -126.02960693943254
        ],
        [
          -211.55262105541485,
          -114.18079693534207
        ]
      ]
    ],
    [
      [
        [
          -217.05515608434595,
          -92.58635049861982
        ],
        [
          -241.64781828593203,
          -65.33502211307837
        ],
        [
          -263.58181430356285,
          -92.58635049861982
        ],
        [
          -217.05515608434595,
          -92.58635049861982
        ]
      ]
    ],
    [
      [
        [
          -154.57650076139757,
          -62.01168938313447
        ],
        [
          -190.46849424479345,
          -62.67635592912325
        ],
        [
          -190.46849424479345,
          -92.58635049861982
        ],
        [
          -150.58850148546466,
          -95.24501668257506
        ],
        [
          -154.57650076139757,
          -62.01168938313447
        ]
      ],
      [
        [
          -183.15633501112902,
          -68.82845519554763
        ],
        [
          -161.2973234518588,
          -68.82845519554763
        ],
        [
          -160.48016414123182,
          -87.2145396846534
        ],
        [
          -183.36062483878575,
          -87.2145396846534
        ],
        [
          -183.15633501112902,
          -68.82845519554763
        ]
      ]
    ]
  ]
}
@sgillies
Copy link
Contributor

@oyvindi confirmed. Thanks for the example. I will add it to the test suite.

sgillies pushed a commit that referenced this issue May 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants