[OSM-dev] osm2pgsql way_area is 0 for small areas

Michael Kussmaul kussmaul.list at nix.ch
Fri Mar 22 10:15:08 UTC 2013


Hi

I'm using osm2pgsql in hstore+latlon configuration and experienced a problem with the calculated way_area. For small areas (parks, buildings) the value stored in the database is always 0. Looking at the code output_pgsql.c (line 931, 1162, 1215), I saw we simply use "%f" to format the calculated area - obviously this results in a rounded 0.000000 for very small areas.

I was wondering if there would be any side-effects in OSM toolchains if we change this to an "%g" formatter? This would enable exponential notation for very small numbers (e.g. "1e-10") - do you think this will break existing software? I changed osm2pgsql localy to use the %g formatter for my usecase - but I would be grateful if such a change could be incorporated into mainstream, so I do not need to patch the file for every update. What do you think?

My other question would be: How could I disable way_area calculation in a hstore configuration? I understand I can add "way_area" in a normal default.style config file, but when using a hstore.style, I was not capable of disabling the calculation of the way_area.

many thanks and kind regards
Michael


More information about the dev mailing list