-1

I am trying to generate a KML file, I am attaching 2 examples, all right if I use the POINT tag but if I replace it with the ADDRESS tag I lose the styles and the folder when I upload the file to My Maps or Google Earth ... I am wrong the formatting ?

basically the only change I made is to replace the POINT tag with the ADDRESS tag, the latter also functions perfectly, as a positioning, but the colors of the styles and the name of the folder disappear.

Sample with point

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
  <Document>
    <name>Esempio clienti</name>
    <description/>
    <Style id="icon-1899-0288D1-normal">
      <IconStyle>
        <color>ffd18802</color>
        <scale>1</scale>
        <Icon>
          <href>https://www.gstatic.com/mapspro/images/stock/503-wht-blank_maps.png</href>
        </Icon>
        <hotSpot x="32" xunits="pixels" y="64" yunits="insetPixels"/>
      </IconStyle>
      <LabelStyle>
        <scale>0</scale>
      </LabelStyle>
    </Style>
    <Style id="icon-1899-0288D1-highlight">
      <IconStyle>
        <color>ffd18802</color>
        <scale>1</scale>
        <Icon>
          <href>https://www.gstatic.com/mapspro/images/stock/503-wht-blank_maps.png</href>
        </Icon>
        <hotSpot x="32" xunits="pixels" y="64" yunits="insetPixels"/>
      </IconStyle>
      <LabelStyle>
        <scale>1</scale>
      </LabelStyle>
    </Style>
    <StyleMap id="icon-1899-0288D1">
      <Pair>
        <key>normal</key>
        <styleUrl>#icon-1899-0288D1-normal</styleUrl>
      </Pair>
      <Pair>
        <key>highlight</key>
        <styleUrl>#icon-1899-0288D1-highlight</styleUrl>
      </Pair>
    </StyleMap>
    <Style id="icon-1899-0F9D58-normal">
      <IconStyle>
        <color>ff589d0f</color>
        <scale>1</scale>
        <Icon>
          <href>https://www.gstatic.com/mapspro/images/stock/503-wht-blank_maps.png</href>
        </Icon>
        <hotSpot x="32" xunits="pixels" y="64" yunits="insetPixels"/>
      </IconStyle>
      <LabelStyle>
        <scale>0</scale>
      </LabelStyle>
    </Style>
    <Style id="icon-1899-0F9D58-highlight">
      <IconStyle>
        <color>ff589d0f</color>
        <scale>1</scale>
        <Icon>
          <href>https://www.gstatic.com/mapspro/images/stock/503-wht-blank_maps.png</href>
        </Icon>
        <hotSpot x="32" xunits="pixels" y="64" yunits="insetPixels"/>
      </IconStyle>
      <LabelStyle>
        <scale>1</scale>
      </LabelStyle>
    </Style>
    <StyleMap id="icon-1899-0F9D58">
      <Pair>
        <key>normal</key>
        <styleUrl>#icon-1899-0F9D58-normal</styleUrl>
      </Pair>
      <Pair>
        <key>highlight</key>
        <styleUrl>#icon-1899-0F9D58-highlight</styleUrl>
      </Pair>
    </StyleMap>
    <Style id="icon-1899-FF5252-normal">
      <IconStyle>
        <color>ff5252ff</color>
        <scale>1</scale>
        <Icon>
          <href>https://www.gstatic.com/mapspro/images/stock/503-wht-blank_maps.png</href>
        </Icon>
        <hotSpot x="32" xunits="pixels" y="64" yunits="insetPixels"/>
      </IconStyle>
      <LabelStyle>
        <scale>0</scale>
      </LabelStyle>
    </Style>
    <Style id="icon-1899-FF5252-highlight">
      <IconStyle>
        <color>ff5252ff</color>
        <scale>1</scale>
        <Icon>
          <href>https://www.gstatic.com/mapspro/images/stock/503-wht-blank_maps.png</href>
        </Icon>
        <hotSpot x="32" xunits="pixels" y="64" yunits="insetPixels"/>
      </IconStyle>
      <LabelStyle>
        <scale>1</scale>
      </LabelStyle>
    </Style>
    <StyleMap id="icon-1899-FF5252">
      <Pair>
        <key>normal</key>
        <styleUrl>#icon-1899-FF5252-normal</styleUrl>
      </Pair>
      <Pair>
        <key>highlight</key>
        <styleUrl>#icon-1899-FF5252-highlight</styleUrl>
      </Pair>
    </StyleMap>
    <Folder>
      <name>Clienti</name>
      <Placemark>
        <name>Zerod</name>
        <description><![CDATA[Descrizione<br>a capo]]></description>
        <styleUrl>#icon-1899-0F9D58</styleUrl>
        <Point>
          <coordinates>
            10.4023066,45.4184623,0
          </coordinates>
        </Point>
      </Placemark>
      <Placemark>
        <name>MR77</name>
        <description><![CDATA[Descrizione<br>a capo]]></description>
        <styleUrl>#icon-1899-0288D1</styleUrl>
        <Point>
          <coordinates>
            10.3659798,45.4232393,0
          </coordinates>
        </Point>
      </Placemark>
      <Placemark>
        <name>Selleria</name>
        <description><![CDATA[Descrizione<br>a capo]]></description>
        <styleUrl>#icon-1899-FF5252</styleUrl>
        <Point>
          <coordinates>
            10.3672378,45.4239679,0
          </coordinates>
        </Point>
      </Placemark>
    </Folder>
  </Document>
</kml>

sample with address

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
  <Document>
    <name>Esempio clienti</name>
    <description/>
    <Style id="icon-1899-0288D1-normal">
      <IconStyle>
        <color>ffd18802</color>
        <scale>1</scale>
        <Icon>
          <href>https://www.gstatic.com/mapspro/images/stock/503-wht-blank_maps.png</href>
        </Icon>
        <hotSpot x="32" xunits="pixels" y="64" yunits="insetPixels"/>
      </IconStyle>
      <LabelStyle>
        <scale>0</scale>
      </LabelStyle>
    </Style>
    <Style id="icon-1899-0288D1-highlight">
      <IconStyle>
        <color>ffd18802</color>
        <scale>1</scale>
        <Icon>
          <href>https://www.gstatic.com/mapspro/images/stock/503-wht-blank_maps.png</href>
        </Icon>
        <hotSpot x="32" xunits="pixels" y="64" yunits="insetPixels"/>
      </IconStyle>
      <LabelStyle>
        <scale>1</scale>
      </LabelStyle>
    </Style>
    <StyleMap id="icon-1899-0288D1">
      <Pair>
        <key>normal</key>
        <styleUrl>#icon-1899-0288D1-normal</styleUrl>
      </Pair>
      <Pair>
        <key>highlight</key>
        <styleUrl>#icon-1899-0288D1-highlight</styleUrl>
      </Pair>
    </StyleMap>
    <Style id="icon-1899-0F9D58-normal">
      <IconStyle>
        <color>ff589d0f</color>
        <scale>1</scale>
        <Icon>
          <href>https://www.gstatic.com/mapspro/images/stock/503-wht-blank_maps.png</href>
        </Icon>
        <hotSpot x="32" xunits="pixels" y="64" yunits="insetPixels"/>
      </IconStyle>
      <LabelStyle>
        <scale>0</scale>
      </LabelStyle>
    </Style>
    <Style id="icon-1899-0F9D58-highlight">
      <IconStyle>
        <color>ff589d0f</color>
        <scale>1</scale>
        <Icon>
          <href>https://www.gstatic.com/mapspro/images/stock/503-wht-blank_maps.png</href>
        </Icon>
        <hotSpot x="32" xunits="pixels" y="64" yunits="insetPixels"/>
      </IconStyle>
      <LabelStyle>
        <scale>1</scale>
      </LabelStyle>
    </Style>
    <StyleMap id="icon-1899-0F9D58">
      <Pair>
        <key>normal</key>
        <styleUrl>#icon-1899-0F9D58-normal</styleUrl>
      </Pair>
      <Pair>
        <key>highlight</key>
        <styleUrl>#icon-1899-0F9D58-highlight</styleUrl>
      </Pair>
    </StyleMap>
    <Style id="icon-1899-FF5252-normal">
      <IconStyle>
        <color>ff5252ff</color>
        <scale>1</scale>
        <Icon>
          <href>https://www.gstatic.com/mapspro/images/stock/503-wht-blank_maps.png</href>
        </Icon>
        <hotSpot x="32" xunits="pixels" y="64" yunits="insetPixels"/>
      </IconStyle>
      <LabelStyle>
        <scale>0</scale>
      </LabelStyle>
    </Style>
    <Style id="icon-1899-FF5252-highlight">
      <IconStyle>
        <color>ff5252ff</color>
        <scale>1</scale>
        <Icon>
          <href>https://www.gstatic.com/mapspro/images/stock/503-wht-blank_maps.png</href>
        </Icon>
        <hotSpot x="32" xunits="pixels" y="64" yunits="insetPixels"/>
      </IconStyle>
      <LabelStyle>
        <scale>1</scale>
      </LabelStyle>
    </Style>
    <StyleMap id="icon-1899-FF5252">
      <Pair>
        <key>normal</key>
        <styleUrl>#icon-1899-FF5252-normal</styleUrl>
      </Pair>
      <Pair>
        <key>highlight</key>
        <styleUrl>#icon-1899-FF5252-highlight</styleUrl>
      </Pair>
    </StyleMap>
    <Folder>
      <name>Clienti</name>
      <Placemark>
        <name>Zerod</name>
        <description><![CDATA[Descrizione<br>a capo]]></description>
        <address>Via G.Falcone,136 Montichiari Brescia Lombardia</address> 
        <styleUrl>#icon-1899-0F9D58</styleUrl>
      </Placemark>
      <Placemark>
        <name>MR77</name>
        <description><![CDATA[Descrizione<br>a capo]]></description>
        <address>Via San Bernardino, 5 Montichiari Brescia Lombardia</address> 
        <styleUrl>#icon-1899-0288D1</styleUrl>
      </Placemark>
      <Placemark>
        <name>Selleria</name>
        <description><![CDATA[Descrizione<br>a capo]]></description>
        <address>Via Via Enrico Fermi, 4 Montichiari Brescia</address> 
        <styleUrl>#icon-1899-FF5252</styleUrl>
      </Placemark>
    </Folder>
  </Document>
</kml>
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Aug 10 '22 at 13:11

1 Answers1

0

Google Earth for Web (aka Google Earth for Chrome) does not use the <address> tag in a KML placemark to display it on the map. The KML Placemark must have a geometry (Point, Line, or Polygon) to be visible on the map.

Placemarks with only an address (and no geometry) is supported in Google Earth Pro for Desktop. When loaded in Google Earth, the location for addresses are automatically looked up (using Google's Geocoding API) and a pin for the placemark is positioned at its location.

To use Google Earth for Web or My Maps, you can first open the KML file in Google Earth Pro then export it. The saved KML will have a Point location for the address and a bounding box as a LinearRing in each of the Placemarks, which you can import in Google Earth for Web or My Maps.

Also note that the icon style with urls using https://www.gstatic.com/mapspro/images/stock/503-wht-blank_maps.png will not work in Google Earth Web or My Maps so you will need to replace with the standard Google Earth icon; e.g. http://maps.google.com/mapfiles/kml/paddle/wht-blank.png.

CodeMonkey
  • 22,825
  • 4
  • 35
  • 75
  • it's very strange ... if I open the file with
    with Mymaps the 3 points are calculated correctly even though they don't have geometry ... it loses icons / colors and folders ... in Google Earth Pro everything is ok. It will also be unsupported but the position calculation does, so is it half supported or is it a bug? the idea was to export the kml file from my registry with the addresses. thanks for the tip about the icons
    – Mauro Roncali Aug 11 '22 at 07:25