# v.out.kml 101


NAME

v.out.kml - A shell script to generate KML files (Google Earth) from GRASS vector layers.
(GRASS 6 Vector Program)

SYNOPSIS

v.out.kml
v.out.kml lots of flags and parameters... use "v.out.kml help" for details

DESCRIPTION

v.out.kml creates KML files from GRASS vector data, including color, fillcolor, transparency and icons.
If no parameters are provided, v.out.kml will ask for the source vector layer and all other parameters.
The script allows to select wether polygons will be reduced to lines or kept as polygons.
Transparency values can be set seperately for both lines and polygon area fills.
Icons for point data can be referenced by ID numbers from the Google Earth web site or by individual URLs.
The color values can also be randomized. The random-color-flag overrides any additional color settings.

Flags

-l
Force line-vector export: Areas are exported as lines/polylines (default) without a fillcolor.
-y
Force polygon export: Areas are exported as polygons with a fillcolor and fill-transparency.
-p
Point-vector (sites) export: Point data will be exported.
-r
Random colors: All line and area colors (if needed) are set to random values

Parameters

vector
Vector input map.
output
Name/path of kml output.
ogrpath
optional path to ogr2ogr.
color
integer triplet for line color (blue:green:red 00:00:00-255:255:255).
transparency
integer for vector line transparency (0=invisible 255=opaque) Standard: 255.
fcolor
integer triplet for polygon fill color (blue:green:red 00:00:00-255:255:255).
ftransparency
integer for polygon transparency (00=invisible 255=opaque) Standard: 255.
size
width of the vector lines (default is 1).
iconcode
Select an icons number within its palette for point-vectors. Options: 1-45.
iconpalette
Select a KML palette of icons for point-vectors. Options: 1-20 .
iconcolor
hexcode color triplet for point-vectors (blue:green:red 00:00:00-255:255:255) Standard: 00:200:00.
icontransparency
integer for point-vector transparency (0=invisible 255=opaque 0-255) Standard: 255.
iconurl
Provide a URL pointing to a symbol for point-vectors .
linecolumn
The name of a database column providing the line color as an integer triplet (blue:green:red 0:0:0 - 255:255:255)
linetranscolumn
The name of a database column providing the line transparency as an integer value (0-255 0=invisible 255=opaque)
fillcolumn
The name of a database column providing the line color as an integer triplet (blue:green:red 0:0:0 - 255:255:255)
filltranscolumn
The name of a database column providing the line transparency as an integer value (0-255 0=invisible 255=opaque)

Notes

The script only works for data layers of the current mapset. If "user" is the current mapset, trying to access vectors from other mapsets (like "PERMANENT") will cause ungraceful script termination.


The scrip requires an installation of GDAL/OGR supporting GML (Geographic Markup Language). If for some reason this is not available, or the local GDAL/OGR does not provide GML, install the famous FWTools from http://fwtools.maptools.org. They provide GML support. To point the script to such a FWtools installation, use the ogrpath-parameter (pointing to ogr2ogr in FWtools). Once started with this option, the script will remember the path for the current mapset, so this ordeal is only necessary once.


To be done


Currently lacking database support for point data (color/transparency)


The same random value will be applied to all instances of a [transparency|geometry]-class.


This is a humble shell-script. It will be certainly out-performed by the mightily improved next version in C.


There might be a slight offset between the generic EPSG 4326 and the "lat lon" used by Google Earth. The author would be grateful for feedback on this issue.


...

DOWNLOAD THECODE

v.out.kml

AUTHOR

Peter Lwe

Last changed: $Date: 2007/17/06 $