Vytautas,
Exporting a CELL GRASS raster, value range 0-255, r.out.gdal issues an:
ERROR 6: SetColorInterpretation() not supported for this dataset.
and the output map is greyscale. Can you please fix it?
Using GRASS 6.3 CVS 2006-12-13.
Maciek
Vytautas,
Exporting a CELL GRASS raster, value range 0-255, r.out.gdal issues an:
ERROR 6: SetColorInterpretation() not supported for this dataset.
and the output map is greyscale. Can you please fix it?
Using GRASS 6.3 CVS 2006-12-13.
Maciek
Maciej Sieczka wrote:
Vytautas,
Exporting a CELL GRASS raster, value range 0-255, r.out.gdal issues an:
ERROR 6: SetColorInterpretation() not supported for this dataset.
and the output map is greyscale.
There is a discussion about this defect on the GDAL dev list:
http://www.nabble.com/r.out.gdal%3A-SetColorInterpretation()-not-supported-tf3021127.html
Maciek
On Tue, Jan 16, 2007 at 07:03:15PM +0100, Maciej Sieczka wrote:
Maciej Sieczka wrote:
> Vytautas,
>
> Exporting a CELL GRASS raster, value range 0-255, r.out.gdal issues an:
>
> ERROR 6: SetColorInterpretation() not supported for this dataset.
>
> and the output map is greyscale.There is a discussion about this defect on the GDAL dev list:
http://www.nabble.com/r.out.gdal%3A-SetColorInterpretation()-not-supported-tf3021127.html
Probably the mapgdal.c file of MapServer could be an inspiration?
Markus
On Tue, Jan 16, 2007 at 09:53:41PM +0100, Markus Neteler wrote:
On Tue, Jan 16, 2007 at 07:03:15PM +0100, Maciej Sieczka wrote:
> Maciej Sieczka wrote:
> > Vytautas,
> >
> > Exporting a CELL GRASS raster, value range 0-255, r.out.gdal issues an:
> >
> > ERROR 6: SetColorInterpretation() not supported for this dataset.
> >
> > and the output map is greyscale.
>
> There is a discussion about this defect on the GDAL dev list:
> http://www.nabble.com/r.out.gdal%3A-SetColorInterpretation()-not-supported-tf3021127.html
>Probably the mapgdal.c file of MapServer could be an inspiration?
I found some more:
http://www.nabble.com/Re:-How-to-set-a-ColorTable-from-scratch--p5000321.html
http://www.archivesat.com/FreeGIS_project/thread1933209.htm
and GDAL
apps/gdalwarpsimple.c
Still lost
Markus
On 16/01/07 22:14, Markus Neteler wrote:
On Tue, Jan 16, 2007 at 09:53:41PM +0100, Markus Neteler wrote:
On Tue, Jan 16, 2007 at 07:03:15PM +0100, Maciej Sieczka wrote:
Maciej Sieczka wrote:
Vytautas,
Exporting a CELL GRASS raster, value range 0-255, r.out.gdal issues an:
ERROR 6: SetColorInterpretation() not supported for this dataset.
and the output map is greyscale.
There is a discussion about this defect on the GDAL dev list:
http://www.nabble.com/r.out.gdal%3A-SetColorInterpretation()-not-supported-tf3021127.htmlProbably the mapgdal.c file of MapServer could be an inspiration?
I found some more:
http://www.nabble.com/Re:-How-to-set-a-ColorTable-from-scratch--p5000321.html
http://www.archivesat.com/FreeGIS_project/thread1933209.htmand GDAL
apps/gdalwarpsimple.cStill lost
In the very first thread, Frank says:
"Generally speaking to produce a GeoTIFF file with a color table after using Create() to create it, you need to do the SetColorTable() *before* writing any raster data."
I don't see any call to SetColorTable in main.c of r.out.gdal. Could this be the problem ?
Moritz
Moritz Lennert wrote on 01/17/2007 09:23 AM:
On 16/01/07 22:14, Markus Neteler wrote:
On Tue, Jan 16, 2007 at 09:53:41PM +0100, Markus Neteler wrote:
On Tue, Jan 16, 2007 at 07:03:15PM +0100, Maciej Sieczka wrote:
Maciej Sieczka wrote:
Vytautas,
Exporting a CELL GRASS raster, value range 0-255, r.out.gdal issues an:
ERROR 6: SetColorInterpretation() not supported for this dataset.
and the output map is greyscale.
There is a discussion about this defect on the GDAL dev list:
http://www.nabble.com/r.out.gdal%3A-SetColorInterpretation()-not-supported-tf3021127.htmlProbably the mapgdal.c file of MapServer could be an inspiration?
I found some more:
http://www.nabble.com/Re:-How-to-set-a-ColorTable-from-scratch--p5000321.html
http://www.archivesat.com/FreeGIS_project/thread1933209.htm
and GDAL
apps/gdalwarpsimple.cStill lost
In the very first thread, Frank says:
"Generally speaking to produce a GeoTIFF file with a color table after using Create() to create it, you need to do the SetColorTable() *before* writing any raster data."
I don't see any call to SetColorTable in main.c of r.out.gdal. Could this be the problem ?
Yes.
Right now I have submitted related code based on the GRASS-GDAL plugin.
It now creates color rules, but the color interpretation is still wrong (gray instead of RGB).
Please someone may revisit it.
Markus
On Wed, 17 Jan 2007, Moritz Lennert wrote:
On 16/01/07 22:14, Markus Neteler wrote:
> On Tue, Jan 16, 2007 at 09:53:41PM +0100, Markus Neteler wrote:
>> On Tue, Jan 16, 2007 at 07:03:15PM +0100, Maciej Sieczka wrote:
>>> Maciej Sieczka wrote:
>>>> Vytautas,
>>>>
>>>> Exporting a CELL GRASS raster, value range 0-255, r.out.gdal issues an:
>>>>
>>>> ERROR 6: SetColorInterpretation() not supported for this dataset.
>>>>
>>>> and the output map is greyscale.
>>> There is a discussion about this defect on the GDAL dev list:
>>> http://www.nabble.com/r.out.gdal%3A-SetColorInterpretation()-not-supported-tf3021127.html
>>>
>> Probably the mapgdal.c file of MapServer could be an inspiration?
>
> I found some more:
>
> http://www.nabble.com/Re:-How-to-set-a-ColorTable-from-scratch--p5000321.html
> http://www.archivesat.com/FreeGIS_project/thread1933209.htm
>
> and GDAL
> apps/gdalwarpsimple.c
>
> Still lostIn the very first thread, Frank says:
"Generally speaking to produce a GeoTIFF file with a color table after
using Create() to create it, you need to do the SetColorTable() *before*
writing any raster data."I don't see any call to SetColorTable in main.c of r.out.gdal. Could
this be the problem ?
In the R rgdal package, we use R code to generate three byte RGB bands,
then make a PCT from those. I'm not sure where on the GDAL site one can
find a direct route to go from an external palette to filling the PCT,
although it looks as though it is made up of nc colours each of four RGBA
bytes (not tried). R function RGB2PCT and help pages show some ideas, C++
code in function RGDAL_GenCMap in src/gdal-bindings.cpp.
Roger
Moritz
_______________________________________________
grass-dev mailing list
grass-dev@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass-dev
--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand@nhh.no
Markus Neteler wrote on 01/17/2007 10:04 AM:
Moritz Lennert wrote on 01/17/2007 09:23 AM:
On 16/01/07 22:14, Markus Neteler wrote:
On Tue, Jan 16, 2007 at 09:53:41PM +0100, Markus Neteler wrote:
On Tue, Jan 16, 2007 at 07:03:15PM +0100, Maciej Sieczka wrote:
Maciej Sieczka wrote:
Vytautas,
Exporting a CELL GRASS raster, value range 0-255, r.out.gdal issues an:
ERROR 6: SetColorInterpretation() not supported for this dataset.
and the output map is greyscale.
There is a discussion about this defect on the GDAL dev list:
http://www.nabble.com/r.out.gdal%3A-SetColorInterpretation()-not-supported-tf3021127.htmlProbably the mapgdal.c file of MapServer could be an inspiration?
I found some more:
http://www.nabble.com/Re:-How-to-set-a-ColorTable-from-scratch--p5000321.html
http://www.archivesat.com/FreeGIS_project/thread1933209.htm
and GDAL
apps/gdalwarpsimple.cStill lost
In the very first thread, Frank says:
"Generally speaking to produce a GeoTIFF file with a color table after using Create() to create it, you need to do the SetColorTable() *before* writing any raster data."
I don't see any call to SetColorTable in main.c of r.out.gdal. Could this be the problem ?
Yes.
Right now I have submitted related code based on the GRASS-GDAL plugin.
It now creates color rules, but the color interpretation is still wrong (gray instead of RGB).Please someone may revisit it.
It appears that G_get_f_color_rule() doesn't return what it should. No clue how
to fix it.
Markus
Moritz Lennert wrote:
In the very first thread, Frank says:
"Generally speaking to produce a GeoTIFF file with a color table after using Create() to create it, you need to do the SetColorTable() *before* writing any raster data."
I don't see any call to SetColorTable in main.c of r.out.gdal. Could this be the problem ?
Moritz,
Yes, I would imagine so!
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | President OSGeo, http://osgeo.org
Markus Neteler wrote:
> Right now I have submitted related code based on the GRASS-GDAL plugin.
> It now creates color rules, but the color interpretation is still
> wrong (gray instead of RGB).
>
> Please someone may revisit it.It appears that G_get_f_color_rule() doesn't return what it should. No
clue how to fix it.
I've only tested it briefly, but it seems fine to me. Can you explain
what you think is wrong?
--
Glynn Clements <glynn@gclements.plus.com>
On Wed, Jan 17, 2007 at 08:47:39PM +0000, Glynn Clements wrote:
Markus Neteler wrote:
> > Right now I have submitted related code based on the GRASS-GDAL plugin.
> > It now creates color rules, but the color interpretation is still
> > wrong (gray instead of RGB).
> >
> > Please someone may revisit it.
>
> It appears that G_get_f_color_rule() doesn't return what it should. No
> clue how to fix it.I've only tested it briefly, but it seems fine to me. Can you explain
what you think is wrong?
For example,
GRASS 6.3.cvs (spearfish60):~ > r.out.gdal roads out=roads.tif
returns a grey scale map. It should be in colors.
gdalinfo roads.tif | grep Color
Band 1 Block=636x3 Type=Int32, ColorInterp=Gray
Also QGIS shows it in grey scale.
Markus
Markus Neteler wrote:
> > > Right now I have submitted related code based on the GRASS-GDAL plugin.
> > > It now creates color rules, but the color interpretation is still
> > > wrong (gray instead of RGB).
> > >
> > > Please someone may revisit it.
> >
> > It appears that G_get_f_color_rule() doesn't return what it should. No
> > clue how to fix it.
>
> I've only tested it briefly, but it seems fine to me. Can you explain
> what you think is wrong?For example,
GRASS 6.3.cvs (spearfish60):~ > r.out.gdal roads out=roads.tif
returns a grey scale map. It should be in colors.
gdalinfo roads.tif | grep Color
Band 1 Block=636x3 Type=Int32, ColorInterp=GrayAlso QGIS shows it in grey scale.
Why do you think that this is an issue with G_get_f_color_rule()?
With a simple test program, I get results which exactly match the
contents of the colr file.
--
Glynn Clements <glynn@gclements.plus.com>
Glynn Clements wrote on 01/18/2007 09:54 PM:
Markus Neteler wrote:
Right now I have submitted related code based on the GRASS-GDAL plugin.
It now creates color rules, but the color interpretation is still wrong (gray instead of RGB).Please someone may revisit it.
It appears that G_get_f_color_rule() doesn't return what it should. No clue how to fix it.
I've only tested it briefly, but it seems fine to me. Can you explain
what you think is wrong?
For example,
GRASS 6.3.cvs (spearfish60):~ > r.out.gdal roads out=roads.tif
returns a grey scale map. It should be in colors.
gdalinfo roads.tif | grep Color
Band 1 Block=636x3 Type=Int32, ColorInterp=GrayAlso QGIS shows it in grey scale.
Why do you think that this is an issue with G_get_f_color_rule()?
Maybe that's a wrong assumption.
With a simple test program, I get results which exactly match the
contents of the colr file.
I tried on two machines. The exported file does not contains colors. I wonder
if you get a colored output file (did you try a Spearfish raster map?).
Markus
Markus Neteler wrote:
> Why do you think that this is an issue with G_get_f_color_rule()?
>
Maybe that's a wrong assumption.> With a simple test program, I get results which exactly match the
> contents of the colr file.
>I tried on two machines. The exported file does not contains colors. I wonder
if you get a colored output file (did you try a Spearfish raster map?).
I haven't looked into the overall issue of colour tables in r.out.gdal
(I'm entirely unfamiliar with the GDAL API), only the question of
whether G_get_f_color_rule() works correctly (it appears to).
--
Glynn Clements <glynn@gclements.plus.com>
On Fri, Jan 19, 2007 at 03:31:42PM +0000, Glynn Clements wrote:
Markus Neteler wrote:
> > Why do you think that this is an issue with G_get_f_color_rule()?
> >
> Maybe that's a wrong assumption.
>
> > With a simple test program, I get results which exactly match the
> > contents of the colr file.
> >
>
> I tried on two machines. The exported file does not contains colors. I wonder
> if you get a colored output file (did you try a Spearfish raster map?).I haven't looked into the overall issue of colour tables in r.out.gdal
(I'm entirely unfamiliar with the GDAL API), only the question of
whether G_get_f_color_rule() works correctly (it appears to).
Right, it writes reasonable values (in my debug output).
So GDALSetMetadataItem() probably fails or something else is
missing.
Sigh,
Markus
Markus Neteler wrote:
On Fri, Jan 19, 2007 at 03:31:42PM +0000, Glynn Clements wrote:
>
> Markus Neteler wrote:
>
> > > Why do you think that this is an issue with G_get_f_color_rule()?
> > >
> > Maybe that's a wrong assumption.
> >
> > > With a simple test program, I get results which exactly match the
> > > contents of the colr file.
> > >
> >
> > I tried on two machines. The exported file does not contains colors. I wonder
> > if you get a colored output file (did you try a Spearfish raster map?).
>
> I haven't looked into the overall issue of colour tables in r.out.gdal
> (I'm entirely unfamiliar with the GDAL API), only the question of
> whether G_get_f_color_rule() works correctly (it appears to).Right, it writes reasonable values (in my debug output).
So GDALSetMetadataItem() probably fails or something else is
missing.
Based upon ~5 minutes of looking at the GDAL code and gdal.h, I
suspect that you need GDALSetRasterColorTable(hBand, hCT) in there
somewhere. AFAICT, you're creating a colour table, and filling in the
entries, but not actually using the completed colour table for
anything.
BTW, hCT should be GDALColorTableH rather than GDALColorTableH*;
GDALColorTableH is already a pointer.
--
Glynn Clements <glynn@gclements.plus.com>
On Sun, Jan 21, 2007 at 12:08:26AM +0000, Glynn Clements wrote:
Markus Neteler wrote:
> On Fri, Jan 19, 2007 at 03:31:42PM +0000, Glynn Clements wrote:
> > Markus Neteler wrote:
...
> > > I tried on two machines. The exported file does not contains colors. I wonder
> > > if you get a colored output file (did you try a Spearfish raster map?).
> >
> > I haven't looked into the overall issue of colour tables in r.out.gdal
> > (I'm entirely unfamiliar with the GDAL API), only the question of
> > whether G_get_f_color_rule() works correctly (it appears to).
>
> Right, it writes reasonable values (in my debug output).
> So GDALSetMetadataItem() probably fails or something else is
> missing.Based upon ~5 minutes of looking at the GDAL code and gdal.h, I
suspect that you need GDALSetRasterColorTable(hBand, hCT) in there
somewhere. AFAICT, you're creating a colour table, and filling in the
entries, but not actually using the completed colour table for
anything.
Great, now it works. Fixed in CVS.
That's the difference: ~5 minutes of your time while I don't manage
it in an afternoon
BTW, hCT should be GDALColorTableH rather than GDALColorTableH*;
GDALColorTableH is already a pointer.
Fixed, too.
Questions:
- do we need SetColorInterpretation? alias GDALSetRasterColorInterpretation()
- why does the second example below tell me
ERROR 6: SetNoDataValue() not supported for this dataset.
But maybe that are questions for the GDAL list.
Examples, that now work with colors:
# categorial map export:
r.out.gdal roads out=roads.tif type=UInt16
qgis roads.tif
# numerical map export:
r.out.gdal elevation.dem out=elev.img format=HFA
qgis elev.img
Thanks again,
Markus
Markus Neteler wrote:
Questions:
- do we need SetColorInterpretation? alias GDALSetRasterColorInterpretation()
Most drivers don't implement that method; AFAICT, the only ones which
do are ECW, Mem, NITF, Raw and VRT. The others all seem to determine
the colour interpretation from the format's metadata. E.g. the TIFF
driver uses the TIFFTAG_PHOTOMETRIC tag; this tag is set to
PHOTOMETRIC_PALETTE by SetColorTable().
- why does the second example below tell me
ERROR 6: SetNoDataValue() not supported for this dataset.But maybe that are questions for the GDAL list.
Examples, that now work with colors:
# categorial map export:
r.out.gdal roads out=roads.tif type=UInt16
qgis roads.tif# numerical map export:
r.out.gdal elevation.dem out=elev.img format=HFA
qgis elev.img
Because the HFA driver doesn't implement the SetNoDataValue() method;
presumably the format has nowhere to store this information. The only
formats which do implement it are AAIGrid, TIFF, HDF4, Mem, Raw and
VRT (i.e. AAIGrid, TIFF, and HDF4 plus the "generic" drivers).
--
Glynn Clements <glynn@gclements.plus.com>
Maciej Sieczka wrote:
Maciej Sieczka wrote:
Exporting a CELL GRASS raster, value range 0-255, r.out.gdal issues an:
ERROR 6: SetColorInterpretation() not supported for this dataset.
and the output map is greyscale.
There is a discussion about this defect on the GDAL dev list:
http://www.nabble.com/r.out.gdal%3A-SetColorInterpretation()-not-supported-tf3021127.html
I have submitted a fix to CVS. Now a valid color table is also written
in the case that the user does not manually select Byte/UInt16 type
*and* the data range supports this. I used a range check to preselect the
GDAL type.
Additionally, the used GDAL data type is advertised in a new user message.
Finally the GeoTIFF color tables work easily
Tested with Spearfish: fields, spot.image, aspect, elevation.dem,
elevation.10m
Markus
PS: Proudly presented by
http://wiki.osgeo.org/index.php/European_GIS_Code_Sprint
--
View this message in context: http://www.nabble.com/new-r.out.gdal-fails-to-preserve-8bit-color-tf2871516.html#a13860630
Sent from the Grass - Dev mailing list archive at Nabble.com.