joto / osmium

C++/Javascript framework for working with OSM files.
http://wiki.openstreetmap.org/wiki/Osmium
GNU General Public License v3.0
123 stars 31 forks source link

haversine formula uses coordinates also when position().defined() is false #86

Open dforsi opened 10 years ago

dforsi commented 10 years ago

Since it can happen that data extracts do not contain complete geometries, it would be useful at least to document the need to pass to Osmium::Geometry::Haversine::distance() only ways for which all node coordinates are available.

joto commented 10 years ago

There are other places where undefined positions can be used without the user noticing. This has always been somewhat problematic. The proper solution might be to throw an exception whenever an undefined position is used. The new osmium version solves this in a different way: It gives the user the choice whether to ignore errors or not in the node location store handler.

Please tell me if anybody has a good idea how to solve this without peppering the code with try-catch-blocks.