[GRASS-user] GTiff export

Hi,

I got two raster files imported in Grass using r.in.gdal, one represents a dem, the other is a “drape”. (the files originated from ArcGIS)
I am setting up a WebGis app (apache, mapserver, php_mapscript) and need a tiff layer to represent elevation and have a image background to put my vectors/points on.

I tried to export the dem file with r.out.gdal, but I obtain something similar to a negative a b/w image with no colors!
Tried several ‘createopt’ but still with no success.
With Grass6.2 everything looks fine.

Whats’ wrong? Should I merge the two raster files first?
I am not a “GIS geek” so any kind of help will be appreciate.

thanx
raffaele

hi,
irrc mapserver can work only with rasters, which have less then 256
values. You can make classes for each elevation level and display it
with desired color, e.g.

CLASS
    EXPRESSION ([pixel] = 38)
    name '390 - 395 m'
    COLOR 253 240 112
    END
CLASS

which means, that all pixels with value 38 will represent elevation
between 390 and 395 meters.

Jachym

On Mon, Dec 18, 2006 at 05:05:11PM +0100, Raffaele Morelli wrote:

Hi,

I got two raster files imported in Grass using r.in.gdal, one represents a
dem, the other is a "drape". (the files originated from ArcGIS)
I am setting up a WebGis app (apache, mapserver, php_mapscript) and need a
tiff layer to represent elevation and have a image background to put my
vectors/points on.

I tried to export the dem file with r.out.gdal, but I obtain something
similar to a negative a b/w image with no colors!
Tried several 'createopt' but still with no success.
With Grass6.2 everything looks fine.

Whats' wrong? Should I merge the two raster files first?
I am not a "GIS geek" so any kind of help will be appreciate.

thanx
raffaele

_______________________________________________
grassuser mailing list
grassuser@grass.itc.it
http://grass.itc.it/mailman/listinfo/grassuser

--
Jachym Cepicky
e-mail: jachym.cepicky@centrum.cz
URL: http://les-ejk.cz
GPG: http://www.les-ejk.cz/pgp/jachym_cepicky-gpg.pub
-----------------------------------------
OFFICE:
Department of Geoinformation Technologies
Zemedelska 3
613 00, Brno
Czech Republick
e-mail: xcepicky@node.mendelu.cz
URL: http://mapserver.mendelu.cz
Tel.: +420 545 134 514

On Monday 18 December 2006 08:05, Raffaele Morelli wrote:

Hi,

I got two raster files imported in Grass using r.in.gdal, one represents a
dem, the other is a "drape". (the files originated from ArcGIS)
I am setting up a WebGis app (apache, mapserver, php_mapscript) and need a
tiff layer to represent elevation and have a image background to put my
vectors/points on.

I tried to export the dem file with r.out.gdal, but I obtain something
similar to a negative a b/w image with no colors!
Tried several 'createopt' but still with no success.
With Grass6.2 everything looks fine.

Whats' wrong? Should I merge the two raster files first?
I am not a "GIS geek" so any kind of help will be appreciate.

thanx
raffaele

Hi,

I have had similar problems in the past. Here are some ideas that I posted a
while back:
http://casoilresource.lawr.ucdavis.edu/drupal/node/337

Note that r.out.gdal has been updated since I posted these notes. Also- I have
had the best luck using arcinfo (command line) directly to import geotiff
files:

imagegrid * * * *

cheers,

--
Dylan Beaudette
Soils and Biogeochemistry Graduate Group
University of California at Davis
530.754.7341

Raffaele Morelli wrote:

I got two raster files imported in Grass using r.in.gdal, one
represents a dem, the other is a "drape". (the files originated from
ArcGIS) I am setting up a WebGis app (apache, mapserver,
php_mapscript) and need a tiff layer to represent elevation and have a
image background to put my vectors/points on.

I tried to export the dem file with r.out.gdal, but I obtain something
similar to a negative a b/w image with no colors!
Tried several 'createopt' but still with no success.
With Grass6.2 everything looks fine.

I think that GDAL only saves a color table if you save max 256 values
(type=Byte). Otherwise the meta-data gets too huge.

Hamish

Raffaele Morelli wrote:

I got two raster files imported in Grass using r.in.gdal, one represents a
dem, the other is a "drape". (the files originated from ArcGIS)
I am setting up a WebGis app (apache, mapserver, php_mapscript) and need a
tiff layer to represent elevation and have a image background to put my
vectors/points on.

My answer would fit better on the mapserver mailing list, but oh well...

If you have what I have, i.e. a grey-shaded relief in one file and
coloured DEM in another, the best option might be displaying the relief
in the background and overlaying it with a transparent DEM
(TRANSPARENCY 50 in LAYER section). It looks pretty good and it's
actually the only decent option I could come up with. You might also
want to set IMAGETYPE PNG24 if the colours don't look good, but be
aware it enlarges the output image size significantly.

You can see the effect of the above here:
http://gis.umcs.lublin.pl/skorowidze/ (the last two layers, hipsometria
and rzezba, are the DEM and the relief respectively).

I hope that helps.

Many thanx to all of you for helping.

I actually solved using a GTiff with 8 color palette (Hamish).

Przemysław,
yes, I have what you got. But what kind of files are you pointing inside your .map file, GTiff or what?

raffaele

Raffaele Morelli wrote:

Przemys³aw,
yes, I have what you got. But what kind of files are you pointing inside
your .map file, GTiff or what?

I'm pointing to .tif files from .map, and they have accompanying .tfw
with georeferences. Example:
  LAYER
    NAME "rzezba"
    CONNECTION GDAL
    DATA "rzezba.tif"
    TYPE raster
  END

Przemysław,
yes, I have what you got. But what kind of files are you pointing inside
your .map file, GTiff or what?

I’m pointing to .tif files from .map, and they have accompanying .tfw
with georeferences. Example:
LAYER
NAME “rzezba”
CONNECTION GDAL
DATA “rzezba.tif”
TYPE raster
END

Here again.

Unfortunately I did not solve the problem but still having problem with visualization under mapserver using GTiff files from r.out.gdal

I used a 8-bit GTiff form ArcGis and everything was quite fine, so I tried to obtain better results with r.out.gdal using type=Byte but in the resulting GTiff I see only a restricted range of colors correctly displayed.

More precisely, only green pixels seems to honour the raster’s scale, everything else is brown… even the sea.
So I wonder how you can obtain a useful GTiff from a GRASS raster for visualization under mapserver http://gis.umcs.lublin.pl/skorowidze/?layer_status%5B%5D=hipsometria&txtZoomFactor=2&ROSA_CMD=ZOOM_IN&Zoom_Full.x=10&Zoom_Full.y=12&PrevStateKey=BBOX%3D759513%2C298523%2C790263%2C335423%7CSRS%3D%7CMAPSIZE%3D500%2C600%7CLAYERS%3D1&NotFirstLoad=1&RosaMode=0&INPUT_TYPE=&INPUT_COORD=304%2C333&QueryString=

Apologize for being so annoying but didn’t found useful resources on the web, except for an “rgb2pct.py” script from http://gdal.maptools.org which in turns requires gdal be compiled with python support. That may help (unsure) but I hope something else could do the same without recompile.

cheers
raffaele