Omap-rs
A library for working with OpenOrienteering Mapper's .omap files.
For writing new files you can either start with a completely empty map Omap::new or use one of the provided templates Omap::default_15_000, Omap::default_10_000 or Omap::default_4_000.
Or you can start from an already existing file with Omap::from_path.
Geo-referencing
With the geo_ref-feature automatic geo-referencing with magnetic north and scale factor calculation is enabled and done with the omap::GeoRef::initialize function.
It is not enabled by default because of the extra dependencies needed (Proj4rs for coordinate projections, WMM for magnetic north calcualtion and Chrono for time as the magnetic north changes over time). Without this feature the georeferencing must be done by hand.
NB! if you change any field (or the entire thing) in the map's geo_referencing-field then all the map objects projected/geographic positions will change as their coordinates are given in mm-of-paper and remain untouched.
The best practice is to set the map's geo referencing before adding any objects.
omap::geo_referencing::MapTransform provides functions for going back and forth between mm-of-paper and projected coordinates given by map's georeferencing. And is obtained with calling get_transform on the map's geo_referencing-field.
MapTransform::affine_between can be used to keep objects and non-georeferenced templates at the same projected positions after changing map reference point, scale, or rotation within the same CRS representation. It deliberately rejects transforms whose CRS fingerprints differ, for example different EPSG codes.
This is a conservative lightweight guard; omap-rs does not normalize equivalent CRS definitions or transform coordinates between different projections.
Dash-points and beziers
Line and area objects expose their exact mixed straight/cubic geometry through
bezier_geometry(). Its per-vertex metadata includes forced dash points,
including both endpoints of an open path. The ordinary get_geometry(error)
API lazily provides and caches a flattened LineString or Polygon.
Objects that are not edited are written back using their original coordinates
and flags. Added or edited line and area objects can be fitted to Bézier curves
on write by setting bezier_write_error.
Example