Author Topic: Importing Icons with KMZ File  (Read 635 times)

Offline Stephan_Saxy

  • Newbie
  • *
  • Posts: 2
    • View Profile
Importing Icons with KMZ File
« 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>
 

Offline Menion

  • Locus team
  • Professor of Locus
  • *****
  • Posts: 12336
  • Thanked: 714 times
    • View Profile
    • http://www.asamm.com
  • Device: Pixel 2
Re: Importing Icons with KMZ File
« Reply #1 on: May 14, 2021, 09:33:13 »
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 final download
 
The following users thanked this post: Stephan_Saxy

Offline Stephan_Saxy

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Importing Icons with KMZ File
« Reply #2 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!
 

Offline Menion

  • Locus team
  • Professor of Locus
  • *****
  • Posts: 12336
  • Thanked: 714 times
    • View Profile
    • http://www.asamm.com
  • Device: Pixel 2
Re: Importing Icons with KMZ File
« Reply #3 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 ...
- Official help (ideas, questions, problems): help.locusmap.eu
- Advanced topics, sharing of knowledges: you're here!
- LM 4 Beta download, LM 4 final download