[GRASS-user] Re: v.out.ogr & kml

John A Stevenson john.stevenson at manchester.ac.uk
Wed Jun 24 10:59:41 EDT 2009


> Well, I would like to have the possibility to export a raster with its colors
> and legend.
>
>   
Look at r.out.gmap in the addons:
http://grass.osgeo.org/wiki/GRASS_AddOns#r.out.gmap

Or you can do it by hand a bit like this:

# Export map to Google Earth tiles.

map=$1

# Export map as png and make null data transparent
g.region rast=$map
export `g.region zoom=$map -lg` # Get map bounds in Lat Long
r.out.png $map
mogrify -transparent white $map.png

# Georeference and reproject output
gdal_translate -a_srs EPSG:4326 -a_ullr $nw_long $nw_lat $se_long 
$se_lat $map.png $map.tif
gdalwarp -t_srs EPSG:4326 -rc $map.tif $map\4326.tif

# Tile for Google Earth
gdal2tiles.py -title $map -forcekml $map\4326.tif $map

-- 


Dr John Stevenson
Postdoctoral Research Associate
School of Earth, Atmospheric and Environmental Sciences
Williamson Building (Room 2.42)
University of Manchester
Manchester M13 9PL, UK
tel. +44(0)161 306 6585; fax. +44(0)161 306 9361;
john.stevenson at manchester.ac.uk 



More information about the grass-user mailing list