Setting lablestyle in KML

568 views Asked by At

I used the simplekml module for python to create the following KML file

    <?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2">
<Document id="feat_1">
    <Style id="stylesel_0">
        <LabelStyle id="substyle_0">
            <color>ff0000ff</color>
            <colorMode>normal</colorMode>
            <scale>1</scale>
        </LabelStyle>
    </Style>
    <Placemark id="feat_2">
        <name>Test</name>
        <styleUrl>#stylesel_0</styleUrl>
        <Point id="geom_0">
            <coordinates>12.581811,55.682581,0.0</coordinates>
        </Point>
    </Placemark>
</Document>
</kml>

But when I load the document in an interpreter, the marker shows as the standard blue instead of the red color (ff0000ff) i assigned. What am I doing wrong?

1

There are 1 answers

0
geocodezip On BEST ANSWER

You are not doing anything to change the icon of the marker in your style definition. To change the Icon use <IconStyle>

<Style id="stylesel_0">
    <LabelStyle id="substyle_0">
        <color>ff0000ff</color>
        <colorMode>normal</colorMode>
        <scale>1</scale>
    </LabelStyle>
    <IconStyle>
        <scale>1.0</scale>
        <Icon>
           <href>http://maps.google.com/mapfiles/ms/icons/red.png</href>
        </Icon>
    </IconStyle>
</Style>