[GRASS5] [bug #2357] (grass) Working with rasters in diverse resolutions

Glynn Clements glynn.clements at virgin.net
Tue Mar 16 04:12:16 EST 2004


Morten Hulden wrote:

> > I am working with multiple raster data sets in diverse
> > resolutions, which presents a problem. For example, I cannot easily
> > overlay a 1 meter-resolution USGS quad on a 30 meter-resolution DEM. 
> > To get all the data out of the quad I have to oversample the DEM 900
> > times by setting the project resolution to 1m.
> > 
> > It seems to me that implementing support for multiple resolutions
> > at once would be a gargantuan pain for the poor programmers, but
> > this is (imho) a serious limitation of the program. Is there a
> > workaround that doesn't involve choking my RAM with oversampled
> > data? Is there perhaps a workaround in NVIZ?
> 
> There is no need to oversample. Within a location you can create named 
> regions which differ from the default region in resolution and/or 
> geographic coverage.
> 
> If the resolution of your default region is 30m and you want to import a
> 1m map, then create a new 1m region and switch to that before importing.  
> Or the other way around if your default is 1m.

The region settings are ignored when importing; maps are always
imported cell-for-cell (no resampling).

Resampling occurs when maps are read, or created by programs other
than importers.

> The display driver will understand how to overlay maps with different 
> resolutions.

The display drivers obtain their maps using the core libgis functions,
which will automatically resample them according to the current region
settings.

However, the issue here is that the poster has a low-resolution map
covering a relatively large region, and a much higher-resolution map
covering a small portion of that region.

Unfortunately, there isn't any way to display both simultaneously
without resampling both maps to the full region at the higher
resolution.

It wouldn't be a lot of work to provide a workaround for XDRIVER;
essentially, the display library would need to be changed to always
use the region settings from the WIND file, and not that stored on the
monitor. Then, you could do e.g.:

	d.erase
	g.region region=whole_area
	g.region res=30
	d.rast low_res_map
	g.region res=1
	d.rast -o high_res_map

This won't work at present, because the display library uses any
region settings which are stored on the monitor in preference to those
from the WIND file (which is why you often have to use d.erase after
changing the region).

OTOH, extending NVIZ is likely to be substantially more complex.

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




More information about the grass-dev mailing list