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

Bug with auxiliary scale factor in ocad conversion #2080

Open
eolmapper opened this issue Jul 24, 2022 · 13 comments · May be fixed by #2096
Open

Bug with auxiliary scale factor in ocad conversion #2080

eolmapper opened this issue Jul 24, 2022 · 13 comments · May be fixed by #2096

Comments

@eolmapper
Copy link

Steps to reproduce

1.Create a new project georerenced in UTM.
The grivation differt than 0, and auxiliary scale factor is not 1.
All it's right for the moment.
2.Convert this map to OCad format.
3.Re-open it in mapper.

Actual behaviour

Now the auxiliary scale factor as changed.
If we open this file as background map in the original project the map is mis placed.

Expected behaviour

The auxiliary scale factor should be constant when we convert à file in ocad format.

Configuration

Mapper Version: 9.4 / 9.5
Operating System:Windows

@pkturner
Copy link
Contributor

Following Step 1 (creating a UTM-georeferenced project), I saw the auxiliary scale factor was 1, and the combined scale factor was not 1.

Although this behavior is not what was reported for step 1, Mapper may not do what you expect for step 3, because OCAD does not provide for an auxiliary scale factor (as far as I can tell). There's no way for Mapper to save the auxiliary scale factor in an OCAD-format file. When Mapper reads an OCAD file, it assumes the combined scale factor is 1.0.

When the combined scale factor is 1.0, then the auxiliary scale factor must be the reciprocal of the grid scale factor, which is a property of the projection.

@pkturner
Copy link
Contributor

If I understand the cause of this issue, it occurs when the combined scale factor differs from 1.0. The background map and original map become misaligned in proportion to distance from the reference point.

A workaround would be to use the Georeferencing dialog to adjust the combined scale factor to 1.0 before exporting in OCAD format. When it asks about stretching/shrinking the map content, say "Yes".

@eolmapper
Copy link
Author

eolmapper commented Aug 1, 2022

Thank you for the answer and the explanation.

If I understand the cause of this issue, it occurs when the combined scale factor differs from 1.0. The background map and original map become misaligned in proportion to distance from the reference point.

=> exactly
I have two points that interest me:

  • I noticed that, if I georeference the map with an OSM file as described in the manual, the auxiliary scale factor is different from 1 (0.99.......). On the other hand, if I enter exactly the same coordinates manually, the auxiliary scale factor is actually still 1. why this difference, and who is right.

  • Currently OOM generates a badly georeferenced Ocad file. If I load a georeferenced file (shapefile) directly in ocad I find an offset.

A workaround would be to use the Georeferencing dialog to adjust the combined scale factor to 1.0 before exporting in OCAD format. When it asks about stretching/shrinking the map content, say "Yes".

When importing, shouldn't OOM assume that the auxiliary scale factor is 1 instead of the combined scale factor.
Shouldn't this be integrated into the import export routine to ocd format for générate correct ocd files?
Because as I understand it, the scale of the drawing in a georeferenced OOM file is based on the scale of the model (unless the auxiliary scale factor is changed and becomes different from 1). While in a georeferenced ocd file the scale of the drawing is based on the grid.

@pkturner
Copy link
Contributor

pkturner commented Aug 2, 2022

I noticed that, if I georeference the map with an OSM file as described in the manual, the auxiliary scale factor is different from 1 (0.99.......). On the other hand, if I enter exactly the same coordinates manually, the auxiliary scale factor is actually still 1. why this difference, and who is right.

When I do as the manual describes, and load an OSM template right after creating the map, Mapper sets up the georeferencing with an auxiliary scale factor of 1.000000 for me. This makes sense because it creates a custom orthographic projection centered at the reference point. Are you doing something different?

@pkturner
Copy link
Contributor

pkturner commented Aug 2, 2022

Currently OOM generates a badly georeferenced Ocad file. If I load a georeferenced file (shapefile) directly in ocad I find an offset.

Yes, a georeferenced map developed in OCAD would have all relationships on the map drawn with a slightly different scale. Note that the purpose of Mapper's auxiliary scale factor is to compensate for small differences in scale due to altitude and to standard projections. Your .ocd file exported by Mapper has georeferencing offsets, but it has a scale that is superior to an OCAD map.

If Mapper were “fixed” so that it exports .ocd files with better georeferencing, then it must either (1) stretch/reduce all the distances on the map, or (2) record the map's scale to be something like 1:10,005.

@pkturner
Copy link
Contributor

pkturner commented Aug 2, 2022

Because as I understand it, the scale of the drawing in a georeferenced OOM file is based on the scale of the model (unless the auxiliary scale factor is changed and becomes different from 1). While in a georeferenced ocd file the scale of the drawing is based on the grid.

That's my understanding, too, though I don't have OCAD to create a good example of the latter. The scale of a georeferenced .omap file is based on an ellipsoid model of Earth, and the projection from the grid to that model. The discrepancy between the two scales is the grid scale factor.

When transforming between grid and map coordinates, Mapper applies both the grid scale factor (to compensate for distortion in the projection) and the auxiliary scale factor (an adjustment at the user's discretion). Those two factors taken together are the combined scale factor. OCAD uses the grid scale directly so it does not make these adjustments. In effect, OCAD's combined scale factor is 1.0.

For this reason, Mapper is correct to set combined scale factor to 1 when importing a .ocd file.

@eolmapper
Copy link
Author

If Mapper were “fixed” so that it exports .ocd files with better georeferencing, then it must either (1) stretch/reduce all the distances on the map, or (2) record the map's scale to be something like 1:10,005.

Yes (1) is the good solution for me. (even though it degrades accuracy but improve compatibility)

If we consider that we do not apply an auxiliary scale factor (always =1), when we create a map in OOM the combined scale = 1(auxiliary scale factor)x Grind scale factor 0.99 (for example )=0.99
So we have a offset between the grid and the map which is managed by this factor. if we cannot store this factor in an ocd file, the offset is no longer managed, so you must stretch/reduce all the distances on the map to remove this offset.

@eolmapper
Copy link
Author

For this reason, Mapper is correct to set combined scale factor to 1 when importing a .ocd file

Yes I understand.
The combined factor is indeed =1 in OCD file but with something like: grid factor:1 x auxiliary scale factor:1=combined scale factor:1
This is not exactly what OOM does when importing which considers the combined scale factor=1, The grid scale factor is calculated from the projection (0,99 for example) so the auxiliary scale factor must be =1,01
It's good for now, OOM doesn't apply compensation to the map, but won't that be a problem later?

@eolmapper
Copy link
Author

When I do as the manual describes, and load an OSM template right after creating the map, Mapper sets up the georeferencing with an auxiliary scale factor of 1.000000 for me. This makes sense because it creates a custom orthographic projection centered at the reference point. Are you doing something different?

I don't do anything different.
In a new project, I load as template an osm file like this one.
map.zip
Before choosing the projection => auxiliary scale factor is already =0,999777
(this was not the case before loading the osm file)

@pkturner
Copy link
Contributor

pkturner commented Aug 3, 2022

Thanks for providing the .osm file! When I tried it on my development Linux system I still got an auxiliary scale factor of 1.000000. So I tried it on a Macintosh and saw the behavior you report.

Then I recalled the discrepancy described in #2016. My Linux has PROJ 9.0, whereas the Mac release of Mapper 0.9.5 uses PROJ 7.1.1. The newer PROJ handles orthographic projections using a better ellipsoid, which is why on the Linux version I saw the auxiliary scale factor and grid scale factor equal to 1.000000.

@pkturner
Copy link
Contributor

pkturner commented Aug 3, 2022

When importing a .ocd file ...

It's good for now, OOM doesn't apply compensation to the map, but won't that be a problem later?

When Mapper imports the georeferenced objects, they will be positioned correctly, using the georeferencing of the imported file together with the georeferencing of Mapper's map.

What use case do you have in mind for “later”?

@pkturner
Copy link
Contributor

pkturner commented Aug 4, 2022

If Mapper were “fixed” so that it exports .ocd files with better georeferencing, then it must either (1) stretch/reduce all the distances on the map, or (2) record the map's scale to be something like 1:10,005.

Yes (1) is the good solution for me. (even though it degrades accuracy but improve compatibility)

Now I believe this issue should be fixed by (1) stretching/reducing all the distances on the map.

My reasoning is that the exported map has a simplified georeferencing. If in Mapper I created a new map with that simplified georeferencing, and imported the original map, Mapper would silently stretch/reduce the imported map. So it makes sense to do the same thing on export (without the complexity of requiring the user to intervene. or click OK).

@pkturner
Copy link
Contributor

as I understand it, the scale of the drawing in a georeferenced OOM file is based on the scale of the model (unless the auxiliary scale factor is changed and becomes different from 1). While in a georeferenced ocd file the scale of the drawing is based on the grid.

This is right on the mark. Mapper’s “map scale” is relative to the ellipsoid model (optionally adjusted by the auxiliary scale factor). OCAD’s “map scale” is relative to the grid.

Having in mind that I would prepare a PR to address this issue, on further thought the simplest and most direct fix would be my “(2) record the map's scale to be something like 1:10,005”. It recognizes that Mapper and OCAD give different meanings to the "map scale", so there should not be an expectation that, for a particular georeferenced map, Mapper and OCAD would report the identical scale. Furthermore, (2) respects that the map is primarily a drawing on paper, and would not disrupt any paper distances.

A reservation is that the file format does not support decimal fractions in the scale. As a consequence, rounding the map-to-grid scale for export will involve some loss of georeferencing accuracy. Assuming the reference point is within the map, I estimate that a typical map would have a georeferencing discrepancy of up to 0.2 meter.

When importing an OCAD file to a new map, the inverse reasoning would apply, and again Mapper's “map scale” should not be identical to the value in the OCAD file. I have not looked into how Mapper currently addresses this subtlety on import.

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 a pull request may close this issue.

2 participants