Changing the size and colour of placemarks in Google Earth
In follow up to my previous post I have now found out how to change the size and colour of my placemarks. The trick here is to create a "style" of placemark right at the top of the file. Again, this is pretty simple when you get down to it. This time you need to post a little bit of code at the top of the file, just after the <Document> tag:
<Style id="normalPlacemark">
<IconStyle>
<color>ffffff00</color>
<scale>5</scale>
</IconStyle>
</Style>
The id part of the opening <style> tag is important as it gives each style a name that we can then refer to later for each individual placemark. This allows the user to create different styles of placemark that can be used together in the same file (rather like CSS does for HTML). Colour (<color>) and size (<scale>) are then defined as elements of the <IconStyle> tag. Colours are in a hexadecimal format:
The range of values for any one color is 0 to 255 (00 to ff). For alpha, 00 is fully transparent and ff is fully opaque. The order of expression is aabbggrr, where aa=alpha (00 to ff); bb=blue (00 to ff); gg=green (00 to ff); rr=red (00 to ff). For example, if you want to apply a blue color with 50 percent opacity to an overlay, you would specify the following:
Whereas scale is just a number.
Now we just need to make an addition to our <placemark> tag to state that we want to use this style:
<Placemark>
<name>110_671B</name>
<styleUrl>#normalPlacemark</styleUrl>
<Point>
<coordinates>-58.73,15.52,-1622</coordinates>
</Point>
</Placemark>
So now I am able to plot my holes as giant green pushpins:
Unfortunately it is not easy to modify the colours of the pushpin icon as it has a yellow overlay to it and I have yet to work out if there is an easier way to colour placemarks exactly as I want. This will have to wait until next time.
Update:
OK, this last bit has been solved by someone who asked to be referred to as "my clever volcanologist friend." Basically a white pushpin needs to be called in the <style> tag like this:
<Style id="normalPlacemark">
<IconStyle>
<color>ffffff00</color>
<scale>5</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pushpin/wht-pushpin.png</href>
</Icon>
</IconStyle>
</Style>
1 comment:
Great work again, thanks! I think I will be checking back frequently.
Post a Comment