[GRASS-user] Export Raster to Google Earth Files

Hi Everyone,

I would like to export raster files to a Google Earth image (kmz or kml). Does anyone know how this is done? I found a way to export a vector to a kmz file, but not a raster.

Your help is very much appreciated.

Best,

Andrew

Andrew Lewin, M.Sc., Adv. Dipl. GIS
Email: andrew.lewin@sympatico.ca
Tel: (905) 639-4646
Mobile: (905) 630-8441
Skype: andrew.lewin99

Andrew wrote:

I would like to export raster files to a Google Earth image
(kmz or kml). Does anyone know how this is done?
I found a way to export a vector to a kmz file, but not a
raster.

try http://grass.osgeo.org/wiki/GRASS_AddOns#r.out.gmap

easier:
I think you just have to export a geotiff then compose the KM? file
manually with the bounds.

Hamish

Hamish wrote:

easier:
I think you just have to export a geotiff then compose the KM? file
manually with the bounds.
  

Or you can use gdal2tiles.py to do this bit. It will also create different zoom levels for you.

More information on a previous posting:

http://lists.osgeo.org/pipermail/grass-user/2009-May/050361.html

John

--

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@manchester.ac.uk

The easiest way to do this for 1 or 2 reasonably sized rasters is to
simply write a very short KML file that points to the image name and
defines its geographic extents. If you have to do it for hundreds of
files, then scripting it is much faster. I can send you a short Perl
script that uses gdalinfo to determine the extents. Here is what the
KML should look like:

<GroundOverlay>
<description>Something pithy</description>
<name>Something else pithy</name>
<visibility>1</visibility>
<open>1</open>
<Icon>
<href>"name_of_image_file"</href>
</Icon>
<drawOrder>0</drawOrder>
<LatLonBox>
<north> DD.dddd</north>
<south> DD.dddd</south>
<west> DD.dddd</west>
<east> DD.dddd</east>
</LatLonBox>
</GroundOverlay>

Roger
--

On Tue, Oct 13, 2009 at 11:14 AM, Andrew Lewin
<andrew.lewin@sympatico.ca> wrote:

Hi Everyone,

I would like to export raster files to a Google Earth image (kmz or kml).
Does anyone know how this is done? I found a way to export a vector to a
kmz file, but not a raster.

Your help is very much appreciated.

Best,

Andrew

Andrew Lewin, M.Sc., Adv. Dipl. GIS
Email: andrew.lewin@sympatico.ca
Tel: (905) 639-4646
Mobile: (905) 630-8441
Skype: andrew.lewin99

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Andrew wrote:

> I would like to export raster files to a Google Earth
> image (kmz or kml).
> Does anyone know how this is done? I found a way
> to export a vector to a kmz file, but not a raster.

Roger André wrote:

The easiest way to do this for 1 or 2 reasonably sized rasters
is to simply write a very short KML file that points to the
image name and defines its geographic extents. If you have to
do it for hundreds of files, then scripting it is much
faster.

...

Here is what the KML should look like:

<GroundOverlay>
<description>Something pithy</description>
<name>Something else pithy</name>
<visibility>1</visibility>
<open>1</open>
<Icon>
<href>"name_of_image_file"</href>
</Icon>
<drawOrder>0</drawOrder>
<LatLonBox>
<north> DD.dddd</north>
<south> DD.dddd</south>
<west> DD.dddd</west>
<east> DD.dddd</east>
</LatLonBox>
</GroundOverlay>

based on this template I've added a r.out.kml script in addons
SVN to do that.

https://trac.osgeo.org/grass/browser/grass-addons/raster/r.out.kml

TODO:
- completely untested
- g.region -n is broken in at least devbr6 (trac #791) so
   export only works from LL/WGS84 right now
- pythonization
- add a -k flag to d.out.file to write a KML file (test true north angle(s)!)

comments/testing/suggestions welcome.

Hamish

lol Awesome! Can you imagine ESRI creating a utility this way?

Thanks for doing this.

Roger
--

On Fri, Oct 16, 2009 at 8:36 PM, Hamish <hamish_b@yahoo.com> wrote:

Andrew wrote:

> I would like to export raster files to a Google Earth
> image (kmz or kml).
> Does anyone know how this is done? I found a way
> to export a vector to a kmz file, but not a raster.

Roger André wrote:

The easiest way to do this for 1 or 2 reasonably sized rasters
is to simply write a very short KML file that points to the
image name and defines its geographic extents. If you have to
do it for hundreds of files, then scripting it is much
faster.

...

Here is what the KML should look like:

<GroundOverlay>
<description>Something pithy</description>
<name>Something else pithy</name>
<visibility>1</visibility>
<open>1</open>
<Icon>
<href>"name_of_image_file"</href>
</Icon>
<drawOrder>0</drawOrder>
<LatLonBox>
<north> DD.dddd</north>
<south> DD.dddd</south>
<west> DD.dddd</west>
<east> DD.dddd</east>
</LatLonBox>
</GroundOverlay>

based on this template I've added a r.out.kml script in addons
SVN to do that.

https://trac.osgeo.org/grass/browser/grass-addons/raster/r.out.kml

TODO:
- completely untested
- g.region -n is broken in at least devbr6 (trac #791) so
export only works from LL/WGS84 right now
- pythonization
- add a -k flag to d.out.file to write a KML file (test true north angle(s)!)

comments/testing/suggestions welcome.

Hamish