[GRASSLIST:8415] Re: ps.map resolution

Glynn Clements glynn at gclements.plus.com
Mon Sep 26 12:02:12 EDT 2005


Ian MacMillan wrote:

> Glynn, I guess I just don't understand.  The raster can not be written 
> at the region's resolution with ps.map.  In my example I sent, the same 
> region produced rasters of different resolution solely based on the 
> scale entered in ps.map.  The resolution is much coarser for a 1:50000 
> map compared to a 1:500 map.  These maps were made without changing the 
> region.  I understand that the raster is embedded within the postscript 
> file, but that raster's resolution can not be based only on the 
> region's settings if one can get different resolutions without changing 
> the region.

Sorry, you're right; ps.map has a hardcoded limit of 75dpi. The
"scale" command changes the size of the image, and thus of the
computed resolution.

set_paper.c has a hardcoded setting:

    PS.res = 75;

This is used in map_setup.c to limit the size of a raster:

	if (PS.grey || PS.level == 1) limit = 300000000L;
	else limit = 100000000L;
    	while (num_cells > limit || cells_per_inch > PS.res)
    	{	
	    if (PS.cells_high >= PS.cells_wide)
            {   
	    	PS.cells_high /= 2;
	    	PS.ns_res *= 2.0;
	    	PS.row_delta++;
		cells_per_inch /= 2;
	    }
	    else
	    { 
	    	PS.cells_wide /= 2;
	    	PS.ew_res *= 2.0;
	    	PS.col_delta++;
		cells_per_inch /= 2;
	    }
    	    num_cells = (long)PS.cells_high * (long)PS.cells_wide;
    	}

Thus it effectively rescales the raster by powers of two until it is
less than 75dpi and contains less than 3E8 pixels for greyscale or 1E8
pixels for colour.

You may be able to get around the 75dpi limit by selecting a larger
paper size then rescaling it with psresize (from the psutils package).

Personally, I think that code should simply be removed. I suspect that
it was put there to prevent users from accidentally creating huge
print jobs on a system which couldn't handle them.

Note that the image is "streamed" (rendered as it is read from the
PostScript file, not stored), so the amount of memory in the printer
isn't an issue.

> So it seems to me that the resolution is based on the region, and the 
> output device that the postscript is written to.  The effective 
> resolution of the raster in the postscript file does not necessarily 
> equal that of the region.  My question is this, how does one get an 
> effective resolution equal to that of my region in my final postscript 
> file using ps.map?  Can I set up a fake output device with a really 
> high resolution in Grass 6?

Use a larger paper size, or simply remove all references to PS.res
from ps.map.

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




More information about the grass-user mailing list