User Tools

Site Tools


Conversion of a KML/KMZ file for offline use

Basic information

Author: Ferretty

How to

Of course you can use any KML/KMZ offline. But if it links some images (icons and pictures), those won't be available offline if they haven't been cached (displayed) before. Since Locus Map version the app features importing KMZ files including images - and those KMZ files I am referring to here. With a few steps you can include the images with the KMZ and import that file into Locus Map:

Remark first: In my example here I use the name “files” for the folder containing our images, as this is the name used by Google Earth KMZ export, and also used in Googles KMZ Tutorial. As it turned out later in this thread, it is a good idea to use a different name. Feel free to do so - the folder name just must not end with .kmz, no other restrictions appear in either the tutorial nor the reference (or I must have missed them).

  1. Create an empty directory
  2. If your original file is a KML, just copy it into this directory and name it doc.kml. If it is a KMZ, unpack it into this directory (it is a ZIP file).
  3. If the directory does not contain a sub-directory named “files”, create it. Here we place all images
  4. Open the doc.kml with your favorite editor and search for all the images. Download/copy them to the “files” directory
  5. replace all links to those images you have in the “files” directory to point tofiles/<imagename>
  6. ZIP the resulting directory and make sure the resulting file has the extension .kmz

That's all. But I will explain steps 4 and 5 a bit closer:

Step 4: Where to check for the images? They are in two places: One is the icons in the styles, and the others are the <IMG> tags in the description. The former are enclosed with a <href> tag.

Step 5: Renaming examples Icon-Example: <href></href> This should read <href>files/hiker.png</href> afterwards.

Image-example: <img src=“”> As currently there is no cleanup mechanism in Locus, it is a good idea to include the KMZ name in all those image names. So if your resulting KMZ is greece.kmz, you should have stored this image as greece_foo.jpg in the files folder, and thus this image tag should now read <img src=“files/greece_foo.jpg”> - so if you later wonder what all those images belong to, you have easier guess on which ones you may remove.

So far, this is a general explanation. If you have complex descriptions in the KML file, you may need to reformat them as well. This won't be necessary for plain flowing text, but probably will be the case for multi-column tables. Those are fine with a large monitor, but will cause a lot of scrolling on a phone display…

manual/advanced/data_tools/kml_conversion_offline.txt · Last modified: 2015/09/02 15:48 by mstupka