Legend in kml-files

I am making .kml-files to visualize measurements. I have defined a few styles and depending on the level of a given parameter, the points are plotted with different colors. The legend is put in the file-level description of the kml-file. Here I have used a <ul> to get the points for the legend. Each <li> has a specific style to have the right color on the dot. To avoid having the text in the same color, the text within the li is put in a <span> having the color set to black.

e.g:

<li style="color:#ff0000">
    <span style="color:#000000">&gt; 6000</span>
</li>

gives this text:

  • > 6000

An example kml file can be downloaded from here. The php-file used for creating the kml-file is here. The latter file is made for a specific apllication, but I hope it may work as a starting point for others. And – yes I know how to do oop in php, but I did not find it useful in this fairly simple script. The legend may also be put into some kind of overlay on the kml. More investigations to be done.

This entry was posted in css, kml. Bookmark the permalink.