Closed calvinmetcalf closed 10 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.
it might need to go under maybe a pedantic flag but I could see value in checking for things like this
Yep, this might be reason to have a type: "warning"
to differentiate such errors.
should we add a type to the current ones?
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.
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.
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.
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.