On 13.02.20 08:41, Colin Smale wrote:
>>> 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)
>>
> If so then then my comments about preserving precision still apply to
> all "client" software and I bet the majority uses float. Then an
> innocent update to a tag on a node can end up unintentionally moving the
> location slightly, losing precision.

Floats are not necessarily more precise than fixed comma "integers",
as you don't need to waste bits on the exponent when you know it
is constant.

But even when taking a 32 bit longitude value, not 64 bit, with the
first 10 bits being the "integer" part, and the remaining 22 the
"fraction" part, we'd already be at 3cm or better.

Looking at the PBF file format description we actually have

  // Granularity, units of nanodegrees, used to store coordinates in
this block
  optional int32 granularity = 17 [default=100];

  // Offset value between the output coordinates coordinates and the
granularity grid, in units of nanodegrees.
  optional int64 lat_offset = 19 [default=0];
  optional int64 lon_offset = 20 [default=0];

So we are at 64bit precision in nanodegrees, which brings us into
the range of possibly being as precise as low as a few percent
of a micrometer ...

That should be good enough for a while ...

--
hartmut

_______________________________________________
talk mailing list
talk@openstreetmap.org
https://lists.openstreetmap.org/listinfo/talk

Reply via email to