OpenOrienteering / mapper

OpenOrienteering Mapper is a software for creating maps for the orienteering sport.
https://www.openorienteering.org/apps/mapper/
GNU General Public License v3.0
402 stars 106 forks source link

KML georeferencing not working correctly #2180

Open bimjarr opened 1 year ago

bimjarr commented 1 year ago

Openorienteeringmap V4 supports a choice of true north or magnetic north. When importing a georeferenced KML file I cannot find a way of placing it correctly aligned to a magnetic north referenced template.

Our (OrienteeringWairarapa) quick fire way of producing street events is: Create a PDF and georeferenced KMZ using openorienteeringmap. Create a georeferenced KML through one of several methods (Maprun, Google earth etc). Create a new map in Mapper. Open the KMZ file as a template Import the KML file. Create a PDF with the template visible. The PDF can now be used as basemap in Purple Pen to allow various changes including cosmetic changes to controls. The final step is to replace the Purple Pen basemap with the original PDF.

This process has always worked perfectly, and still does with a true north template, but not with a magnetic north based template.

Incidentally, Maprun does align both KMZ and KML file correctly when imported to it’s Create KML Course function.

pkturner commented 1 year ago

Is the alignment incorrect as soon as you import the KML into the map that has the KMZ template? Or does the alignment problem appear later on?

I tried creating a new map with a KMZ template as you describe. When I import a KML track into that map, it is aligned and georeferenced correctly.

I don't understand what version of Mapper you are using. I'm using the latest release which is 0.9.5.

pkturner commented 1 year ago

Another question. What do you mean by "magnetic north based template"? When I attempted to reproduce this issue, I started in Mapper with a map that is oriented to magnetic north. When I exported a georeferenced KMZ, the internals of the KMZ file consisted of raster image squares oriented to true north. That could be expected, because KML/KMZ use a standard coordinate system based on latitude and longitude.

In Mapper, when you create a new map and immediately open a georeferenced template, Mapper prompts you to set the new map's georeferencing. When I opened the KMZ template, Mapper suggested a geoereferencing with a declination of 0, i.e. oriented to true north. At that point you can set the declination to a good local value. But whether I set the declination or not, after importing the KML track I see it aligned correctly with the template.

cadnant commented 7 months ago

OpenOrienteeringMap generates kmz map files that can be orientated to grid N, mag N or at an arbitrary angle. PDF output can be similarly rotated. Mapper will correctly rotate a PDF import but not a kmz import - see linked example files.

pkturner commented 7 months ago

Thanks for the examples. They will help.

dg0yt commented 7 months ago

Mapper supports KML via the GDAL library. IIUC this KML file uses a rotation property in <LatLonBox> which is standardized but not implemented in GDAL: https://github.com/OSGeo/gdal/blob/master/ogr/ogrsf_frmts/libkml/ogrlibkmlgeometry.cpp#L679-L704

There is an open issue for "Superoverlays" whatever this means: https://github.com/OSGeo/gdal/issues/6093

It also seems to affect QGIS and direct GDAL use: https://duckduckgo.com/?q=kmz+rotation