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

font

line

frame

dimen

Map paper

paper

The block paper has an online value to define the base size of the paper. Valid options are: B0-6, A0-6, Legal, Ledger, Tabloid, Executive, or Folio. For all, the default left and right margins are 0.5 inch, and 1 inch in top and bottom margins. Custom dimensions are possibles with commands height and width while margins with the commands left, right, top, and bottom.

Also, in ps.out is possible define the backcolor of the paper (color), orientation (landscape), default font (font) and free draw of decorates as watermarks before any feature of the map is drawn (draw).

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.

scale

Simple command to define the scale of the map (default adjust map to the paper dimensions). For example, scale 1:500000 to rescale maparea dimensions.

scale 1:(number)
Scale of map, if possible.

maparea

The block maparea define specific dimensions of the map (default defined by command scale). In particular height, widht, and the positions in the paper with left and top.

There are two special command: color, define the color of the border of the map (draw with grid...); and border, define the width of the border of the map (usefull with in and out formats).

border (dimen)
color (color)
fcolor (color)
width (dimen), height (dimen)
top (dimen), bottom (dimen)

palette

Common map 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

scalebar

Maximun 5 scalebars in each map.

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.

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

This block draw one or two raster maps on the maparea.

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

raster elevation
end
raster elevation
  grey yes
end
raster lsat5.5 lsat5.4 lsat5.3
end
raster zipcodes_wake
  maskcell zipcodes_wake
  maskcolor 200:200:120
end
raster elevation
  maskcell census_26 elevation
end
raster elevation
  maskcell census_26 elevation
  maskcolor indigo
end
raster zipcodes_wake
  maskcell zipcodes_wake elev_state_500m
  outline
    width .2mm
  end
end
raster zipcodes_wake
  maskcell zipcodes_wake elev_state_500m
  outline 
    width .2mm
    color white
  end
  setcolor 37 black
end

commands

All commands are optional except raster and end.

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.
grey yes|no
Draw the rasters in grey scale (small size of file).
maskcell (mask) [(background)]
Set the map to use as mask (independent of the mask set in GRASS with r.mask) and, optionally, the raster 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 (cat) (color)
Replace the color of the cat area with a new color. Multiple setcolor are possibles.

Vector maps

common commands

All commands are optional.

layer (number)
Layer number used with cats/where option.
cats (n1,n2,...)
List of cats to show.
where (sql)
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|rgbcol|- rulecol)
Static fill color, dynamic fill color in a column of the database, or '-' and the name of a column of the datase 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.

examples

vareas geology
  where GEO_NAME like 'Zb'
  fcolor indigo
end
vareas geology
  where GEO_NAME like 'Zb'
  pat ../patterns/diag_up.eps
  pscale .5
  fcolor indigo
end
vareas geology
  where GEO_NAME like 'Zb'
  pat ../patterns/diag_up.eps
  pscale .5
  fcolor - cat
  setrule 0-500:red 0 <= cat < 500
  setrule 500-1000:green 500 <= cat < 1000
  setrule 1000-5000:blue 1000 <= cat < 5000
end
vareas geology
  where GEO_NAME like 'Zb'
  pat ../patterns/diag_up.eps
  pscale .5
  island no
  fcolor - cat
  setrule 0-500:red low cat
  setrule 500-1000:green middle cat
  setrule 1000-5000:blue high cat
end

vlines

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

vlines (vector)

The next commands are optionals:

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

type boundary|line
Draw boundaries of a vector of areas or lines of a vector of lines.
line
Block line. Normal line.
rgbcol (rgbcol [rulecol])
Define the database column to take the lines colors and, optionally, a column 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.

examples

vlines roadsmajor
  type line
  line
    width 1mm
    color yellow
  end
  hline
    width 1mm
    color red
  end
end

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|database [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 (usefull when there are sizes of zero, e.g., precipitation).
offset (dimen)
Offset of the symbol.
rotate (number|database)
Angle to rotate the symbol, static number or dynamic in a column of the database.
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).

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 (map)
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 color data.
  • 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.
  • Gradient legends
height (dimen), width (dimen)
Dimension of the frame with the legend.
vertical yes|no
Orientation of the gradient legend (default no).
range
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