Export georeferencing to OCD more accurately #2096
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change addresses the case described in #2080, in which a map was exported to an OCAD file format, and then when imported its map objects were offset from their original geolocations.
First, it changes handling of the georeferencing scale and offsets from integers to floating point. Actually, Mapper was already reading those values as floating point during import. All that was necessary was (1) eliminate some intermediate conversions to integer, and (2) use floating point formatting for output, with appropriate precision.
I tested that a current version of OCAD accepts floating point values in the input. It does sometimes round them to integers, which can affect the geolocations of map objects.
Second, this change addresses that OCAD's map scale is calculated relative to the projected grid, which differs from Mapper's map scale that is relative to the ellipsoid shape of the earth. For example, start with the OSM data provided in #2080. At that location, the grid scale factor for UTM is 0.9996. If Mapper creates a map from that OSM data with a scale of 1:10,000 and a UTM coordinate system, then the map scale from the OCAD point of view is 1:9,996.
This change is not high priority, because the offsets that it fixes are on the order of 1 meter in the example that I checked. It's a pretty straightforward fix, but there's some risk of being less compatible with OCAD. On the whole I believe it is worthwhile, and is a good way to address #2080.