How to display custom KML tag labels using an image from a local drive or network drive

Does anyone know how to display a custom KML tag label icon using an image from a local drive or network drive.

I tried this and it does not work:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Style id="icon">
        <IconStyle>
          <Icon>
            <href>c:\etnasss.jpg</href>
          </Icon>
        </IconStyle>
 </Style>
  <Placemark>
    <name>Simple placemark</name>
    <description>Attached to the ground. Intelligently places itself 
       at the height of the underlying terrain.</description>
    <styleUrl>#icon</styleUrl>    
    <Point>
      <coordinates>-122.0822035425683,37.42228990140251,0</coordinates>
    </Point>
  </Placemark>
</kml>

thank

+4
source share
1 answer

An element <href>in KML accepts a URL, not a path to a Windows file. The URL can be an absolute or relative location.

To make it work, suggest moving the KML file and image to the same folder first, and then refer to the image by its name.

<Style id="icon">
    <IconStyle>
        <Icon>
          <href>etnasss.jpg</href>
        </Icon>
    </IconStyle>
</Style>

: https://developers.google.com/kml/documentation/kmlreference#href

(, :///C:/etnasss.jpg), Google KML . , .

KMZ (aka ZIP ) KMZ KML .

+7

Source: https://habr.com/ru/post/1545275/


All Articles