2

I have quite literally never tried to edit a kml file before, so I'm not totally sure of what I'm trying to ask, but I'll do my best.

I'm trying to use custom icons for my placemarkers. I tried to upload the images to a hosting site and link to them, and I also tried putting them into a subfolder and referencing the local address. Here are those attempts.

  <Style id="1">
    <IconStyle>
      <Icon>
    <href>https://cdn1.imggmi.com/uploads/2019/3/8/63626b5bc964d76ca0d5bdb30fb44afd-full.png</href>
      </Icon>
    </IconStyle>
    </Style>

And the second method:

  <Style id="1">
    <IconStyle>
      <Icon>
        <href>files/number_1.png</href>
      </Icon>
    </IconStyle>
    </Style>

And the placemarker references the style like this:

        <Placemark>
            <styleUrl>#1</styleUrl>
            <Point>
                <coordinates>-86.78824404543640,36.41901416833124,1005.84</coordinates>
                <altitudeMode>absolute</altitudeMode>
            </Point>
        </Placemark>

No matter what I do, I can't get the icon to show up in GE. I have read a bunch of different tutorials, tried naming the folder and subfolder differently, and tried making a kmz with the kml in the main folder and the icons in a subfolder. Nothing seems to work. It feels like I'm missing something basic or fundamentally misunderstanding some aspect of this, but for the life of me I can't seem to figure it out!

Any help is appreciated!

ALPOH
  • 23
  • 5
  • The URL in your first attempt is probably not working because the first thing that server responds with is some sort of dynamic page that says something about "checking your browser...". You need to host it somewhere that the actual image file is directly and publicly accessible. Your second attempt should work if you have the "files" folder at the same level as your KML, either on your hard drive or in a KMZ file. What version of Earth are you using? Earth Pro (7.x / desktop app) should handle this fine. Earth for web (9.x) may not handle local files right yet, though should work in a KMZ. – Christiaan Adams Mar 08 '19 at 20:36
  • I tried several different image hosting websites and couldn't seem to find one that would work. That probably had something to do with the webpage not being the actual image file. I had been using Earth for web because the desktop app wasn't working, and it wouldn't display the image even in a KMZ. After a little fiddling, I got the desktop app working, and the local file worked just fine. Thank you for your help. – ALPOH Mar 10 '19 at 23:52

2 Answers2

4

This KML works for me in Google Earth in a KMZ/zip file:

<?xml version="1.0" encoding="utf-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
  <Document>
  <Style id="1">
    <IconStyle>
      <Icon>
        <href>files/number_1.png</href>
      </Icon>
    </IconStyle>
    </Style>
    <Placemark>
      <styleUrl>#1</styleUrl>
      <Point>
          <coordinates>-86.78824404543640,36.41901416833124,1005.84</coordinates>
          <altitudeMode>absolute</altitudeMode>
      </Point>
    </Placemark>
  </Document>
</kml>

The file number_1.png is in the "files" directory. KMZ file contents

displayed on Google Maps

on Google Earth: displayed on Google Earth

geocodezip
  • 158,664
  • 13
  • 220
  • 245
1

I just struggled with this for... never mind. It's embarrassing.

Same problem: kmz with embedded icons worked on GE desktop, but the icons would not import into Google My Maps. I was so frustrated I was ready to hurt someone.

Of course it was entirely my fault.

<href>Images/Icon-1.png</href> worked in GE desktop, but not maps.

<href>images/icon-1.png</href> worked in both.

The issue: everything for the web is case sensitive so the folder name "Images" didn't work on the web because the folder in the zip file was named "images" (lower case ')

D'Oh!

Karl Sangree
  • 101
  • 1
  • 7