XML : Multiple style/PolyStyle tags in KML file

Stackers..

I currently seem to be having some trouble with applying styles to polygons in a KML file that I have created.

Currently, I am only trying to style two states, two different colours (North and South Dakota).

When I upload it to a KML validator such as feedvalidator dot org it tells me the file is valid and there is no errors.

When I upload the file/code to a site where it will display the output on a map, I see what I expect. (image 1 below)

The issue is when the file is uploaded to GoogleMaps, it only seems to honor the first style only! (image 2 below)

Below is a simplified version of my code.

  <?xml version="1.0" encoding="UTF-8"?>  <kml xmlns="http://www.opengis.net/kml/2.2">  <Document>      <name><![CDATA[Landgrab]]></name>      <open>1</open>      <Style id="mowhawk">          <IconStyle>              <scale>1</scale>              <Icon>                  <href>http://www.thefairtradepractice.co.uk/sites/default/files/mowhawk-logo-gmap-pin.png</href>              </Icon>          </IconStyle>          <LabelStyle>              <color>8072000B</color>              <scale>1</scale>          </LabelStyle>          <LineStyle>              <color>8072000B</color>              <width>2</width>          </LineStyle>          <PolyStyle>              <color>8072000B</color>              <fill>1</fill>              <outline>1</outline>          </PolyStyle>      </Style>        <Style id="sioux">          <IconStyle>              <scale>1</scale>              <Icon>                  <href>http://www.thefairtradepractice.co.uk/sites/default/files/sioux-logo-gmap-pin.png</href>              </Icon>          </IconStyle>          <LabelStyle>              <color>8000FFFF</color>              <scale>1</scale>          </LabelStyle>          <LineStyle>              <color>8000FFFF</color>              <width>2</width>          </LineStyle>          <PolyStyle>              <color>8000FFFF</color>              <fill>1</fill>              <outline>1</outline>          </PolyStyle>      </Style>    <!--  #############################      NORTH DAKOTA STATE  #############################  -->     <Placemark id="pm255">      <name><![CDATA[North Dakota]]></name>      <Snippet maxLines="0">empty</Snippet>      <description><![CDATA[]]></description>      <styleUrl>#mowhawk</styleUrl>      <MultiGeometry>          <Point id="g883">              <altitudeMode>clampToGround</altitudeMode>              <coordinates>                  *****LIST OF CO-ORDINATES*****              </coordinates>          </Point>          <Polygon id="g884">              <altitudeMode>clampToGround</altitudeMode>              <outerBoundaryIs>                  <LinearRing>                      <coordinates>                          *****LIST OF CO-ORDINATES*****                      </coordinates>                  </LinearRing>              </outerBoundaryIs>          </Polygon>      </MultiGeometry>  </Placemark>    <!--  #############################      SOUTH DAKOTA STATE  #############################  -->     <Placemark id="pm256">      <name><![CDATA[South Dakota]]></name>      <Snippet maxLines="0">empty</Snippet>      <description><![CDATA[]]></description>      <styleUrl>#sioux</styleUrl>      <MultiGeometry>          <Point id="g885">              <altitudeMode>clampToGround</altitudeMode>              <coordinates>                  *****LIST OF CO-ORDINATES*****              </coordinates>          </Point>          <Polygon id="g886">              <altitudeMode>clampToGround</altitudeMode>              <outerBoundaryIs>                  <LinearRing>                      <coordinates>                          *****LIST OF CO-ORDINATES*****                      </coordinates>                  </LinearRing>              </outerBoundaryIs>          </Polygon>      </MultiGeometry>  </Placemark>    </Document>  </kml>    

Expected Results

Actual Results

As can be seen from the above screen shots, when I put the KML into GoogleMaps, it doesn't seem to pick up any of the styles except for the first one.

Sites I used to check the output;

  • display-kml.appspot.com/
  • elsevier-apps.sciverse.com/GoogleMaps/verification

Thanks in advance for any help!

No comments:

Post a Comment