Skip to content

Add KML/KMZ ground overlay support for templates, import and export - #1793

Merged
dg0yt merged 9 commits into
masterfrom
kmz
Dec 20, 2020
Merged

Add KML/KMZ ground overlay support for templates, import and export#1793
dg0yt merged 9 commits into
masterfrom
kmz

Conversation

@dg0yt

@dg0ytdg0yt commented Dec 6, 2020

Copy link
Copy Markdown
Member

This is a proof-of-concept exploring the feasibiliy of:

  • using GDAL's virtual file system support
  • extending OgrFileImport into creating child templates
  • extending OgrTemplate (TemplateMap) to display child templates

With GDAL's LIBKML driver (available in Linux distro's GDAL, but not yet in our Superbuild), this allows for viewing KMZ files as used by MapRunF, as created following:
http://maprunners.weebly.com/maps---kmz-files.html
via
http://www.p.fne.com.au/rg/cgi-bin/o-utils.cgi

It could be used to complement a future MapRunF compatible KMZ export.

With Mapper loading such files as a map, and already being able to export geospatial vector data, it is also possible to open a KMZ file, draw a single path object for a course, and export as KML. However, I didn't test if this works with MapRunF.

@dg0ytdg0yt self-assigned this Dec 6, 2020

@dg0ytdg0yt left a comment

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Template::isRasterGraphics() property does not match hybrid templates.

Comment threadsrc/templates/template.h Outdated
@dg0yt

Copy link
Copy Markdown
MemberAuthor

Works with Ubuntu 18.04 (against distribution packages).
Works with OpenOrienteering/superbuild#85 (at least for some platforms).

@dg0ytdg0yt mentioned this pull request Dec 12, 2020
@dg0yt
dg0yt marked this pull request as ready for review December 13, 2020 16:20
@dg0yt
dg0ytforce-pushed the kmz branch 2 times, most recently from d5a7d2c to b3b9fafCompareDecember 16, 2020 08:27
@dg0yt
dg0yt changed the base branch from master to build-with-libkmlDecember 16, 2020 08:27
@dg0ytdg0yt changed the title Raster tiles reading for KML/KMZAdd KML/KMZ ground overlay support for templates, import and exportDec 16, 2020
@dg0yt

Copy link
Copy Markdown
MemberAuthor

Now correctly rendering and exporting KMZ files with groundoverlay raster tiles (JPG, 300 dpi, 512 px). Verified with Google Earth. Should work with MapRunF.
Needs GDAL for export. Needs GDAL with LibKML for reading.

@dg0ytdg0yt added this to the v0.9.5 milestone Dec 16, 2020
Base automatically changed from build-with-libkml to masterDecember 16, 2020 18:06
Having the driver name available is useful for extra processing hooks.
Provide a simple API for GDAL's virtual file systems
(/vsizip/, /vsicurl/ etc.).
In order to allow for non-Qt file system paths such as GDAL's virtual
file systems (/vsizip/, /vsicurl/ etc.), make the file lookup
functions virtual and reimplement them in GDAL template classes.
Factor out fields processing, and handle them once per feature, even
before clipping. This moves fields processing out of the object loop,
and it makes them available for additional hooks before clipping the
features and modifying the map.
@dg0yt
dg0ytforce-pushed the kmz branch 2 times, most recently from a670236 to df7b518CompareDecember 19, 2020 22:34
@dg0ytdg0yt linked an issue Dec 19, 2020 that may be closed by this pull request
@dg0yt
dg0ytforce-pushed the kmz branch 2 times, most recently from a5614cc to 0a6304eCompareDecember 19, 2020 23:55
Enable loading and displaying of child templates. This is the base
for dealing with hybrid and multi-file formats, such as KMZ files
which embed raster tiles.
This change enables viewing KML files with raster tiles linked as
GroundOverlay icons by turning them into GDAL raster template.
KMZ files with embedded raster images are supported, too.
This feature requires the LIBKML vector driver in GDAL.
Allow calling drawPage with a different transform, e.g. oriented to
true north.
Add export of KML/KMZ ground overlay files, based on MapPrinter's page
drawing and GDAL's vsizip virtual file system. Other than our existing
output variant (raster, PDF, printing), KML needs raster images
oriented to true north.
Formally, this is a "KML" export, with "KMZ" being a zipped variant.
Following populer recognition and usage, we prefer labelling as "KMZ".
ResolvesGH-138 (KMZ export).
@Eric-P-Kmz

Copy link
Copy Markdown

Hi,

I participate in the development of the free Vikazimut application. Is it possible to do a kmz export of the same format as that of OCAD in OOM (with a single image in the export)?
We use the OCAD export format to georeference the maps to import into the app. The division into several images of the map is not compatible with our import.

@dg0yt

Copy link
Copy Markdown
MemberAuthor

Is it possible to do a kmz export of the same format as that of OCAD in OOM (with a single image in the export)?
We use the OCAD export format to georeference the maps to import into the app. The division into several images of the map is not compatible with our import.

Before adding more code and UI to care for the limitations of Vikazimut, did you consider extending Vikazimuth to handle tiles?

Anyway, it is possible and not too hard to do add an KMZ export with a single raster image instead of tiles. It might come with a simple option to choose the tile size ("256x256", "512x512", "No tiles").

@dg0yt

Copy link
Copy Markdown
MemberAuthor

@Eric-P-Kmz Does the attached file work for you? It contains a KMZ of the complete map example.
tmp.zip

@dg0ytdg0yt mentioned this pull request Feb 25, 2021
2 tasks
@Eric-P-Kmz

Copy link
Copy Markdown

This format is perfect for Vikazimut.
Régis is currently absent but he is contacting you this weekend for your participation in the project. Thank you for your interest

@dg0yt

Copy link
Copy Markdown
MemberAuthor

Merci beaucoup. I'm looking into simple course files right now.

Sign up for freeto 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.

KMZ export

2 participants

@dg0yt@Eric-P-Kmz