From GRASS-Wiki
Jump to: navigation, search

The ps.out try to update the standard postscript output of Grass adding new features to design borders, graticules, categorized legends, etc

This is in progress and not all features are yet uploaded in addons.

Command line flags

-d : Draw a 1x1 cm grid on paper to help the placement of the elements of the map.

-e: Create an output file for embedding into another ps.out map

-g: Use the extended PostScript of Ghostscript (for transparent colors only)

-s: Draw the small digit in the coordinate numbers to lower instead upper position.

Generic Instructions



Define a dimension. Accepted units are:

  • unitless 
    e.g. 123. The dimension is the number by 1/72".
  • inch 
    e.g. 1.2inch.
  • milimeters 
    e.g. 2.3mm.
  • centimeters 
    e.g. 1.4cm.
  • percentage 
    e.g. 50%.
    The position is relative to the size and position of the map in the paper being 0% the left or bottom corner.


Define a color. Accepted formats are:

  • standard GRASS name 
    e.g. indigo.
  • R:G:
    e.g. 200:123:90
  • user name 
    e.g. red5.
    Defined in palette block

All formats can add '$(0-1)' to define the opacity of the color (alpha channel); e.g., indigo$.75 or 200:120:120$.2



Blocks of instructions

A block begin with the keywords and finish with keyword end


Define the characteristic of a font.

name (text) 
Name of font.
size (dimen) 
Size of font.
extend (dimen)
Expand the width of font.
color (color) 
Color of font.
outline yes|no 
Outline of the font.


Define the characteristic of a line.

width (dimen) 
Width of line.
color (color) 
Color of line.
style solid|dashed|dotted|dashdotted|(n1n2...) 
Style of line.
cap butt|round|extended_butt 
extended type step [voffset height width] 
Extended style of line for use mainly with rects.
type = arrow, bar, circled_semi, double_bar, point, rombo, square, triangle, xcross, zigzag (you can use only the first char; and uppercase for filled version).
step = (dimen).
voffset = (dimen).
height = (dimen).
width = (dimen).
baseline (y|n) 
Work with the extended option to define if the baseline is drawn.


Define the characteristic of a fill area.

color (color) 
Fill color.
pat (file) 
Fill pattern.
lwidth (dimen) 
Line width of the fill pattern.
scale (number) 
Scale of the fill pattern.
limit (dimen) 
Limit the fill to the border with a width of dimen.


Define the characteristic of a frame.

where (dimen.1 dimen.2) 
Position of frame.
offset (number.1 number.2) 
Fine x and y adjust of the position of frame.
ref right|left|center upper|lower|center 
Position is relative to the ref.
border (dimen) 
Width of the border line
color (color) 
Color of the border line.
fcolor (color) 
Fillcolor of the frame.
rotate (dimen) 


lpos (number)
Position in legend
Codes: -1, no show in legend; 0 automatic position; > 0 horizontal position.
cols (number.1 [number.2])
Organize legend in number.1 cols with a optional span of number.2
interline (dimen)
Set partial legend interline

Map paper


Size of paper.

paper [A0-6|B0-6|Legal|Ledger|Tabloid|Executive|Folio] 
Type of paper (default A4).

color (color) 
Paper color.
width (dimen), height (dimen) 
Custom size of paper.
left (dimen), right (dimen), top (dimen), bottom (dimen) 
Custom margins (default 0.5" left and right, and 1" top and bottom).
landscape yes|no 
Paper orientation (default no).
Block font. Set the default font of the map.
Block draw. Free draw as watermarks, before any feature of the map is drawn (see draw).


Scale of the map.

Simple line command to define the scale of the map. The default is adjust map to the paper dimensions. If the remaining dimensions of the paper not permit the scale, ps.out adjust the scale to a new value that it fit in the paper.

scale 1:(number) 
Scale of map.
For example, scale 1:500000 to rescale maparea dimensions.


Define specific dimensions of the map (default defined by command scale)

Define characteristics of the map area.

border (dimen) 
Width of the border map.
Usefull with in and out formats of the grid and geogrid, ignored in iho and can formats.
color (color) 
Border color-
fcolor (color) 
Fillcolor of the map area.
width (dimen), height (dimen) 
Dimensions of the map.
top (dimen), bottom (dimen) 
Position of the top-left corner of the map.
Block draw.
Draw onto the map but before the grid lines, vpoints and vlabels are drawn; i.e. this map elements are drawn over the draw elements.




light (color text) 
dark (color text) 
wheel (number text) 
monochrome (color number text) 
complementary (color number text) 
analogous (color number text) 
gradient (color.1 color.2 number text) 
binary (color name) 
sequential (color.1 color.2 number text) 
qualitative (number text) 
diverging (color.1 color.2 number text) 

Common elements

grid and geogrid

Draw a border around the map.


format in|out|+out|can|iho 
Type of border (see examples).
major (number|angle) 
Block line. Usually, number is merters and angle only in geogrid.
minor (number|angle) 
Block line. Usually, number is merters and angle only in geogrid.
subminor (number) 
number of subdivisons of the minor divisions.
trim (number) 
Cut trailing zeros.
Block font.
fcolor (color) 
Color of the border.
cross (number) 
Replace lines by cross


Set a scalebar on the map.
Maximun 5 scalebars in each map.

scalebar I|l|s|S|f|F 
Define the type of scalebar (I: inner, l: line, s/S: simple, f/F: fill).

length (number) 
Length of the scale.
units meters|m|kilometers|km|feet|ft|miles|mil|nautical_miles|nm ([text]) 
Unit of the length and text' to label the units.
major (number.1 [number.2]) 
Define the number.1 of subdivisions and each number.2 set the labels.
minor (number.1 [number.2]) 
Define the number.1 of subdivisions and each number.2 set the labels.
Block frame
Block font
fcolor (color) 
height (dimen) 
Height of the bar or ticks.
zero yes|no 
Set position relative to zero value of the scalebar.


Write special text or free text on any place of the paper with frame (also draw permit write free-text in paper).

Maximun 20 notes by map.

note :file|:maplimits|:dimen|:scale (text)|(text) 
Type of note and text to show.
When free text, use '|' to break lines and '.' as first character to center line.

text (text) 
Another roption to enter the same as inline note text;
Block frame.
Block font.
width (dimen) 
Width of note.
angle (number) 
number of degrees to rotate (do not work fine).


Simple script language to draw predefined postscript code.

draw [none|paper|maparea|free] 

paper: before any map feature is drawn (equivalent to place inside paper block);
maparea before the last elements of the map (equivalent to place inside mapare block) ;
none: draw over all elements of the map but only in the map area; and
free: after all map features are drawn in any place of the paper; and none.


Raster maps


Draw one or two raster maps on the maparea.

raster (raster|raster.1 raster.2|raster.R raster.G raster.B|:group) 
The raster value is the raster mapname, two raster maps raster.1 or color and raster.2 or shade to draw as relief map, three maps raster.R, raster.G and raster.B to draw as RGB, or a groupname (leader by ':') with tree RGB maps.

The next commands are optionals:

hillshade yes|no 
Use when draw a shaded raster to draw hillshade.
grey yes|no 
Store and draw the rasters in grey scale (small size of file).
The conversion follows the NTSC video standard.
maskcell (raster.1 [raster.2]) 
Set the raster.1 map to use as mask (independent of the mask set in GRASS with r.mask) and, optionally, the raster.2 map uses as background.
The background raster.2 is painted in grey scale (NTSC) and tinted with maskcolor.
maskcolor (color|none) 
Set the color of the mask area.
If a raster map as background is set then it's drawn with a scale white-maskcolor.
Block line. Outline of categories.
setcolor null|default|(number) (color) 
Replace the color of the cat number area with a new color.
Multiple setcolor are possibles.

Vector maps

All vector map accept optionally the following commands:

layer (number) 
Layer number used with cats/where option.
cats (n1,n2,...) 
List of cats to show.
where (text) 
Argument of the SQL where clausule to filter the areas to show.
masked yes|no 
Masked or not by raster mask (default no).
label (text) 
For description or title in vlegend.
legend [(number)]
Position in legend (-1, no legend) or enter in a block legend.


Draw areas on the map.
The areas always are drawn first, on the bottom of other type of maps.

vareas (vector) 
vector is a vector of areas, except when lwidth is different to zero that vector is a vector of lines.

The next commands are optionals:

type area|line 
Default area.
Block line. Style of the boundary.
Block fill. Style of the area.
rgbcol (column.1 [column.2]) 
Dynamic fill color in a column.1 of the database, or conditional color from rules applied to column.2 of the database.
setnorule (text) 
Text label when default conditions.
setrule (n1-n2[:color][|dimen] text) 
Make a item of a sublegend with label the text and title the text of the label.
The fillcolor of the areas is set to color and the line width is set to dimen when column.2 >= n1 and column.2 < n2 (column.2 from rgbcol).

Special commands:

island yes|no 
Draw island as normal areas (fill as normal area then hide it).
mirror (dimen [number]) 
The line is drawn as an area with a copy of the line placed with polar coordinates: dimen' and angle.


Draw lines on the map.
The areas always are drawn second, after vareas and before vpoints.

vlines (vector) 

vector is a vector of lines, except if type is boundary that vector is a vector of areas.

Optional commands:

type line|boundary 
Draw boundaries of a vector of areas or lines of a vector of lines (default line).
Block line. Normal line.
Block line. Highlight line.
offset (dimen) 
Works with hline to offset from the center of line.
rgbcol (column.1 [column.2]) 
Dynamic line color in a column.1 of the database, or conditional color from rules applied to column.2 of the database.
setnorule (text) 
Label in legend when default values and setcolor rules.
setrule (n1-n2[:color] text) 
Make a item of a sublegend with text as label and title the text of the label. Also, the color of the normal line with column >= n1 and column < n2 (column from rgbcol), is set to color.


Draw points on the map.
The points always are drawn last, after vareas and vlines.

vpoints (vector) 

vector is a vector of points, except when type is centroid or boundary that it is a vector of areas, or when type is line that it is a vector of lines.

The next commands are optionals:

type centroid|line|boundary|point 
Type of draw (default point).
symbol (epsfile) 
Symbol to use (default: basic/circle).
Block line. Type of line in the symbol.
fcolor (color)
Static fillcolor of the symbol.
offset (dimen) 
Offset of the symbol.
rotate (number|column) 
Angle to rotate the symbol, static number or dynamic in a column of the database.
size (number|column [number]) 
Size of the symbol take from number or from a column of the database. In the last option, there is a optional number to define the static size of the symbol in the legend when the size of symbols are dynamic.
scale (dimen.1 [dimen.2]) 
Rescale the size of the symbol by the dimen.1 and, optionally, add a dimen.2. i.e., resize = dimen.1 * size + dimen.2.
setsize (n1-n2[:size] text) 
Variable size of symbols from data in column of database set in size.

Special commands when type is line:

dist (dimen) 
Define the distance in paper between symbol over the line.
Block line. Type of line that connect symbols.


in progress

vlabels none|(vector) 

labelcol (column) 
decimals (number) 
circled yes|no 
setrule (n1-n2 text)

Legend of the maps


Legend of the raster map.
The units meters in the gradient legend is set with

rlegend [text] 
Text is the title of the legend.
raster (raster) 
the raster map to take the data of legend.

The next commads are optionals:

Block font for the legend header.
Block font for the normal text.
Block frame.
swidth (dimen) 
Width of the symbol area.

For category legends

cols (number) [(number)] 
Number of columns with symbols and separation between columns (default 1).
interline (dimen) 
Vertical space between symbols (o to join symbols)
nodata yes|no 
Remove category no data.
order (n1,n2,...) 
To reorder the items.

For gradient legends

height (dimen), width (dimen) 
Dimension of the frame with the legend.
vertical yes|no 
Orientation of the gradient legend (default no).
range (n1 n2) 
Manual set of the data range for legend.
gradient yes|no 
Forze draw gradient legend with category data.
tick (dimen) 
Length of the ticks.
whiteframe (dimen) 
Width of the white frame around the bar color.


Legend of the vector maps.

vlegend [text] 
Optional the title or head of the legend.

The next commands are optionals:

Block font for title of legend.
Block font for normal text of legend.
cols (number.1 [number.2]) 
Distribution of the items in number.1 cols. Optionaly, number.2 of span between columns.
swidth (dimen) 
Symbol width.
interline (dimen) 
Space between lines.

Conversion to PDF

You can obtain good results with these settings:

 ps2pdf14 -dPDFSETTINGS=/prepress -dEmbedAllFonts=true map.pdf

Example for ps.output control script

This is the content of a ps.output control file:

paper A4
 landscape y
 height 12cm
 border .8mm
 color grey

 major 100000
  width .1mm
  color white
 minor 50000
  width .1mm
  color white
  style 1
  name Univers
  size 6
  extend 1.2
  color black
 fcolor black
 format +out
 trim 3

raster ortho.r ortho.g ortho.b