Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export georeferencing to OCD more accurately #2096

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

pkturner
Copy link
Contributor

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.

OCAD georeferencing uses map scale (the 'm' parameter) in relation
to grid coordinates.

This commit changes OcdGeorefFields::m from the map's scale_denominator
to its scale in relation to grid coordinates,
i.e.  scale_denominator * combined_scale_factor

When importing an OCD file, the scale denominator is taken from
OcdGeorefFields::m. If the scale denominator must be rounded, the
discrepancy is accounted for by setting the combined_scale_factor,
accurately preserving scale relative to the grid.
@pkturner pkturner linked an issue Sep 23, 2022 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug with auxiliary scale factor in ocad conversion
1 participant