Managing a KML Linestring properties

Managing a KML Linestring properties

It works for me if I move the shared styles to the top level (inside the <Document> tag):

example

From the documentation (see the description of <StyleSelector>):

A style defined within a Feature is called an inline style and
applies only to the Feature that contains it. A style defined as the
child of a <Document> is called a shared style. A shared style must
have an id defined for it. This id is referenced by one or more
Features within the <Document>.

Yours is neither a child of <Document> nor within a <Placemark>

<?xml version=1.0 encoding=utf-8?>
<kml xmlns=http://www.opengis.net/kml/2.2>
  <Document>
  <Style id=linestyle1>
    <LineStyle>
      <color>7f0000ff</color>
      <width>1</width>
      <gx:labelVisibility>1</gx:labelVisibility>
    </LineStyle>
  </Style>   
    <name>Qtr Min Grid Maker</name>
    <LookAt>
      <longitude>-121.5</longitude>
      <latitude>38</latitude>
      <altitude>0</altitude>
      <range>740933.8825924395</range>
      <tilt>0</tilt>
      <heading>0</heading>
    </LookAt>
    <Folder>
      <name>Grids</name>
      <Placemark>
        <name>QTR</name>
        <visibility>0</visibility>
        <open>1</open>
        <styleUrl>#linestyle1</styleUrl>
        <LineString>
  <coordinates>
-124.75,40,0 
-124.5,40,0 
-124.25,40,0 
-124,40,0 
-123.75,40,0 
-123.5,40,0 
-123.25,40,0 
-123,40,0 
  </coordinates>
  </LineString>
  </Placemark>
  </Folder>
  </Document>
</kml>

Managing a KML Linestring properties

Leave a Reply

Your email address will not be published. Required fields are marked *