mapbox/geojsonhint

hint does not always catch the right hand rule

Opened this issue · 1 comments

  • Node: v10.22.0
  • @mapbox/geojson-rewind: 0.5.1,
  • @mapbox/geojsonhint: 3.0.1,

I am working on some code that will validate geojson that it is given.
I use geojsonhint to check if the right-hand rule fails and I use geojson-rewind to fix the error.

const gjson = {....}

if(hint(gjson.length) >= 1) {
  const nvalue = rewind({...gjson});
  if(hint(nvalue.length) < 1) {
    console.log(nvalue);
  }
}

The above minimum viable example demonstrates that I lint the geojson, catch a right-hand rule and then rewind it using @mapbox/geojson-rewind.
I then lint the result of rewind() to ensure that the linter finds it satisfactory and if no errors are found I print the result.

I can then take this result and put it into https://geojsonlint.com/ and it will fail the right-hand rule.

Finally. I copy and paste the same result into the right-hand rule fixer and paste that result into geojsonlint.com and it succeeds.

It appears that for some of my geojson objects, setting clockwise to true will fix the issue, while others leaving it false is sufficient. However, I wrote code that hint()'s the result in the same manner as above, however it will never catch the geojson results that would have otherwise succeeded if clockwise = true.

This makes it impossible for me to simply stream through the results I want to lint and fix the errors as they pop up in chunks.

Is there anything I am missing in the linter that could be causing it to give false negatives?

Good idea,
but it doesn't produce valid json.