ps.map problem - solution

Scott Wade wade at vinny.cecer.army.mil
Fri Dec 16 16:52:08 EST 1994


AVOID LEADING BLANKS IN CONFIGURATION FILES FOR ps.map

Stuart Bradshaw at Ft. Lewis, Washington (bradshaw at lewis-deh2.army.mil)
wrote about invalid "ps.map" results:

> From: bradshaw at lewis-deh2.army.mil (Stuart Bradshaw)
> Newsgroups: info.grass.user
> Subject: ps.map help
> Date: 16 Dec 94 00:46:32 GMT
> 
> I need some help with ps.map. I'm pretty sure I have everything setup 
> correctly, but the postscript file that is generated will not print (on 
> HP IV SI or tektronix phaser, both postscript) nor is it viewable in a
> program like ghostview. 
> 
> My ps.devices file contains:
>        level: 2
>        page width: 8.5
>        page height: 11.0
>        top margin: 0.5
>        bottom margin: 0.5
>        left margin: 0.25
>        right margin: 0.25
>        resolution: 300
>
> I used this command:
>
> ps.map i=ps.rules o=ps.test
>
> and it generated this output to the screen.
>
> PS-PAINT: PostScript painter "hpnature" selected.
> PS-PAINT: scale set to 1 : NaN.
> PS-PAINT: reading raster file <boundary in PERMANENT> ...
> PS-PAINT: PostScript file "ps.test" successfully written.
>
> Maybe the line concerning scale is causing the problem, I certainly don't know
> what it means. My ps.rules file is simply:
>
> scale 8.5 inches
> raster boundary
> end
>
>-------------------------------------------------------


I believe that I have found the cause of Stuart's problem.   The leading
blanks in the example of his ps.devices file above are not just there
so that it is easy to read in his message posted to the net.  Those
blanks are also in his actual file in "$GISBASE/etc/paint/ps.devices".

I added leading blanks to a test ps.devices file, and I achieved the
same results (scale of 1:NaN, and a small, presumably unprintable,
output file).  One or more blank spaces at the beginning of each line
in the ps.map configuration file gives the "1:NaN" result.  If some
lines are indented and some not, other weird results are obtained
(e.g., *negative* scales, once thought possible only after operating
GRASS under the influence of large quantities of Molsons).

Start all lines in your ps.devices files in the first column.

The screen output of:
  PS-PAINT: PostScript file "ps.test" successfully written.
is a lie.  The "ps.map" code apparently does not do a thorough
check of the results before declaring success.

RELATED NEWS:
Leading blanks in "ps.map" and "p.map" scripts can also cause
problems.  If you comment out a line using "#", that symbol
must appear at the beginning of the line, with no leading blanks.

For example, both of the following "ps.map" scripts return
an error message that reads: " ERROR:  #raster : illegal request "

===EXAMPLE 1==========
   scale 8.5 inches
   #raster quads
   vector quads
   end

===EXAMPLE 2==========
scale 8.5 inches
   #raster quads
vector quads
end

It is perfectly valid to indent lines in a map script file, and it is
perfectly valid to comment a line out with a "#", but in only that case
it must be in the first column:

===EXAMPLE 3==========
scale 8.5 inches
#raster quads
vector quads
end


  ///\\\///
  Scott Wade
  wade at vinny.cecer.army.mil
  Technical Assistance Center
  U. S. Army Construction Engineering Research Laboratories



More information about the grass-user mailing list