[GRASS-user] problem whit raster images

hello everyone!

I'm still learning about grass world, i finally create a location, but i'm not sure about a few thing... Whatever i use r.in.gdal to import a .jpg map and it creates only map.1, map.2 and map.3 files; i tried visualized it and they were only gray images. Later i wanted to import a new image, but tis one was a .tif map, and it creates three new raster files, image.blue, image.red and image.green. This time when i wanted to visualize them grass mark the next error:

  'No socket to connect to for monitor <x0>'
    No graphics device selected

I wanted to know why r.in.gdal creates 3 files and what i have to do to visualize my map :S
please help
thank you so much.

<html><DIV>
<DIV align=center><FONT size=5><BR></FONT><FONT color=#990033 size=5>((¯`··..·^·..··°k¥|\/|ÃGÜ®£°··..·^·..··´¯))</FONT></DIV></DIV></html>

Hi Ana

Your files are in rgb format; you need to merge them before importing them in order to get a color raster map.
The socket error is probably caused by the fact that you don’t ahave a GRASS monitor on.

Jaime

Ana Isabel Rodríguez kidoki42@hotmail.com escribió:

hello everyone!

I’m still learning about grass world, i finally create a location, but i’m
not sure about a few thing… Whatever i use r.in.gdal to import a .jpg map
and it creates only map.1, map.2 and map.3 files; i tried visualized it and
they were only gray images. Later i wanted to import a new image, but tis
one was a .tif map, and it creates three new raster files, image.blue,
image.red and image.green. This time when i wanted to visualize them grass
mark the next error:

'No socket to connect to for monitor

size=5>((¯`··…·^·…··°k¥|/|ÃGÜ®£°··…·^·…··´¯))


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


Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
Regístrate ya - http://correo.espanol.yahoo.com/

Hi,

usually during input the colors are getting separated into the "red", "green" and "blue" chanal (you can display these chanals as gray scale images). For displaying you could use:
  d.rgb red=map.red green=map.green blue=map.blue
An alternative is to merge them first:
  r.composite red=map.red green=map.green blue=map.blue output=map.rgb
  d.rast map.rgb
(replace 'map' with your map name)

the other problem ist probably due to the fact that you need an X-display, before you can display any maps! So try this:
  d.mon x0

I hope this helps you
Wolfgang

Wolfgang wrote:

usually during input the colors are getting separated into the "red",
"green" and "blue" chanal (you can display these chanals as gray scale

images). For displaying you could use:
  d.rgb red=map.red green=map.green blue=map.blue
An alternative is to merge them first:
  r.composite red=map.red green=map.green blue=map.blue output=map.rgb
  d.rast map.rgb
(replace 'map' with your map name)

Hi,

any ideas on how to output 3 R,G,B rasters into a single 3-band GeoTIFF
without resolution loss? (ie no r.composite 256->32 col/band reduction)

r.out.gdal only takes a single input= map.

run r.out.gdal for each band then merge somehow with gdal_translate??

Hamish

On Thu, Jul 06, 2006 at 06:58:01PM +1200, Hamish wrote:

Wolfgang wrote:

> usually during input the colors are getting separated into the "red",
> "green" and "blue" chanal (you can display these chanals as gray scale
>
> images). For displaying you could use:
> d.rgb red=map.red green=map.green blue=map.blue
> An alternative is to merge them first:
> r.composite red=map.red green=map.green blue=map.blue output=map.rgb
> d.rast map.rgb
> (replace 'map' with your map name)

Hi,

any ideas on how to output 3 R,G,B rasters into a single 3-band GeoTIFF
without resolution loss? (ie no r.composite 256->32 col/band reduction)

Hi Hamish,
since r.out.gdal is still a shell wrappper to gdal_translate,
everything possible with gdal_translate should be(come) possible
with r.out.gdal.

r.out.gdal only takes a single input= map.

You could try to change that to multi.
BUT: I guess that gdal_translate only accepts one map.

run r.out.gdal for each band then merge somehow with gdal_translate??

What about this:
make r.out.gdal input multi, loop over all input channels
(say, put the code in r.out.gdal into the loop), if more
than one input map, call gdalwarp to merge them:

gdalwarp [--help-general] [--formats]
    [-of format] [-co "NAME=VALUE"]* srcfile* dstfile
                                          ^^^^-!

It's not well documented AFAIK that gdalwarp can be used
for such tricks (I only darkly remember some discussion
on this in the gdal ML). There should be no need to
use gdal_merge.py which would introduce an extra
dependency.

Markus

Markus wrote:

> r.out.gdal only takes a single input= map.

You could try to change that to multi.

just to note:

#% multiple: yes

in a shell script changes the usage and help output but does nothing to
the string. you'd have to add `tr ',' '\n'` or `cut -d',' -f ...`.
maybe use sed+wc to count ',' on the $GIS_OPT_INPUT string to check the
number of input maps.

Hamish

Hamish wrote:

> usually during input the colors are getting separated into the "red",
> "green" and "blue" chanal (you can display these chanals as gray scale
>
> images). For displaying you could use:
> d.rgb red=map.red green=map.green blue=map.blue
> An alternative is to merge them first:
> r.composite red=map.red green=map.green blue=map.blue output=map.rgb
> d.rast map.rgb
> (replace 'map' with your map name)

any ideas on how to output 3 R,G,B rasters into a single 3-band GeoTIFF
without resolution loss? (ie no r.composite 256->32 col/band reduction)

r.out.ppm3, then convert the PPM to a GeoTIFF.

--
Glynn Clements <glynn@gclements.plus.com>

On Thu, Jul 06, 2006 at 09:33:18AM +0200, Markus Neteler wrote:

On Thu, Jul 06, 2006 at 06:58:01PM +1200, Hamish wrote:

...

> any ideas on how to output 3 R,G,B rasters into a single 3-band GeoTIFF
> without resolution loss? (ie no r.composite 256->32 col/band reduction)

Hi Hamish,
since r.out.gdal is still a shell wrappper to gdal_translate,
everything possible with gdal_translate should be(come) possible
with r.out.gdal.

> r.out.gdal only takes a single input= map.

You could try to change that to multi.
BUT: I guess that gdal_translate only accepts one map.

> run r.out.gdal for each band then merge somehow with gdal_translate??

[... my useless comments ...]

Now I remember it:
The best way will be to create a VRT [1] file with all channels
defined in it, then run the gdal_translate.

Means:
- if single band, let r.out.gdal work as is
- if multi band, implement creation of a temporary VRT file, then
  use this VRT file as input to gdal_translate in the script
  and throw it away at the end.

Hint:
To quickly get the VRT syntax right, use r.out.gdal on a single
file with format VRT on a GRASS raster map. Even easier:
Take create_VRT_file() from i.in.spotvgt :slight_smile:

Markus

[1] https://gdal.osgeo.org/gdal_vrttut.html