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

Michael Barton michael.barton at asu.edu
Mon Sep 25 17:34:25 EDT 2006


Try this...

-Use v.to.rast to create a rasterized version of your vector map. Make sure
that the areas between the vectors are Null (use r.null as needed)

-Use r.colors (and r.reclass/r.recode as needed) to make sure that the
vector items are the proper color.

-Use r.patch to fill in the null areas between the vectors with your raster
map, creating a new map with the rasters and vectors in a single raster

Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics and Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

> From: Romy Schneider <romy at tacc.utexas.edu>
> Date: Mon, 25 Sep 2006 14:25:15 -0500
> To: <grassuser at grass.itc.it>
> Subject: [GRASS-user] Help combining raster and vector data into single raster
> image
> 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?
> 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.     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'.
> 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
> 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?
> Thanks in advance for any advice.
> Romy

More information about the grass-user mailing list