Realistic input coordinate precision #2949
Replies: 4 comments 9 replies
-
|
From my point of view, since I'm dealing with real world data (OSM) I'm totally fine with some "rounding". |
Beta Was this translation helpful? Give feedback.
-
|
Maybe there is a place for turf-lint? Though whether it's an advisory debugging tool only, or a runtime input data fixer, I'm not sure. The spec is probably vague enough in a few areas that it might be tough to nail down the latter. There is @placemarkio/check-geojson though it specifically doesn't look at precision, or ring winding which is a pretty common issue. |
Beta Was this translation helpful? Give feedback.
-
|
The RFC suggests 6 digits of precision, which conveniently also fits in a float32 which doesn't help us in javascript runtimes but would be meaningful for people interoperating with another language. |
Beta Was this translation helpful? Give feedback.
-
|
Please correct me if I'm wrong, but I think it is fair to assume that the main use cases for a library like turf are going to be for visualizing real-world data and running lightweight analytics. I could very easily be wrong about the level of analytics that people use mind you. I'm also working on the assumption that real world data is messy, and while its 100% reasonable to assume spec compliance, assuming anything beyond that (like no repeat points or certain spacing between points) is not reasonable. So with those assumptions, my 2c is:
As a testing aside, there is a mixture of exact precision tests (which definitely shouldn't exist) and approximate precision tests. To @mfedeerly's point about precision, I wonder if it would be a good idea to create a small set of helper assertion teset wrappers to use as approximately equal to an agreed number of significant figures then roll them in over time. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
There have been a few bugs recently that seem to relate to extremely small distances being represented as geojson. One recent case involved a line segment 0.6 nanometers long. Which seems to leave the underlying Javascript math functions no room to move, and degenerate elements creep in.
I'm wondering if we should start pushing back a little on error cases that go beyond six or seven decimals of precision (approx 10cm) at least in the first instance. Start taking the "geo" in geojson at face value. An expectation has possibly developed that Turf should be fast and robust and handle an arbitrary number of decimal places, and that's probably not something we can deliver on with JS.
Tagging a few people recently involved with issues along those lines. Please weigh in with your thoughts 🙏
@SimplyPancake @HarelM @bratter @mfedderly @JamesLMilner
Beta Was this translation helpful? Give feedback.
All reactions