User Tools

Site Tools


manual:advanced:data_tools:kml_conversion_offline

This is an old revision of the document!


Convert an existing KML/KMZ for offline use


This page is obsolete and will be reworked soon

Basic information

Author: Ferretty

Locus version (min):

Created: 29. 7. 2011

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 before – i.e. if you watched them all before. With version 1.9.4.2 of Locus, menion features to import KMZ files including images – and those KMZ files I am refering to here. With a few steps, you can include the images with the KMZ, and import that file into Locus:

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 or 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. With your favorite editor, open the doc.kml 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 to files/<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>http://maps.google.com/mapfiles/kml/shapes/hiker.png</href> This should read <href>files/hiker.png</href> afterwards.

Image-example: <img src=“http://www.example.com/images/foo.jpg”> 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 will be 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 are all those images belong to, you have an 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.1431666055.txt.gz · Last modified: 2015/05/15 07:00 (external edit)