Ps.output
The ps.out try to update the standard postscript output of Grass adding new feature 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.
![](/w/images/Ps_out_grid.png)
-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.
-
with flag -s
-
without flag -s
Generic Instructions
font
line
frame
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).
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.
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).
palette
Common elements on the map
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 formats
-
iho
-
can
-
in
-
+out
-
typical map border
-
typical map border with subminor 5 and fcolor blue
-
cross 500, fcolor indigo, color 200:200:200 in maparea
scalebar
Maximun 5 scalebars in each map.
- Scalerbar styles
-
s
-
S
-
I (uppercase i)
-
f
-
F
-
Multiple scalebars zero centered with zero yes
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 keywords and free text
-
:maplimits
-
:dimen
-
:scale
-
in multiple lines
-
.centered
-
:scale scale with angle 90
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.
- Sample gallery
-
north 700000 4700000
-
north 5cm 16.5cm -
-
maplimits
-
compass 700000 4700000 10000 10.2345
Raster maps
raster
rlegend
Vector maps
vareas
vlines
vpoints
vlegend
Creating maps with same layout using ps.out
To make several maps with the same layout, we use three files: map_pre, map_post, and a master file. Also we need the map_# with the particular content of the map.
The master file, to repeat the creation of all maps with the same layout, is as:
#!/bin/bash
MAP=map_ps
function makemap()
{
echo "#!/bin/bash" > $MAP
cat map_pre >> $MAP
cat $1 >> $MAP
cat map_post >> $MAP
chmod +x $MAP
./$MAP $1
rm $MAP
}
makemap map_1
makemap map_2
The file map_pre include all code to execute ps.out and design the basic elements of the map: title, graticule, scalebar, north-arrow, etc. A example content is:
OUTPUT=$1
ps.out -g out=$OUTPUT.ps << EOF
paper A4
left 2cm
top 2cm
landscape y
draw
color 70:70:70
linewidth .4mm
rect 22cm 2cm 28cm 19cm 240:240:240
color black
font OffensiveBold 10 .8
text 25cm 6cm "MAIN TITLE"
end
end
scale 1:500000
grid
format iho
trim -1
major 50000
width .18mm
color none
end
minor 25000
width .18mm
color none
style 2
end
subminor 5
font
name Univers
size 10
color black
end
fcolor black
end
vlines bz_lim
type boundary
label Límite del Bierzo
lpos -1
line
width .3mm
color black
end
end
The file map_post include the final ending code, and perhaps the common legend style. For example,
vlegend Legend
frame
where 25cm 12cm
ref center center
offset 0 0
border .3mm
fcolor white
margin 12
end
title
name Univers-Bold
size 10
extend 1.25
end
font
name Univers
size 9
end
end
EOF
echo "GO Go go: $OUTPUT.pdf"
ps2pdf14 $OUTPUT.ps
The file map_# include the specific code to draw the particular maps. For example,
vareas risk_range
label Probabilidad de infección
legend 0
line
width .01mm
color none
style 1
end
fcolor GRASSRGB$.7 cat
masked y
setrule 1 Muy baja
setrule 2 Baja
setrule 3 Media
setrule 4 Alta
setrule 5 Muy alta
end
vpoint cs_parcela
label Intensidad de ataque
where ch_pr > 0
symbol basic/circle
line
width .1mm
color black
end
fcolor white$.3
size ch_prx 8
scale 5 2
masked y
end