[GRASS-user] Raster Google Earth script using gdal2tiles.py

Markus Neteler neteler at osgeo.org
Wed May 13 05:58:03 EDT 2009


Thanks, John.

Additionally, there is r.out.gmap:
http://grass.osgeo.org/wiki/Addons#r.out.gmap

best
Markus

On Wed, May 13, 2009 at 11:31 AM, John A Stevenson
<john.stevenson at manchester.ac.uk> wrote:
> Hi,
>
> I've seen various ways of getting GRASS rasters into Google Earth tiles but
> always seemed to have trouble with the colours or the reprojections.  This
> is what I finally found worked for me, so am posting it in case it is useful
> to anyone else.  It requires a recent version of gdal (I have 1.5.2) to
> provied the gdal2tiles.py script, and the ImageMagick program mogrify to
> make null regions of the map (which were white in my map) transparent.
>
> I hope that it is useful.
>
> Later
>
> John
>
> r.out.ge
>
> #!/bin/bash
> # 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
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
>


More information about the grass-user mailing list