[OSM-dev] C++ Osmium - Customize Location Precision

Bryant Curto bryantcurto at gmail.com
Wed Feb 20 21:30:35 UTC 2019


Hello all!

I would like to read and write locations with one or two more digits of
precision using Osmium.

Osmium's Location class
<https://github.com/osmcode/libosmium/blob/c19e26906e0f6abe22503e38d9a4474086855521/include/osmium/osm/location.hpp#L257-L483>
appears
to be the cause behind coordinates being stored with 7 digits of precision.
Looking at the source, it appears that I would need to add a few zeros to
the end of *coordinate_precision
<https://github.com/osmcode/libosmium/blob/c19e26906e0f6abe22503e38d9a4474086855521/include/osmium/osm/location.hpp#L68>
*and
increase *scale* and *max_digits*
<https://github.com/osmcode/libosmium/blob/c19e26906e0f6abe22503e38d9a4474086855521/include/osmium/osm/location.hpp#L80-L84>
by
a few. However, setting *coordinate_precision* to 1e8 (or more) will result
in many coordinates overflowing 4-byte signed integer members *m_x*
and m_y, and
a slew of other issues.

Any suggestions would be appreciated?

- Bryant
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20190220/2f58fd50/attachment.html>


More information about the dev mailing list