b-r-u / osmpbf

A Rust library for reading the OpenStreetMap PBF file format (*.osm.pbf).
Apache License 2.0
122 stars 19 forks source link

Integer coordinate functions #2

Closed danlarkin closed 4 years ago

danlarkin commented 4 years ago

This adds nano_lat/lon and decimicro_lat/lon methods to Node and DenseNode for those situations where the cast to a floating point number is unnecessary.

b-r-u commented 4 years ago

Thanks! These changes are looking good. I am just wondering why you included the decimicro_* methods. Is there are common application for this specific precision to warrant another method?

danlarkin commented 4 years ago

OSM PBFs usually (always?) include only enough lat/lon precision to fill 32 bits, so it's just the most compact lossless representation of the stored data. And for plenty of calculations there's no reason to take up 4 extra bytes with zeros.

Thanks for your quick response.

b-r-u commented 4 years ago

That's a good reason :)