mapbox / geojsonhint

IMPORTANT: This repo will be archived. Use @placemarkio/check-geojson instead
ISC License
258 stars 37 forks source link

👉 Add option for right-hand rule validation #76

Closed digitaltopo closed 5 years ago

digitaltopo commented 5 years ago

This PR adds an option that allows users to disable Right Hand Rule (RHR) validation on Polygon and MultiPolygon linear rings by setting a new rightHandRule option to false. The default behavior still enforces the RHR.

This allows for backwards compatibility with the previous spec:

   Note: the [GJ2008] specification did not discuss linear ring winding
   order.  For backwards compatibility, parsers SHOULD NOT reject
   Polygons that do not follow the right-hand rule.

The rationale for this is that many available tools have not yet implemented the RHR when generating geometries, resulting in end users getting validation errors for otherwise "valid" geometries when using geojsonhint.

Example Usage:

geojsonhint.hint({...GEOJSON...}, {
    rightHandRule: false
});

Thanks and looking forward to any feedback!

sgillies commented 5 years ago

Thanks for the contribution. We're not going to accept it for several reasons. The intent here is to be more pedantic about the IETF spec than the existing tools. This library is not going to have a 2008 compatibility mode. The other reason is that this project is in a maintenance-only mode. We're only going to fix critical bugs. We're sorry that this status hasn't been made clear.

digitaltopo commented 5 years ago

@sgillies Thanks for clarifying and adding more info on the project readme.