[OSM-dev] Fwd: Osmosis - Cutting out a bounding box from a diff file (.osc)
michael.meier at rrze.fau.de
Thu Sep 6 11:30:24 BST 2012
On 09/06/2012 11:39 AM, Stéphane Henriod wrote:
> But then if this is confirmed to be a wanted behavior, then we should
> document it explicitely somewhere
This is wanted behaviour, the relevant defines/macros and an explanation
are in node-ram-cache.h starting at line 16.
You could probably remove the "#define FIXED_POINT" line to make it use
floatingpoint, but as FIXED_POINT has been the standard for quite some
time I wouldn't expect that everything works properly without it. Also,
what would be the point, making it slower on purpose?
I do not think this needs to be documented - these are essentially
internal tables, and using fixed point arithmetic to speed things up
and/or ease storage requirements is pretty much one of the first lessons
in "programming for beginners".
What should probably be changed though is the define
#define DOUBLE_TO_FIX(x) ((int)((x) * scale))
This will cause an unexpected loss of precission due to conversion
errors from the integer cast, as I discovered when I wrote a little tool
to convert the planet_osm_nodes table to the new flatnodes-file:
DOUBLE_TO_FIX(FIX_TO_DOUBLE(x)) does _NOT_ always return x. This macro
should probably use a proper "round()" instead of the integer cast.
More information about the dev