-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Return real precision of coordinates #138
Comments
If you are referring to the geometries of the OSM features that are returned through either the I was using this example request and went through the coordinates. In general, most of the coordinates are correctly limited to the precision of 7 decimal values. However, there are some like |
it's actually caused by the floating point arithmetic of the CPU:
Hm, I would say rounding is better than truncating. e.g.
see GIScience/oshdb#320 (comment) Summarizing, IMHO it's best to round the coordinates at the output stage, so in the ohsome-API. --
@SlowMo24 at first glance I think this would not be the case here since every single coordinate pair should be returned with the same rounding errors applied, so you would never run into issues of having the same coordinate once reported as |
Yes rounding would be the correct behaviour to get back the original coordinates and it might in fact be best done at the latest point possible but this would leave OSHDB-Geometries vulnerable but that is up to the developers of course. I'm though not sure why this is not considered a bug. Of course the amount of error is very small but is it constant and affects (from what I have seen) >50% of the coordinates (or 100% of requests) and causes issues on the client.
I was also surprised by this error but non-noded intersection as well as the topology were both solved by snapping the geometries to a seven decimal grid. |
Makes sense. I will reference this then in a PR and apply the rounding on 7 digits to every output geometry coordinate. Should be pretty easy to implement and apply.
I guess that is arguable and depends how you define a bug. I would say that it is not a bug within the ohsome API, but can potentially cause issues in other services that deal with the response data. So the bug label here in the ohsome API repo would refer to to things that are not working correctly inside the code of the ohsome API and cause problems there. You could maybe also extend it a bit with producing not-intended things that cause problems elsewhere (like this issue here for instance). So for me, I'm fine with or without the |
to better reflect the actual change Co-authored-by: Martin Raifer <[email protected]>
round output coordinates to 7 decimal places closes #138
OSM uses a precision of 7 decimal values (https://wiki.openstreetmap.org/wiki/DE:Genauigkeit_von_Koordinaten). The ohsome API returns many coordinates with a precision of up to 14 decimals (enough to separate neighbouring atoms).
This is harmful in many ways
The text was updated successfully, but these errors were encountered: