Locus Map - forum

Content & Tools => Cursors / Icons / Voices => Topic started by: Stephan_Saxy on May 13, 2021, 15:52:49

Title: Importing Icons with KMZ File
Post by: Stephan_Saxy on May 13, 2021, 15:52:49
Hello together,

I have written a python script that saves some data (comments, routes etc) of peaks in Swiss Saxony in KMZ file. Now my idea was to give the peaks different icons depending on the difficulties or quality of the routes. Let's say green, yellow, and red icons. Now my question is, can I save the icons directly in the KMZ file and show them in locus map, or do I have to save the icons first in the /locus/icons folder? Because I can not see my generated icons.

Best regards,
Stephan

In the moment the KML looks the following:
<?xml version="1.0" encoding="utf-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
<Document>
<name>Juliturm</name>
   <atom:author><atom:name>Locus (Android)</atom:name></atom:author>
   <Style id="icon_climbing_hard.png">
      <IconStyle>
         <Icon><href>files/icon_climbing_hard.png</href></Icon>
         <hotSpot x="0.5" y="0.0" xunits="fraction" yunits="fraction" />
      </IconStyle>
   </Style>
   
<Placemark><name>Hocksteinnadel</name>
<styleUrl>#icon_climbing_hard.png</styleUrl>
<ExtendedData>
<lc:attachment>files/Hocksteinnadel.png</lc:attachment>
<lc:attachment>files/Hocksteinnadel.pdf</lc:attachment>
</ExtendedData>
>   <Point>
<coordinates>14.100730000000000,50.979830000000000,100.0</coordinates>
</Point></Placemark>
</Document></kml>
Title: Re: Importing Icons with KMZ File
Post by: Menion on May 14, 2021, 09:33:13
Hi,
may you please share any sample file? This should work without a problem. Thanks.
Title: Re: Importing Icons with KMZ File
Post by: Stephan_Saxy on May 14, 2021, 16:47:51
A friendly user send me a working KMZ so I could modify the code for my case.

The solution is:
        <Style>
            <IconStyle>
                <Icon>
                    <href>files/icon_climbing_hard.png</href>
                </Icon>
            </IconStyle>
        </Style>

instead of

<styleUrl>#icon_climbing_hard.png</styleUrl>

Now it works. Thanks again!
Title: Re: Importing Icons with KMZ File
Post by: Menion on May 17, 2021, 07:06:47
Hi, only difference I see is removed "hotspot". Did it help? Because the app should correctly load hotspot parameters as well ...