mapbox / geojsonhint

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

inner rings are actually inside #12

Closed calvinmetcalf closed 10 years ago

calvinmetcalf commented 11 years ago

this one might be tricky to test but the subsequent rings in an polygon should all be located inside the first one. Tricky because they could be concave, off the top of my head unless you can think of a better one we'd need to make sure that at least one point from the inner ring is inside the outer polygon and that they don't intersect.

tmcw commented 11 years ago

fwiw, the geojson spec actually doesn't harp on correctness like this and I don't think any implementations do either, unless they convert this into an ogc geometry spec-restricting format.

calvinmetcalf commented 11 years ago

it might need to go under maybe a pedantic flag but I could see value in checking for things like this

tmcw commented 11 years ago

Yep, this might be reason to have a type: "warning" to differentiate such errors.

calvinmetcalf commented 11 years ago

should we add a type to the current ones?

tmcw commented 11 years ago

Sure, only if it's necessary by this addition, though. My suspicion is that proper linearring checking will be pretty performance-intensive, since it's basically point-in-polygon over an arbitrarily large set, so it gives me the heebie-jeebies a little.

calvinmetcalf commented 11 years ago

if you knew one of the inner points was inside the outer one, then if you could show that it didn't intersect the outer one (which for some reason my gut says is a problem that can be optimized easier) you'd know it was inside.

tmcw commented 10 years ago

Closing - this would be a good fit for a fancier geojsonperfectinator library, but going to restrict the scope of this library towards correct geojson only.