Ps.output

From GRASS-Wiki
Jump to navigation Jump to search

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

Command line flags

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

-e Make an output file without the postscript header. Useful when is embebed into other 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 possition.

Generic Instructions

Parameters

dimen

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.

color

Define a color. Accepted formats are:

  • standard GRASS name
    e.g. indigo.
  • R:G:B
    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

number

text

Blocks of instructions

A block begin with the keywords and finish with keyword end

font

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.

line

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
Cap

frame

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)
todo

Map paper

paper

Base size of paper.

paper [B0-6|A0-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).
font
Block font. Set the default font of the map.
draw
Block draw. Free draw as watermarks before any feature of the map is drawn (see draw).

scale

Simple command to define the scale of the map (default adjust map to the paper dimensions).

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

maparea

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

maparea
Define characteristics of the map area.
border (dimen)
Width of the border map.
Usefull with in and out formats, predefined 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.

palette

palette

testing

wheel (number text)
monochrome (color number text)
complementary (color number text)
analogous (color number text)
pure_gradient (color.1 color.2 number text)
gradient (color.1 color.2 number text)
diverging (color.1 color.2 number text)

Common elements

grid and geogrid

Draw a graticula around the map. Predefined format: iho, can, in, out, or +out (numbers in the four limits of the map).

Many modifications are possibles to change color and style of the major and minir lines, trim zeros, etc. For example, to draw a typical border you must use the border set to 0.8mm in a maparea block, select the format out, set the style and color of the subdivisions, etc

grid|geogrid
format in|out|+out|can|iho
Type of border (see examples).
major (number|angle)
Block line.
minor (number|angle)
Block line.
subminor (number)
trim (number)
font
Block font.
fcolor (color)
Fillcolor of the border.
cross (number)
Replace lines by cross


Examples

scalebar

Maximun 5 scalebars in each map.

scalebar I|s|S|f|F
frame
Block frame
font
Block font
fcolor (color)
Fillcolor.
height (dimen)
length (dimen)
zero yes|no
Set position relative to zero value of the scalebar.
major (number.1 [number.2])
minor (number.1 [number.2])
units meters|m|kilometers|km|feet|ft|miles|mil|nautical_miles|nm ([text])


Examples

note

The block note permit write text on any place of the paper with frame, etc (also draw permit write text in paper). This command has an inline value with the text; this text can be a keywords: :maplimits, :dimen, :scale, or :file (to read the text from file); or free text in one line using '|' to break lines and '.' as first character to center line.

Maximun 20 notes by map.

note :file|:maplimits|:dimen|:scale (text)|(text)
Type of note and ext to show.


frame
Block frame.
font
Block font.
width (dimen)
Width of note.
angle (number)
number of degrees to rotate (do not work fine).

Examples

draw

The block draw run over map and all is clipped to the map limits. This command draw predefined postscript code.

However, there is an optional value to modify this feature. Valid options are: (1) paper: run before any map feature is drawn (equivalent to place inside paper block); and (2) free: run after all map features are drawn then it's draw over map but not clipped.

Raster maps

raster

Draw one or two raster maps on the maparea.


raster (raster|raster.R raster.G raster.B|:group)
The inline value is the raster mapname, three maps to draw as RGB, or a groupname (leader by ':') with tree RGB maps.


The next commands are optionals:

grey yes|no
Draw the rasters in grey scale (small size of file).
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.
maskcolor (color)
Set the color of the mask. If a raster map as background is set then it's drawn with a scale white-maskcolor.
outline
Block line to define ...
setcolor null|default|(number) (color)
Replace the color of the cat area with a new color. Multiple setcolor are possibles.


The following gallery show the output of the commands inside the raster block (all mapnames are of type raster).

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.
lpos (number)
Position where vector is plotted in legend and block.

vareas

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.

line
Block line to set the style of the border line of the areas.
lwidth (dimen)
Line map draws as an area with a width = lwidth (positive or negative).
fcolor (color|column.1|- column.2)
Static fill color, dynamic fill color in a column.1 of the database, or '-' and the name of a column.2 of the database to apply the rules (color in rules).
island yes|no
Draw island as normal areas (fill as normal area then hide it).
pat (epsfile)
Pattern in a EPS file.
pscale (number)
Scale of pattern.
pwidth (dimen)
Width of the lines of pattern.
setrule (n1-n2[:color] text)
Make a item of a sublegend with label the text and title the text of the label. Also, the fillcolor of the areas of the map with column >= n1 and column < n2 (column from fcolor), is set to color.


vlines

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.


The next commands are optionals:

type boundary|line
Draw boundaries of a vector of areas or lines of a vector of lines (default line).
line
Block line. Normal line.
rgbcol (column.1 [column.2])
Define the database column.1 to take the lines colors and, optionally, a column.2 of database to the rules.
hline
Block line. Highlight line.
offset (dimen)
Works with hline to offset from the center of line.
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.


vpoints

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.
line
Block line. Type of line in the symbol.
fcolor (color)
Static fillcolor of the symbol.
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.
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.
offset (dimen)
Offset of the symbol.
rotate (number|column)
Angle to rotate the symbol, static number or dynamic in a column of the database.
setrule (n1-n2[:size] text)
Variable size of symbols from data in column of database set in size.
dist (dimen)
Define the distance between symbol over the line (only when type is line).
cline
Block line. Type of line that connect symbols (only when type is line).


Examples

vlabels

in progress

vlabels none|(vector)
font
labelcol (column)
decimals (number)
circled yes|no
setrule (n1-n2 text)

Legend of the maps

rlegend

The block rlegend show the legend of a raster map. In the following images are shown the two types of outputs: the left one when raster is 'category' and the right one when is 'gradient'. In the code, the frame sub-command is not shown, and the cols, swidth, height, and order commands are optionals. Also, the units meters in the gradient legend is set with r.support.

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:

titlefont
Block font for the legend header.
font
Block font for the normal text.
frame
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).
nodata yes|no
Remove category no data.
order (n1,n2,...)
To reorder 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.

Examples

rlegend Zip Codes (wake)
  raster zipcodes_wake
  cols 2 0
  swidth 8mm
  order 20,10,30,22,34
end
rlegend
  raster elevation
  height 8cm
end
rlegend
  raster elevation
  width 8cm
  vertical no
end

vlegend

vlegend [text]
title
font
frame
cols (number.1 [number.2])
swidth (dimen)
interline (dimen)