Importing Icons with KMZ File

Started by Stephan_Saxy, May 13, 2021, 15:52:49

0 Members and 1 Guest are viewing this topic.

Stephan_Saxy

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>
  •  

Menion

Hi,
may you please share any sample file? This should work without a problem. Thanks.
- Official help (ideas, questions, problems): help.locusmap.eu
- Advanced topics, sharing of knowledges: you're here!
- LM 4 Beta download, LM 4 Release download

Stephan_Saxy

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!
  •  

Menion

Hi, only difference I see is removed "hotspot". Did it help? Because the app should correctly load hotspot parameters as well ...
- Official help (ideas, questions, problems): help.locusmap.eu
- Advanced topics, sharing of knowledges: you're here!
- LM 4 Beta download, LM 4 Release download
  •