I have done some long-overdue refactoring of the Osmium code which simplifies Osmium itself and simplifies its use. And should make it faster to compile, because only those parts that are really needed are included.
If you are using Osmium in your code, you’ll need to update your code. The most important changes:
- You used to need a call to Osmium::init() before doing anything with the library. This is not needed any more. Just remove it.
- Before including <osmium.hpp> you now need to define one or more of the macros OSMIUM_WITH_PBF_INPUT, OSMIUM_WITH_XML_INPUT, OSMIUM_WITH_PBF_OUTPUT, or OSMIUM_WITH_XML_OUTPUT which enable PBF and XML input and output, respectively. If you don’t want any file input/output don’t include <osmium.hpp>.
- Instead of writing infile.read(handler), you now write Osmium::Input::read(infile, handler).
- Instead of writing outfile.create_output_file() you now write Osmium::Output::open(outfile).
- To enable the shplib or OGR library support you used the OSMIUM_WITH_SHPLIB and OSMIUM_WITH_OGR macros, respectively. Those macros are gone. Just include <osmium/geometry/shplib.hpp> or <osmium/geometry/ogr.hpp>, respectively, if you need support for those libraries.
- Replace all calls to some_osmium_geometry.create_shp_object() with Osmium::Geometry::create_shp_object(some_osmium_geometry).
- Replace all calls to some_osmium_geometry.create_ogr_geometry() with Osmium::Geometry::create_ogr_geometry(some_osmium_geometry).
This is not the end. There are still some things that need refactoring, particularly the GEOS stuff…