[OSM-dev] C++ Osmium - Customize Location Precision
Jochen Topf
jochen at remote.org
Thu Feb 21 06:30:02 UTC 2019
Hi!
The coordinate precision is deeply baked into Osmium, because OSM data
only has this precision. That's because the central OSM database only
stores the coordinates as 32bit integer, just as Osmium does. So there
is no way to change this, and no need (unless you work with non-OSM
data, in which case I'd argue Osmium isn't the right tool anyway).
Jochen
On Wed, Feb 20, 2019 at 04:30:35PM -0500, Bryant Curto wrote:
> Date: Wed, 20 Feb 2019 16:30:35 -0500
> From: Bryant Curto <bryantcurto at gmail.com>
> To: dev at openstreetmap.org
> Subject: [OSM-dev] C++ Osmium - Customize Location Precision
>
> 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
> _______________________________________________
> dev mailing list
> dev at openstreetmap.org
> https://lists.openstreetmap.org/listinfo/dev
--
Jochen Topf jochen at remote.org https://www.jochentopf.com/ +49-351-31778688
More information about the dev
mailing list