[MANUAL] Convert an existing KML/KMZ for offline use

main information about application, developing, permissions, how to ...

[MANUAL] Convert an existing KML/KMZ for offline use

Postby Ferretty » Fri Jul 29, 2011 7:47 pm

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...
Last edited by Ferretty on Mon Aug 01, 2011 3:15 pm, edited 1 time in total.
Ferretty
Newbie
 
Posts: 47
Joined: Sat Jul 23, 2011 8:49 pm
Phone type: Motorola Milestone 2, Android 2.2.2

Re: [MANUAL] Convert an existing KML/KMZ for offline use

Postby berkley » Fri Jul 29, 2011 10:48 pm

nice manual! thanks!
Fighting for Peace is like Fucking for Virginity...

...Download Vector Maps for Locus... - - - ...Want more online maps?...
User avatar
berkley
Master of Locus
 
Posts: 687
Joined: Sat Dec 18, 2010 10:16 am
Location: Bavaria, Germany
Phone type: Galaxy Nexus, Galaxy 7, TF101

Re: [MANUAL] Convert an existing KML/KMZ for offline use

Postby Ferretty » Sat Jul 30, 2011 8:47 pm

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).
Ferretty
Newbie
 
Posts: 47
Joined: Sat Jul 23, 2011 8:49 pm
Phone type: Motorola Milestone 2, Android 2.2.2

Re: [MANUAL] Convert an existing KML/KMZ for offline use

Postby menion » Mon Aug 01, 2011 2:54 pm

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)
Public discussion, sharing a knowledge, testing beta versions: you're here!
Ideas, wishes, problems - use GetSatisfaction
Support email: support.locus@asamm.com

Want to quick chat? HipChat
User avatar
menion
Site Admin
 
Posts: 5393
Joined: Fri Oct 01, 2010 10:53 am
Location: Prague, Czech republic
Phone type: GN, Xoom

Re: [MANUAL] Convert an existing KML/KMZ for offline use

Postby Ferretty » Mon Aug 01, 2011 3:09 pm

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.
Ferretty
Newbie
 
Posts: 47
Joined: Sat Jul 23, 2011 8:49 pm
Phone type: Motorola Milestone 2, Android 2.2.2

Re: [MANUAL] Convert an existing KML/KMZ for offline use

Postby Szczepanik » Sun Sep 25, 2011 12:42 am

Ferretty wrote: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
Szczepanik
Newbie
 
Posts: 34
Joined: Thu Sep 15, 2011 12:00 pm
Phone type: HD2 SD Ram GB 2.3.5

Re: [MANUAL] Convert an existing KML/KMZ for offline use

Postby Ferretty » Sun Sep 25, 2011 8:03 pm

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
Ferretty
Newbie
 
Posts: 47
Joined: Sat Jul 23, 2011 8:49 pm
Phone type: Motorola Milestone 2, Android 2.2.2

Re: [MANUAL] Convert an existing KML/KMZ for offline use

Postby Szczepanik » Sun Oct 02, 2011 12:29 am

Ferretty wrote: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
Szczepanik
Newbie
 
Posts: 34
Joined: Thu Sep 15, 2011 12:00 pm
Phone type: HD2 SD Ram GB 2.3.5

Re: [MANUAL] Convert an existing KML/KMZ for offline use

Postby Ferretty » Sun Oct 02, 2011 11:56 am

AFAIR there was something like a POI alert in the PRO version only. And thanks for sharing!
Ferretty
Newbie
 
Posts: 47
Joined: Sat Jul 23, 2011 8:49 pm
Phone type: Motorola Milestone 2, Android 2.2.2

Re: [MANUAL] Convert an existing KML/KMZ for offline use

Postby hossini » Wed Oct 12, 2011 6:50 am

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
hossini
 
Posts: 7
Joined: Thu Mar 31, 2011 4:38 am
Phone type: Moto Defy

Re: [MANUAL] Convert an existing KML/KMZ for offline use

Postby Ferretty » Wed Oct 12, 2011 7:07 am

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.
Ferretty
Newbie
 
Posts: 47
Joined: Sat Jul 23, 2011 8:49 pm
Phone type: Motorola Milestone 2, Android 2.2.2

Re: [MANUAL] Convert an existing KML/KMZ for offline use

Postby hossini » Wed Oct 12, 2011 8:52 am

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 ???
hossini
 
Posts: 7
Joined: Thu Mar 31, 2011 4:38 am
Phone type: Moto Defy

Re: [MANUAL] Convert an existing KML/KMZ for offline use

Postby Ferretty » Wed Oct 12, 2011 12:05 pm

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.
Ferretty
Newbie
 
Posts: 47
Joined: Sat Jul 23, 2011 8:49 pm
Phone type: Motorola Milestone 2, Android 2.2.2

Re: [MANUAL] Convert an existing KML/KMZ for offline use

Postby hossini » Wed Oct 12, 2011 5:09 pm

hi,

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

may be i still do something wrong.
hossini
 
Posts: 7
Joined: Thu Mar 31, 2011 4:38 am
Phone type: Moto Defy

Re: [MANUAL] Convert an existing KML/KMZ for offline use

Postby Ferretty » Wed Oct 12, 2011 6:33 pm

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.
Ferretty
Newbie
 
Posts: 47
Joined: Sat Jul 23, 2011 8:49 pm
Phone type: Motorola Milestone 2, Android 2.2.2

Re: [MANUAL] Convert an existing KML/KMZ for offline use

Postby hossini » Thu Oct 13, 2011 7:23 am

Hi, it works on google earth, but cannot load in google maps.
It's a big file, about 15000 POI (all german Speedcams).

The File is like this:

Even if i cut ~14999 POI's and just leave one left in the file, it doesnt show the ICON in Locus given by the URL...

Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.1">
<Document>
<Folder>
<name></name>
<open>1</open>
<Placemark>
  <description><![CDATA[ ]]></description>
    <name>10 </name>
    <visibility>0</visibility>
    <styleUrl>root://styles#default</styleUrl>
    <Style>
      <IconStyle>
        <scale>0.6</scale>
        <Icon>
          <href>http://www.navifriends.com/nfpois/grafik/bitmapsovl/blitzer-10.gif</href>
        </Icon>
      </IconStyle>
        <LabelStyle>
          <scale>0.8</scale>
        </LabelStyle>
    </Style>
    <Point>
      <extrude>1</extrude>
      <altitudeMode>relativeToGround</altitudeMode>
      <coordinates>8.545950,49.318710,10</coordinates>
    </Point>
</Placemark>
</Folder>

<Folder>
<name>Blitzer-10</name>
<Placemark>
  <description><![CDATA[ ]]></description>
    <name>10-m </name>
    <visibility>0</visibility>
    <styleUrl>root://styles#default</styleUrl>
    <Style>
      <IconStyle>
        <scale>0.6</scale>
        <Icon>
          <href>http://www.navifriends.com/nfpois/grafik/bitmapsovl/blitzer-10-m.gif</href>
        </Icon>
      </IconStyle>
        <LabelStyle>
          <scale>0.8</scale>
        </LabelStyle>
    </Style>
    <Point>
      <extrude>1</extrude>
      <altitudeMode>relativeToGround</altitudeMode>
      <coordinates>6.749887,49.339665,10</coordinates>
    </Point>
</Placemark>

<Placemark> ........
hossini
 
Posts: 7
Joined: Thu Mar 31, 2011 4:38 am
Phone type: Moto Defy

Re: [MANUAL] Convert an existing KML/KMZ for offline use

Postby menion » Thu Oct 13, 2011 7:47 am

I'm testing your file and problem is caused by
Code: Select all
<styleUrl>root://styles#default</styleUrl>

.. what's that?? Is this line valid? delete this line and import will work fine.
Public discussion, sharing a knowledge, testing beta versions: you're here!
Ideas, wishes, problems - use GetSatisfaction
Support email: support.locus@asamm.com

Want to quick chat? HipChat
User avatar
menion
Site Admin
 
Posts: 5393
Joined: Fri Oct 01, 2010 10:53 am
Location: Prague, Czech republic
Phone type: GN, Xoom

Re: [MANUAL] Convert an existing KML/KMZ for offline use

Postby hossini » Thu Oct 13, 2011 10:58 am

Hi, THATS IT, now it works perfectly. Thanks very much.
hossini
 
Posts: 7
Joined: Thu Mar 31, 2011 4:38 am
Phone type: Moto Defy

Re: [MANUAL] Convert an existing KML/KMZ for offline use

Postby menion » Thu Oct 13, 2011 12:09 pm

you're welcome. StyleUrl, defined here http://code.google.com/apis/kml/documen ... l#styleurl is weird in your case. Anyway Locus do not support external styleUrl paths, so even when path to file with styles will be valid, this will not work. So if you want to use some custom styles, put them into same file as data
Public discussion, sharing a knowledge, testing beta versions: you're here!
Ideas, wishes, problems - use GetSatisfaction
Support email: support.locus@asamm.com

Want to quick chat? HipChat
User avatar
menion
Site Admin
 
Posts: 5393
Joined: Fri Oct 01, 2010 10:53 am
Location: Prague, Czech republic
Phone type: GN, Xoom

Re: [MANUAL] Convert an existing KML/KMZ for offline use

Postby Ferretty » Thu Oct 13, 2011 12:54 pm

Exactly. I just see I missed to mention that in my mini-tutorial. Just take one of my small KMZ files from the shared area of this forum to look at how to define them internally.
Ferretty
Newbie
 
Posts: 47
Joined: Sat Jul 23, 2011 8:49 pm
Phone type: Motorola Milestone 2, Android 2.2.2


Return to Information

Who is online

Users browsing this forum: No registered users and 1 guest