[GRASS5] Rasterisation problem

Glynn Clements glynn.clements at virgin.net
Tue Sep 9 08:03:28 EDT 2003


Amish K. Munshi wrote:

> I would like to represent Indictrans team (http://www.indictrans.org). We
> are working on a project for localization of linux in various Indian
> languages. We also wish to make use of GRASS for digitizing, analyzing &
> processing various geographical data collected from the villages so that
> people there may actually use it to get information.
> 
> We have few files in jpg format which are scanned images of some maps. We
> want to digitize these maps. So we followed following steps:
> 
> convert those images to raster files(RGB overlays).
> 
> 
> set the color tables of these RGB fies to grey.
> 
> 
> When we displayed these 3 files (.1,.2 & .3) as RGB overlays on a monitor we
> could only see plain white screen. What was happening was the 3 RGb overlays
> which were being created using r.in.gdal were empty.

This is usually because the boundaries of the imported maps don't
intersect the current region. "g.region -p" will show the current
region, while "r.info" will show (amongst other things) a map's
boundaries.

If you are importing images which don't have any georeferencing
information (which is basically everything except GeoTIFF files), the
resulting map will have it's lower-left corner at the origin of the
location's coordinate system, and be scaled such that one image pixel
corresponds to one unit (on foot or one metre for projected coordinate
systems, one degree for lat/lon).

After importing with r.in.*, you usually have to set the boundaries of
the new maps using either r.region (non-interactive) or r.support
(interactive).

> We also had a prepared a script which we used to use for all this. This
> script was working properly before. But now that also doesn't work. I am
> attaching that script with this mail.

> r.colors map=$FILE_NAME.1 col=grey
> 
> r.colors map=$FILE_NAME.2 col=grey
> 
> r.colors map=$FILE_NAME.3 col=grey

Using "col=grey" will map black/white to the lowest/highest values
which actually occur in the data, which probably isn't correct (when
dealing with R/G/B colour channels, it definitely isn't correct).

For images which store intensity values as bytes (i.e. 0 to 255, which
is always the case for JPEG), you should use e.g.:

	r.colors map=$FILE_NAME.1 col=rules <<EOF
	0 black
	255 white
	end
	EOF
	r.colors map=$FILE_NAME.2 rast=$FILE_NAME.1
	r.colors map=$FILE_NAME.3 rast=$FILE_NAME.1

-- 
Glynn Clements <glynn.clements at virgin.net>




More information about the grass-dev mailing list