Locus Map - forum

Support => Information => Topic started by: Ferretty on July 29, 2011, 20:47:11

Title: [MANUAL] Convert an existing KML/KMZ for offline use
Post by: Ferretty 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 (//http://code.google.com/apis/kml/documentation/kmzarchives.html). 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).


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...
Title: Re: [MANUAL] Convert an existing KML/KMZ for offline use
Post by: berkley on July 29, 2011, 23:48:30
nice manual! thanks!
Title: Re: [MANUAL] Convert an existing KML/KMZ for offline use
Post by: Ferretty 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).
Title: Re: [MANUAL] Convert an existing KML/KMZ for offline use
Post by: Menion 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)
Title: Re: [MANUAL] Convert an existing KML/KMZ for offline use
Post by: Ferretty 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 (//http://code.google.com/apis/kml/documentation/kmzarchives.html) 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.
Title: Re: [MANUAL] Convert an existing KML/KMZ for offline use
Post by: Szczepanik 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
Title: Re: [MANUAL] Convert an existing KML/KMZ for offline use
Post by: Ferretty 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 (//http://forum.asamm.cz/viewtopic.php?f=15&t=1095)? Guess there are some more British people around here who could profit from it  :P
Title: Re: [MANUAL] Convert an existing KML/KMZ for offline use
Post by: Szczepanik 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 (//http://forum.asamm.cz/viewtopic.php?f=15&t=1095)? 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 (http://forum.asamm.cz/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
Title: Re: [MANUAL] Convert an existing KML/KMZ for offline use
Post by: Ferretty on October 02, 2011, 12:56:05
AFAIR there was something like a POI alert in the PRO version only. And thanks for sharing!
Title: Re: [MANUAL] Convert an existing KML/KMZ for offline use
Post by: hossini 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
Title: Re: [MANUAL] Convert an existing KML/KMZ for offline use
Post by: Ferretty 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.
Title: Re: [MANUAL] Convert an existing KML/KMZ for offline use
Post by: hossini 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 ???
Title: Re: [MANUAL] Convert an existing KML/KMZ for offline use
Post by: Ferretty 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.
Title: Re: [MANUAL] Convert an existing KML/KMZ for offline use
Post by: hossini on October 12, 2011, 18:09:20
hi,

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

may be i still do something wrong.
Title: Re: [MANUAL] Convert an existing KML/KMZ for offline use
Post by: Ferretty 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.
Title: Re: [MANUAL] Convert an existing KML/KMZ for offline use
Post by: hossini on October 13, 2011, 08:23:45
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...

<?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> ........
Title: Re: [MANUAL] Convert an existing KML/KMZ for offline use
Post by: Menion on October 13, 2011, 08:47:10
I'm testing your file and problem is caused by
<styleUrl>root://styles#default</styleUrl> .. what's that?? Is this line valid? delete this line and import will work fine.
Title: Re: [MANUAL] Convert an existing KML/KMZ for offline use
Post by: hossini on October 13, 2011, 11:58:25
Hi,  THATS IT, now it works perfectly. Thanks very much.
Title: Re: [MANUAL] Convert an existing KML/KMZ for offline use
Post by: Menion on October 13, 2011, 13:09:33
you're welcome. StyleUrl, defined here http://code.google.com/apis/kml/documen ... l#styleurl (http://code.google.com/apis/kml/documentation/kmlreference.html#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
Title: Re: [MANUAL] Convert an existing KML/KMZ for offline use
Post by: Ferretty on October 13, 2011, 13:54:20
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.