Author Topic: [MANUAL] Convert an existing KML/KMZ for offline use  (Read 6938 times)

Offline Ferretty

  • More then Newbie
  • *
  • Posts: 47
  • Karma: +2/-1
    • View Profile
[MANUAL] Convert an existing KML/KMZ for offline use
« on: July 29, 2011, 20:47:11 »
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).

  • Create an empty directory
  • 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).
  • If the directory does not contain a sub-directory named files, create it. Here we place all images
  • With your favorite editor, open the doc.kml and search for all the images. Download/copy them to the files directory
  • replace all links to those images you have in the files directory to point to files/<imagename>
  • 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...
« Last Edit: August 01, 2011, 16:15:15 by Ferretty »

Offline berkley

  • Premium
  • Master of Locus
  • ****
  • Posts: 893
  • Karma: +5/-1
    • View Profile
  • Device: 1+1, N7, TF101
Re: [MANUAL] Convert an existing KML/KMZ for offline use
« Reply #1 on: July 29, 2011, 23:48:30 »
nice manual! thanks!
« Last Edit: January 01, 1970, 01:00:00 by Guest »
Search before posting!!!
XDA Orbit, HTC Touch HD, SGS1, SGS2, Nexus S, S4 Active
OnePlus One

Offline Ferretty

  • More then Newbie
  • *
  • Posts: 47
  • Karma: +2/-1
    • View Profile
Re: [MANUAL] Convert an existing KML/KMZ for offline use
« Reply #2 on: July 30, 2011, 21:47:56 »
Glad you like it! What I forgot to mention explicitely: This way one can manipulate POIs collected with Locus which where exported as KML, add images and descriptions, and make them available for others. Like the ones I posted in the "Tools & Share" area. So if there is interest, I could extend above "howto" with things like how to add descriptions and images if there are none in the KML (like those exported by Locus will probably have no images, I guess -- didn't try that yet).
« Last Edit: January 01, 1970, 01:00:00 by Guest »

Online menion

  • Administrator
  • Professor of Locus
  • *****
  • Posts: 7712
  • Karma: +72/-1
    • View Profile
    • http://www.asamm.com
  • Device: SGS2, Nexus 7
Re: [MANUAL] Convert an existing KML/KMZ for offline use
« Reply #3 on: August 01, 2011, 15:54:47 »
Also one suggestion from me. I don't know if files directory is only valid or not, anyway locus do not support only files/... structure, so you can name your directory as you want. And I also suggest to name it in different way, to prevent overwriting and also allow to simply delete not needed images just in one directory (for one POI category)
« Last Edit: January 01, 1970, 01:00:00 by Guest »
Ideas, wishes, problems
Advanced topics, public discussion, sharing of knowledges, testing beta versions: you're here!
Support over email at support.locus@asamm.com

Offline Ferretty

  • More then Newbie
  • *
  • Posts: 47
  • Karma: +2/-1
    • View Profile
Re: [MANUAL] Convert an existing KML/KMZ for offline use
« Reply #4 on: August 01, 2011, 16:09:01 »
Yupp, OK. I will check that with the Google Specs. I took the name "files/" from what Google Earth uses; but probably the name is not important.

But yes: The KML reference simply says "An HTTP address or a local file specification used to load an icon. " And a bit later, to the <href> in a different context: "Relative URLs can be used in this tag and are evaluated relative to the enclosing KML file." The Tutorial on KMZ files also uses the example "files/" -- but from the description there I take it "an example", and not "the only valid name". In the latter case, it would explicitly state "you have to name it 'files'", which it clearly does not. More directly: "Do not use the .kmz extension for any of the subfolders within a KMZ file." clearly states what I conclude with:

In short: Name it anything you like  :mrgreen:

Edit: I added a remark to my mini-tutorial to point this out.
« Last Edit: January 01, 1970, 01:00:00 by Guest »

Offline Szczepanik

  • More then Newbie
  • *
  • Posts: 34
  • Karma: +0/-0
    • View Profile
Re: [MANUAL] Convert an existing KML/KMZ for offline use
« Reply #5 on: September 25, 2011, 01:42:16 »
Quote from: "Ferretty"
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
Ferrety - thank you very much for this guide :D.  Following it carefully, I have imported Speed Camera Data Base KMZ files including images into Locus 8-). We have 5,449  (Five thousand four hundred and forty nine) speed cameras in Great Britain! :(. Now I know where the fixed ones are!
Cheers
Tom
« Last Edit: January 01, 1970, 01:00:00 by Guest »

Offline Ferretty

  • More then Newbie
  • *
  • Posts: 47
  • Karma: +2/-1
    • View Profile
Re: [MANUAL] Convert an existing KML/KMZ for offline use
« Reply #6 on: September 25, 2011, 21:03:24 »
Glad to read my mini-tutorial was helpful! As you converted such helpful material, did you consider to share it, attaching it to your post in the share forum? Guess there are some more British people around here who could profit from it  :P
« Last Edit: January 01, 1970, 01:00:00 by Guest »

Offline Szczepanik

  • More then Newbie
  • *
  • Posts: 34
  • Karma: +0/-0
    • View Profile
Re: [MANUAL] Convert an existing KML/KMZ for offline use
« Reply #7 on: October 02, 2011, 01:29:48 »
Quote from: "Ferretty"
Glad to read my mini-tutorial was helpful! As you converted such helpful material, did you consider to share it, attaching it to your post in the share forum? Guess there are some more British people around here who could profit from it  :P
See
viewtopic.php?f=15&t=1095&p=6684#p6684
Now I need to work out if Locus can make a sound as I approach the POI
Cheers
Tom
« Last Edit: January 01, 1970, 01:00:00 by Guest »

Offline Ferretty

  • More then Newbie
  • *
  • Posts: 47
  • Karma: +2/-1
    • View Profile
Re: [MANUAL] Convert an existing KML/KMZ for offline use
« Reply #8 on: October 02, 2011, 12:56:05 »
AFAIR there was something like a POI alert in the PRO version only. And thanks for sharing!
« Last Edit: January 01, 1970, 01:00:00 by Guest »

Offline hossini

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: [MANUAL] Convert an existing KML/KMZ for offline use
« Reply #9 on: October 12, 2011, 07:50:47 »
Hi,
i tried to do exactly the same (may be i did something wrong i dont know).

- i downloaded a speedcam *.kml file with linked <href> icons from the internet.
- the file shows well in google-earth
- importing in locus works, but just the same "bump" icon shown for every poi

- i did the changings ( files/ directory, icon download into files/, changing <href> to local, zipping, renaming kmz)
- the file shows well in google-earth
- importing in locus works, but just the same "bump" icon shown for every poi

makes me crazy, is there perhaps any icon-format not supportet (they are *.gif 22x22) ?

Thanky for your help.

Locus is a great Tool :)

Greetings Hossini

PS: i can send kmz if someone wanna see
« Last Edit: January 01, 1970, 01:00:00 by Guest »

Offline Ferretty

  • More then Newbie
  • *
  • Posts: 47
  • Karma: +2/-1
    • View Profile
Re: [MANUAL] Convert an existing KML/KMZ for offline use
« Reply #10 on: October 12, 2011, 08:07:15 »
Hossini, to verify this you could convert the gif to png and use the png instead. Though gif is quite a standard format and should be supported, for png I'm quite sure it actually is.
« Last Edit: January 01, 1970, 01:00:00 by Guest »

Offline hossini

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: [MANUAL] Convert an existing KML/KMZ for offline use
« Reply #11 on: October 12, 2011, 09:52:50 »
Hi,

thank you for your answer.

i looked at the *.gif files, and found that they were *.png files with *.gif extention.
i renamed them and also changed the <href> path again. zipped to *.kmz.
Checked the *.kmz with google earth, everthing works there.

But in Locus there is the same "bump" icon.

next thing is that i trie to reinstall locus. may be there is something with directory rights or something in my system ???
« Last Edit: January 01, 1970, 01:00:00 by Guest »

Offline Ferretty

  • More then Newbie
  • *
  • Posts: 47
  • Karma: +2/-1
    • View Profile
Re: [MANUAL] Convert an existing KML/KMZ for offline use
« Reply #12 on: October 12, 2011, 13:05:26 »
Maybe you try a cleanup first: Remove the old import (POIs as well as their data on the SD card), and then try a fresh import. If that does not help, you still can uninstall/reinstall.
« Last Edit: January 01, 1970, 01:00:00 by Guest »

Offline hossini

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: [MANUAL] Convert an existing KML/KMZ for offline use
« Reply #13 on: October 12, 2011, 18:09:20 »
hi,

did cleanup,
then reinstall ... didnt work ...

may be i still do something wrong.
« Last Edit: January 01, 1970, 01:00:00 by Guest »

Offline Ferretty

  • More then Newbie
  • *
  • Posts: 47
  • Karma: +2/-1
    • View Profile
Re: [MANUAL] Convert an existing KML/KMZ for offline use
« Reply #14 on: October 12, 2011, 19:33:58 »
Did you try the file in Google Maps? Google Earth sometimes behaves a bit different. I noticed that with the exports made from Trip Journal: All showed fine in GE, but not in GM. If it does not show fine in GM, it usually does not show fine in Locus either.
« Last Edit: January 01, 1970, 01:00:00 by Guest »