[GRASS-user] exporting raster map to kmz?

Hi all,

I’m trying to classify a LANDSAT8 image. In the process, i’d like to export an unsupervised classification i did (using i.cluster, followed by i.maxlik) raster (type:CELL) into kml/kmz, so that I could get some visual idea of the classification. the classification is from 1 to 10, with null data present.

r.out.gdal -c input=lsat2014_unsupervised@PERMANENT output=C:\Users\Vishal\Documents\GIS\file3.kmz format=KMLSUPEROVERLAY type=Byte nodata=0

but no matter what flags i try, i get a black box on google earth.

I’m just using the GUI options, Grass7svn on Windows. FYI, I do know how to do this by modifying add-on r.out.kml in Linux, but it would be good if i could just do my entire workflow on one platform.

Thanks!

Vishal


Vishal K. Mehta, PhD
Sr Scientist
Stockholm Environment Institute - US
133 D St Suite F
Davis CA 95616
www.sei-us.org

Hi,

kml is usually more used for vector data.

looking at the header "<img style=“margin-right: 0px;” src=“data:image/png;base64,iVBORw0KGgo”, it seems that r.out.gdal is just writing the binary code for your raster in an image tag in the kml file …

Have you try to transform your raster into vector (http://grass.osgeo.org/grass64/manuals/r.to.vect.html) and then to export the vector to kml ?

Sylvain

···

2014-07-23 20:26 GMT+02:00 Vishal Mehta <vishalm1975@gmail.com>:

Hi all,

I’m trying to classify a LANDSAT8 image. In the process, i’d like to export an unsupervised classification i did (using i.cluster, followed by i.maxlik) raster (type:CELL) into kml/kmz, so that I could get some visual idea of the classification. the classification is from 1 to 10, with null data present.

r.out.gdal -c input=lsat2014_unsupervised@PERMANENT output=C:\Users\Vishal\Documents\GIS\file3.kmz format=KMLSUPEROVERLAY type=Byte nodata=0

but no matter what flags i try, i get a black box on google earth.

I’m just using the GUI options, Grass7svn on Windows. FYI, I do know how to do this by modifying add-on r.out.kml in Linux, but it would be good if i could just do my entire workflow on one platform.

Thanks!

Vishal


Vishal K. Mehta, PhD
Sr Scientist
Stockholm Environment Institute - US
133 D St Suite F
Davis CA 95616
www.sei-us.org


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

Sylvain,

I agree with your approach. However, I have run into one difficulty, which is if the raster is very detailed (say, 1-ft Lidar) and the computational region is relatively large (several square kilometers), GRASS has considerable problems with the raster-to-vect conversion. The problem is that each raster pixel is transformed to a polygon, so the result is that there can be millions of polygons which the v.build process embedded within r.to.vect , seems to run out of memory. This happens despite the fact that I am running GRASS on 64-bit Ubuntu Linux with 16 GB RAM

My process is this:

r.to.vect -b input=flood_225.50@teaiii output=flood_225_50 type=area

v.db.addcolumn map=flood_225_50@teaiii columns=“flood_area varchar(12)”
v.db.update map=flood_225_50@teaiii layer=1 column=flood_area value=225_50
v.dissolve input=flood_225_50@teaiii column=flood_area output=flood_225_50_dissolve
v.out.ogr -c --overwrite input=flood_226_50_dissolve@teaiii dsn=flood_226_50.kml format=KML

Over the same computational region, if my grid resolution is 3-meters, I have no problems; with 1-ft (~0.3 meters) grid resolution, I have problems.

Regards,

Tom

···

On Fri, Jul 25, 2014 at 3:43 AM, Sylvain Maillard <sylvain.maillard@gmail.com> wrote:

Hi,

kml is usually more used for vector data.

looking at the header "<img style=“margin-right: 0px;” src=“data:image/png;base64,iVBORw0KGgo”, it seems that r.out.gdal is just writing the binary code for your raster in an image tag in the kml file …

Have you try to transform your raster into vector (http://grass.osgeo.org/grass64/manuals/r.to.vect.html) and then to export the vector to kml ?

Sylvain


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

2014-07-23 20:26 GMT+02:00 Vishal Mehta <vishalm1975@gmail.com>:

Hi all,

I’m trying to classify a LANDSAT8 image. In the process, i’d like to export an unsupervised classification i did (using i.cluster, followed by i.maxlik) raster (type:CELL) into kml/kmz, so that I could get some visual idea of the classification. the classification is from 1 to 10, with null data present.

r.out.gdal -c input=lsat2014_unsupervised@PERMANENT output=C:\Users\Vishal\Documents\GIS\file3.kmz format=KMLSUPEROVERLAY type=Byte nodata=0

but no matter what flags i try, i get a black box on google earth.

I’m just using the GUI options, Grass7svn on Windows. FYI, I do know how to do this by modifying add-on r.out.kml in Linux, but it would be good if i could just do my entire workflow on one platform.

Thanks!

Vishal


Vishal K. Mehta, PhD
Sr Scientist
Stockholm Environment Institute - US
133 D St Suite F
Davis CA 95616
www.sei-us.org


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

thanks for your suggestions,

i dont really want to convert raster to vector at the exploratory stage i’m in- was just looking to use in-built tools that converted the raster to a png and wrappend kml around it- which is what r.out.kml did.

however, i have never before used this GUI-based “KML SUPEROVERLAY” format option that appears with v.out.ogr. thats what i’ve been trying and failing - just getting a black box which is correctly georegistered. i have a feeling its to do with the rendering of colors for each thematic class, and that in turn might be to do with the data type…but its just a guess.

Vishal

···

On Fri, Jul 25, 2014 at 5:30 AM, Thomas Adams <tea3rd@gmail.com> wrote:

Sylvain,

I agree with your approach. However, I have run into one difficulty, which is if the raster is very detailed (say, 1-ft Lidar) and the computational region is relatively large (several square kilometers), GRASS has considerable problems with the raster-to-vect conversion. The problem is that each raster pixel is transformed to a polygon, so the result is that there can be millions of polygons which the v.build process embedded within r.to.vect , seems to run out of memory. This happens despite the fact that I am running GRASS on 64-bit Ubuntu Linux with 16 GB RAM

My process is this:

r.to.vect -b input=flood_225.50@teaiii output=flood_225_50 type=area

v.db.addcolumn map=flood_225_50@teaiii columns=“flood_area varchar(12)”
v.db.update map=flood_225_50@teaiii layer=1 column=flood_area value=225_50
v.dissolve input=flood_225_50@teaiii column=flood_area output=flood_225_50_dissolve
v.out.ogr -c --overwrite input=flood_226_50_dissolve@teaiii dsn=flood_226_50.kml format=KML

Over the same computational region, if my grid resolution is 3-meters, I have no problems; with 1-ft (~0.3 meters) grid resolution, I have problems.

Regards,

Tom


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


Vishal K. Mehta, PhD
Scientist
Stockholm Environment Institute - US
133 D St Suite F
Davis CA 95616
www.sei-us.org

On Fri, Jul 25, 2014 at 3:43 AM, Sylvain Maillard <sylvain.maillard@gmail.com> wrote:

Hi,

kml is usually more used for vector data.

looking at the header "<img style=“margin-right: 0px;” src=“data:image/png;base64,iVBORw0KGgo”, it seems that r.out.gdal is just writing the binary code for your raster in an image tag in the kml file …

Have you try to transform your raster into vector (http://grass.osgeo.org/grass64/manuals/r.to.vect.html) and then to export the vector to kml ?

Sylvain


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

2014-07-23 20:26 GMT+02:00 Vishal Mehta <vishalm1975@gmail.com>:

Hi all,

I’m trying to classify a LANDSAT8 image. In the process, i’d like to export an unsupervised classification i did (using i.cluster, followed by i.maxlik) raster (type:CELL) into kml/kmz, so that I could get some visual idea of the classification. the classification is from 1 to 10, with null data present.

r.out.gdal -c input=lsat2014_unsupervised@PERMANENT output=C:\Users\Vishal\Documents\GIS\file3.kmz format=KMLSUPEROVERLAY type=Byte nodata=0

but no matter what flags i try, i get a black box on google earth.

I’m just using the GUI options, Grass7svn on Windows. FYI, I do know how to do this by modifying add-on r.out.kml in Linux, but it would be good if i could just do my entire workflow on one platform.

Thanks!

Vishal


Vishal K. Mehta, PhD
Sr Scientist
Stockholm Environment Institute - US
133 D St Suite F
Davis CA 95616
www.sei-us.org


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

Vishal,

From what I have experienced and read, I believe there could be a color map issue to sort out — I don’t know how to do that; I saw the same thing when I imported a geoTiff image.

Tom

···

On Fri, Jul 25, 2014 at 12:09 PM, Vishal Mehta <vishalm1975@gmail.com> wrote:

thanks for your suggestions,

i dont really want to convert raster to vector at the exploratory stage i’m in- was just looking to use in-built tools that converted the raster to a png and wrappend kml around it- which is what r.out.kml did.

however, i have never before used this GUI-based “KML SUPEROVERLAY” format option that appears with v.out.ogr. thats what i’ve been trying and failing - just getting a black box which is correctly georegistered. i have a feeling its to do with the rendering of colors for each thematic class, and that in turn might be to do with the data type…but its just a guess.

Vishal

On Fri, Jul 25, 2014 at 5:30 AM, Thomas Adams <tea3rd@gmail.com> wrote:

Sylvain,

I agree with your approach. However, I have run into one difficulty, which is if the raster is very detailed (say, 1-ft Lidar) and the computational region is relatively large (several square kilometers), GRASS has considerable problems with the raster-to-vect conversion. The problem is that each raster pixel is transformed to a polygon, so the result is that there can be millions of polygons which the v.build process embedded within r.to.vect , seems to run out of memory. This happens despite the fact that I am running GRASS on 64-bit Ubuntu Linux with 16 GB RAM

My process is this:

r.to.vect -b input=flood_225.50@teaiii output=flood_225_50 type=area

v.db.addcolumn map=flood_225_50@teaiii columns=“flood_area varchar(12)”
v.db.update map=flood_225_50@teaiii layer=1 column=flood_area value=225_50
v.dissolve input=flood_225_50@teaiii column=flood_area output=flood_225_50_dissolve
v.out.ogr -c --overwrite input=flood_226_50_dissolve@teaiii dsn=flood_226_50.kml format=KML

Over the same computational region, if my grid resolution is 3-meters, I have no problems; with 1-ft (~0.3 meters) grid resolution, I have problems.

Regards,

Tom


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


Vishal K. Mehta, PhD
Scientist
Stockholm Environment Institute - US
133 D St Suite F
Davis CA 95616
www.sei-us.org

On Fri, Jul 25, 2014 at 3:43 AM, Sylvain Maillard <sylvain.maillard@gmail.com> wrote:

Hi,

kml is usually more used for vector data.

looking at the header "<img style=“margin-right: 0px;” src=“data:image/png;base64,iVBORw0KGgo”, it seems that r.out.gdal is just writing the binary code for your raster in an image tag in the kml file …

Have you try to transform your raster into vector (http://grass.osgeo.org/grass64/manuals/r.to.vect.html) and then to export the vector to kml ?

Sylvain


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

2014-07-23 20:26 GMT+02:00 Vishal Mehta <vishalm1975@gmail.com>:

Hi all,

I’m trying to classify a LANDSAT8 image. In the process, i’d like to export an unsupervised classification i did (using i.cluster, followed by i.maxlik) raster (type:CELL) into kml/kmz, so that I could get some visual idea of the classification. the classification is from 1 to 10, with null data present.

r.out.gdal -c input=lsat2014_unsupervised@PERMANENT output=C:\Users\Vishal\Documents\GIS\file3.kmz format=KMLSUPEROVERLAY type=Byte nodata=0

but no matter what flags i try, i get a black box on google earth.

I’m just using the GUI options, Grass7svn on Windows. FYI, I do know how to do this by modifying add-on r.out.kml in Linux, but it would be good if i could just do my entire workflow on one platform.

Thanks!

Vishal


Vishal K. Mehta, PhD
Sr Scientist
Stockholm Environment Institute - US
133 D St Suite F
Davis CA 95616
www.sei-us.org


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

Vishal wrote:

I'm trying to classify a LANDSAT8 image. In the process, i'd like to
export an unsupervised classification i did (using i.cluster,
followed by i.maxlik) raster (type:CELL) into kml/kmz, so that I
could get some visual idea of the classification. the classification
is from 1 to 10, with null data present.

r.out.gdal -c input=lsat2014_unsupervised@PERMANENT
output=C:\Users\Vishal\Documents\GIS\file3.kmz format=KMLSUPEROVERLAY
type=Byte nodata=0

but no matter what flags i try, i get a black box on google earth.

I'm just using the GUI options, Grass7svn on Windows. FYI, I do know
how to do this by modifying add-on r.out.kml in Linux, but it would
be good if i could just do my entire workflow on one platform.

Hi,

(see http://grasswiki.osgeo.org/wiki/AddOns/GRASS_6#r.out.kml )

The r.out.kml addon module should work with GRASS 6.4 on MS Windows
as far as I can tell. If you want to export as JPEG instead of PNG
you'll need to install the Windows build of the NetPBM programs to
get pnmtojpeg.exe though.

It uses r.out.png which exports as colors not values, so the color
table should be preserved.

It is not ported to python for GRASS 7 yet, but it's a pretty simple
script, so shouldn't be too hard.

regards,
Hamish