[gdal-dev] Colors and KML output

Jukka Rahkonen jukka.rahkonen at mmmtike.fi
Tue Oct 29 22:54:58 PDT 2013


Tim Keitt <tkeitt <at> utexas.edu> writes:

> 
> 
> OK. Now I have my PEN styles loaded in the table. The KML driver is still
writing only red. Anyone how to get KML to use the OGR_STYLE column?

Have another try. I digitized some lines and set OGR_STYLE to something like
PEN(c:#0000FF,w:8px). Saved into shapefile and checked with ogrinfo
ogrinfo kml.shp kml

OGRFeature(kml):2
  OGR_STYLE (String) = PEN(c:#0000FF,w:8px)
  Style = PEN(c:#0000FF,w:8px)

OGR_STYLE attribute has been converted into feature style. Data are OK to
play with.

Then convert into kml with both "KML" and "LIBKML" drivers and check with
ogrinfo

KML driver
==========
OGR_STYLE (String) = PEN(c:#0000FF,w:8px)
Style = PEN(c:#0000FFFF,w:8.000000px)

LIBKML driver
=============
 OGR_STYLE (String) = PEN(c:#0000FF,w:8px)
 Style = PEN(c:#0000FFFF,w:2.822228px)

Conclusion: Both drivers take the pen color. LIBKML is changing the line
width for some reason at least in this test. My features were reprojected
from EPSG:3067 into EPSG:4326 in my little test but I did not make further
tests to see if this is the reason. Anyway, I can change colors with GDAL
1.10 so I believe you will do the same soon.

I checked also with GE and colours do show.

-Jukka-




More information about the gdal-dev mailing list