[GRASS-user] Help combining raster and vector data into single raster image

Glynn Clements glynn at gclements.plus.com
Mon Sep 25 17:11:37 EDT 2006


Romy Schneider wrote:

> I am currently trying to take a raster map and a vector map and  
> combine them to produce a raster (image) map.  I am running GRASS  
> 6.1.0 on an Intel Mac and have tried several different avenues, none  
> to any success.  If anyone has any successful experience with any of  
> the following methods, I would greatly appreciate any help you could  
> provide.
> 
> 1.  First tried displaying everything in the "Map Display" window,  
> saving this image as a TIFF, JPG, BMP, and/or a PPM, and then  
> importing this image using r.in.gdal.
>    In every case, the output image looks fine, but r.in.gdal imports  
> the three bands (red, green, blue or 1, 2, 3) as empty files.  At  
> least, when I display the files, there is nothing there.  I tried  
> combining the three bands into a single RGB raster using r.composite,  
> and also tried overriding the projection on import in case there was  
> a problem with that, but neither trick worked.  Is there something I  
> am missing here?

Images are normally imported at the origin of the coordinate system,
which results in them lying outside of the current region. Check the
maps' bounds with r.info; you can fix the bounds with r.region.

In any case, this is usually the wrong approach. Rendering maps
introduces resampling errors and loss of georeferencing.

> 2.  Also tried using the regular display monitor with the PNG driver  
> to save a PNG file.  Similar problem, as I can produce the png file,  
> but when I import this into Grass, it again is an empty file.

This is essentially the same process as #1, except doing it manually
instead of having gis.m/d.m doing it for you. It suffers from all of
the same issues as #1.

> I would like to use the CELL driver (per Grass 5 documentation), but  
> this feature must have been removed from Grass 6, because it is not  
> listed as a valid display monitor with d.mon -l and when I try the  
> command "d.mon start=CELL" it says there is no such monitor as 'CELL'.

The CELL driver is no longer supported. It wouldn't eliminate the
problems you are having.

> 3.  I also tried to get around the apparent r.in.gdal problem by  
> using gdal_translate to translate the various image files (TIFF, JPG,  
> etc) into an ArcInfo ASCII grid and then import this into Grass using  
> r.in.arc.  While gdal_translate writes the Arcinfo grid sucessfully,  
> trying to import this file in grass using r.in.arc results in the  
> following error:
> r.in.arc: ** errors detected in header section **
> 
>    illegal line in header
>    dx           1.000000000000
>    "cellsize" field missing from header
>    "nodata_value" field missing from header
> ERROR: Can't get cell header

I'm not familiar enough with ArcInfo files to comment on this.

> Does anyone what I am doing wrong in any of these methods (it is very  
> likely I am missing something, I've only been using grass for a  
> couple of weeks)?  Or have any tips on how to accomplish what I want  
> to produce?

To combine several maps, first convert the vectors to rasters with
v.to.rast, then patch the raster maps together with r.patch.

In general, re-importing images generated by the d.* commands and the
PNG driver is almost always the wrong approach.

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




More information about the grass-user mailing list