[OSM-talk] 1e7 | Re: OTG rule, borders & mountains existing | Re: Crimea situation - on the ground
Rory McCann
rory at technomancy.org
Fri Feb 14 12:25:57 UTC 2020
On 13/02/2020 00:15, Martin Koppenhoefer wrote:
>> Il giorno 13 feb 2020, alle ore 00:05, Colin Smale <colin.smale at xs4all.nl> ha scritto:
>>
>> Locations are stored in OSM as pairs of {lat,lon} and I assume these are both 64-bit floats in the database.
>
>
> AFAIK they are stored as integers (shifting the decimals)
They are stored with 7 places of decimals (i.e. multiple by 1e7).
https://wiki.openstreetmap.org/wiki/Node
> Do not use IEEE 32-bit floating point data type since it is limited
> to about 5 decimal places for the highest longitude.
>
> A 32-bit method used by the Rails port is to use an integer (by
> multiplying each coordinate in degrees by 1E7 and rounding it: this
> allows to cover all absolute signed coordinates in ±214.7483647
> degrees, or a maximum difference of 429.4967295 degrees, a bit more
> than what is needed).
>
> For computing projections, IEEE 64 bit floating points are needed for
> intermediate results.
>
> The 7 rounded decimal places for coordinates in degrees define the
> worst error of longitude to a maximum of ±5.56595 millimeters on the
> Earth equator, i.e. it allows building maps with centimetric
> precision. With only 5 decimal places, the precision of map data
> would be only metric, causing severe changes of shapes for important
> objects like buildings, or many zigzags or angular artefacts on
> roads.
More information about the talk
mailing list