Ps.output: Difference between revisions

From GRASS-Wiki
Jump to navigation Jump to search
 
(115 intermediate revisions by 2 users not shown)
Line 1: Line 1:
The '''ps.out''' try to update the standard postscript output of Grass adding new features to design borders, graticules, categorized legends, etc
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 ==
== Command line flags ==


'''-d ''' Draw a 1x1 cm grid on paper to help the placement of the elements of the map.
'''-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.
'''-e''': Create an output file for embedding into another ''ps.out'' map


'''-g''' Use the extended PostScript of Ghostscript (for transparent colors only)
'''-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.
'''-s''': Draw the small digit in the coordinate numbers to lower instead upper position.


<gallery perrow="6">
<gallery caption="Sample gallery" widths="100px" heights="100px" perrow="3">
File:ps_out_grid.png|A4 paper with flag -d  
File:ps_out_grid.png|A4 paper with flag -d  
File:ps_out_digit_upper.png|coordinate
File:ps_out_digit_upper.png|coordinate
Line 65: Line 67:
; extend (dimen): Expand the width of font.
; extend (dimen): Expand the width of font.


; color (color) : Color of font.  
; color (color) : Color of font.
 
; outline yes|no : Outline of the font.


==== line ====
==== line ====
Line 73: Line 77:
; width (dimen) : Width of line.
; width (dimen) : Width of line.


; color (color) : COlor of line.
; color (color) : Color of line.


; style solid|dashed|dotted|dashdotted|(n1n2...) : Style of line.
; style solid|dashed|dotted|dashdotted|(n1n2...) : Style of line.


; cap butt|round|extended_butt : Cap
; cap butt|round|extended_butt : Cap
; extended type step [voffset height width] : Extended style of line for use mainly with rects.<br> ''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).<br>  ''step'' = (dimen).<br> ''voffset'' = (dimen).<br> ''height'' = (dimen).<br> ''width'' = (dimen).
; baseline (y|n) : Work with the ''extended'' option to define if the baseline is drawn.
<gallery caption="Sample gallery" widths="200px" heights="200px" perrow="4">
File:ps.out_linex_A.png|extended arrow 1mm
File:ps.out_linex_B.png|extended bar 1mm
File:ps.out_linex_C.png|extended circled_semi 1mm
File:ps.out_linex_D.png|extended double_bar 1mm
File:ps.out_linex_P.png|extended point 1mm
File:ps.out_linex_R.png|extended rombo 1mm
File:ps.out_linex_S.png|extended square 1mm
File:ps.out_linex_X.png|extended xcros 1mm
</gallery>
==== fill ====
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''.


==== frame ====
==== frame ====
Line 96: Line 129:


; rotate (dimen) : <u>todo</u>
; rotate (dimen) : <u>todo</u>
==== legend ====
; lpos (number): Position in legend<br>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 ==
== Map paper ==
Line 101: Line 142:
=== paper ===
=== paper ===


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


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


; color (color) : Paper color.
; color (color) : Paper color.
Line 115: Line 159:
; font : Block ''font''. Set the default font of the map.
; 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'').
; draw : Block ''draw''. Free draw as watermarks, before any feature of the map is drawn (see ''draw'').


=== scale ===
=== scale ===


Simple command to define the scale of the map (default adjust map to the paper dimensions).
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<tt>:</tt>(number) : Scale of map, if possible.<br>For example, ''scale 1:500000'' to rescale maparea dimensions.
; scale 1<tt>:</tt>(number) : Scale of map.<br>For example, ''scale 1:500000'' to rescale maparea dimensions.


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


; maparea : Define characteristics of the map area.
; maparea : Define characteristics of the map area.


; border (dimen) : Width of the border map.<br>Usefull with ''in'' and ''out'' formats, predefined in ''iho'' and ''can'' formats.
 
 
; border (dimen) : Width of the border map.<br>Usefull with ''in'' and ''out'' formats of the ''grid'' and ''geogrid'', ignored in ''iho'' and ''can'' formats.


; color (color) : Border color-
; color (color) : Border color-
Line 137: Line 188:


; top (dimen), bottom (dimen) : Position of the top-left corner of the map.
; top (dimen), bottom (dimen) : Position of the top-left corner of the map.
; draw : Block ''draw''.<br>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.


=== palette ===
=== palette ===
<u>testing</U>


; palette
; palette


<u>testing</U>
 
; light (color text) :
 
; dark (color text) :


; wheel (number text) :
; wheel (number text) :
Line 152: Line 211:
; analogous (color number text) :
; analogous (color number text) :


; pure_gradient (color.1 color.2 number text) :
; gradient (color.1 color.2 number text) :
 
; binary (color name) :
 
; sequential (color.1 color.2 number text) :


; gradient (color.1 color.2 number text) :
; qualitative (number text) :


; diverging (color.1 color.2 number text) :
; diverging (color.1 color.2 number text) :
Line 162: Line 225:
=== grid and geogrid ===
=== 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).
Draw a border around 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 :
; grid|geogrid :


; format in|out|+out|can|iho : Type of border (see examples).
; format in|out|+out|can|iho : Type of border (see examples).


; major (number|angle) : Block ''line''.
; major (number|angle) : Block ''line''. Usually, ''number'' is merters and ''angle'' only in ''geogrid''.


; minor (number|angle) : Block ''line''.
; minor (number|angle) : Block ''line''. Usually, ''number'' is merters and ''angle'' only in ''geogrid''.


; subminor (number) :
; subminor (number) : ''number'' of subdivisons of the minor divisions.


; trim (number) :  
; trim (number) : Cut trailing zeros.


; font : Block ''font''.
; font : Block ''font''.


; fcolor (color) : Fillcolor of the border.
; fcolor (color) : Color of the border.


; cross (number) : Replace lines by cross
; cross (number) : Replace lines by cross
Line 186: Line 249:




==== Examples ====
<gallery caption="Sample gallery" widths="200px" heights="150px" perrow="3">
 
File:ps_out_iho.png|format iho
<gallery caption="Grid formats" widths="150px" heights="150px" perrow="4">
File:ps_out_can.png|format can
File:ps_out_iho.png|iho
File:ps_out_in.png |format in
File:ps_out_can.png|can
File:ps_out_out.png|format +out
File:ps_out_in.png |in
File:ps_out_out.png|+out
File:ps_out_out1.png|typical map border
File:ps_out_out1.png|typical map border
File:ps_out_out2.png|typical map border with ''subminor 5'' and ''fcolor blue''
File:ps_out_out2.png|typical map border with ''subminor 5'' and ''fcolor blue''
Line 200: Line 261:
=== scalebar ===
=== scalebar ===


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


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


; frame : Block ''frame''


; font : Block ''font''
; length (number) : Length of the scale.


; fcolor (color) : Fillcolor.
; units meters|m|kilometers|km|feet|ft|miles|mil|nautical_miles|nm ([text]) : Unit of the length and ''text' to label the units.


; height (dimen) :
; major (number.1 [number.2]) : Define the ''number.1'' of subdivisions and each ''number.2'' set the labels.


; length (dimen) :
; minor (number.1 [number.2]) : Define the ''number.1'' of subdivisions and each ''number.2'' set the labels.


; zero yes|no : Set position relative to zero value of the scalebar.
; frame : Block ''frame''


; major (number.1 [number.2]) :
; font : Block ''font''


; minor (number.1 [number.2]) :
; fcolor (color) : Fillcolor.


; units meters|m|kilometers|km|feet|ft|miles|mil|nautical_miles|nm ([text]) :
; height (dimen) : Height of the bar or ticks.


; zero yes|no : Set position relative to zero value of the scalebar.


==== Examples ====


<gallery caption="Scalerbar styles" widths="200px" heights="50px" perrow="3">
<gallery caption="Scalerbar styles" widths="200px" heights="50px" perrow="3">
File:ps_out_scalebar_s.png|s
File:ps_out_scalebar_s.png|scalebar s
File:ps_out_scalebar_S.png|S
File:ps_out_scalebar_S.png|scalebar S
File:ps_out_scalebar_I.png|I (uppercase i)
File:ps_out_scalebar_I.png|scalebar I (uppercase i)
File:ps_out_scalebar_f.png|f
File:ps_out_scalebar_f.png|scalebar f
File:ps_out_scalebar_F.png|F
File:ps_out_scalebar_F.png|scalebar F
File:Ps.out_scalebar_l.png|scalebar l (downcase L)
File:ps_out_scalebar_3.png|Multiple scalebars zero centered with ''zero yes''
File:ps_out_scalebar_3.png|Multiple scalebars zero centered with ''zero yes''
</gallery>
</gallery>


=== note ===
=== note ===
The block '''note''' permit write text on any place of the paper with frame, etc (also '''draw''' permit write text in paper).
Write special text or free text on any place of the paper with frame (also ''draw'' permit write free-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.
Maximun 20 notes by map.


; note <tt>:</tt>file|<tt>:</tt>maplimits|<tt>:</tt>dimen|<tt>:</tt>scale (text)|(text) : Type of note and ext to show.


; note <tt>:</tt>file|<tt>:</tt>maplimits|<tt>:</tt>dimen|<tt>:</tt>scale (text)|(text) : Type of note and text to show.<br>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;


; frame : Block ''frame''.
; frame : Block ''frame''.
Line 251: Line 315:
; angle (number) : ''number'' of degrees to rotate (do not work fine).
; angle (number) : ''number'' of degrees to rotate (do not work fine).


==== Examples ====


<gallery caption="Note keywords and free text" widths="150px" heights="100px" perrow="3">
<gallery caption="Note keywords and free text" widths="200px" heights="100px" perrow="3">
File:ps_out_note_ml.png  |'':maplimits''
File:ps_out_note_ml.png  |note :maplimits<br/>&nbsp;frame [...]<br/>end
File:ps_out_note_dimen.png|'':dimen''
File:ps_out_note_dimen.png|note :dimen<br/>&nbsp;frame [...]<br/>end
File:ps_out_note_scale.png   |'':scale''
File:ps_out_note_scale.png|note :scale<br/>&nbsp;frame [...]<br/>end
File:ps_out_note_free.png |free text|in multiple lines
File:ps_out_note_free.png|note free text|in multiple lines<br/>&nbsp;frame [...]<br/>end
File:ps_out_note_freec.png |.free text|.in multiple lines|.centered
File:ps_out_note_freec.png|note .free text|.in multiple [...]<br/>&nbsp;frame [...]<br/>end
File:ps_out_note_scaler.png   | '':scale scale'' with ''angle 90''
File:ps_out_note_scaler.png|note :scale scale<br/>&nbsp;frame [...]<br>&nbsp;angle 90<br/>end
</gallery>
</gallery>


=== draw ===
=== draw ===


The block '''draw''' run over map and all is clipped to the map limits. This command draw predefined postscript code.
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); <br>
''maparea'' before the last elements of the map (equivalent to place inside ''mapare'' block) ; <br>
''none'': draw over all elements of the map but only in the map area; and <br>
''free'': after all map features are drawn in any place of the paper; and ''none''.
 
 
; --- :


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.


<gallery caption="Sample gallery" widths="100px" heights="100px" perrow="4">
<gallery caption="Sample gallery" widths="200px" heights="100px" perrow="3">
File:ps_out_north1.png  |<source lang="text">north 700000 4700000</source>
File:ps_out_north1.png  |<source lang="text">north 700000 4700000</source>
File:ps_out_north2.png  |north 5cm 16.5cm -
File:ps_out_north2.png  |north 5cm 16.5cm -
Line 284: Line 354:




; raster (raster|raster.R raster.G raster.B|<tt>:</tt>group) : The inline value is the raster mapname, three maps to draw as RGB, or a groupname (leader by ':') with tree RGB maps.
; raster (raster|raster.1 raster.2|raster.R raster.G raster.B|<tt>:</tt>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.




''<u>The next commands are optionals</u>'':
''<u>The next commands are optionals</u>'':


; grey yes|no : Draw the rasters in grey scale (small size of file).
; hillshade yes|no : Use when draw a shaded raster to draw hillshade.<br>See http://grass.osgeo.org/wiki/Ps.out_Making_maps#The_second_output


; 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.
; grey yes|no : Store and draw the rasters in grey scale (small size of file).<br>The conversion follows the NTSC video standard.


; 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.
; 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.<br>The background ''raster.2'' is painted in grey scale (NTSC) and tinted with ''maskcolor''.


; outline : Block ''line'' to define ...
; maskcolor (color|none) : Set the ''color'' of the mask area.<br>If a raster map as background is set then it's drawn with a scale white-maskcolor.


; setcolor null|default|(number) (color) : Replace the color of the ''cat'' area with a new color. Multiple ''setcolor'' are possibles.
; outline : Block ''line''. Outline of categories.


; setcolor null|default|(number) (color) : Replace the color of the cat ''number'' area with a new color.<br>Multiple ''setcolor'' are possibles.


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


<gallery caption="Sample gallery" widths="250px" heights="250px" perrow="3">
<gallery caption="Sample gallery" widths="200px" heights="200px" perrow="3">
File:ps_out_raster.png|<div>raster elevation<br />end</div>
File:ps_out_raster1.png|<div>raster elevation<br>end</div>
File:ps_out_raster_gray.png|<div>raster elevation<br/>&nbsp;grey yes<br/>end</div>
File:ps_out_raster2.png|<div>raster elevation elevation_shade<br>end</div>
File:ps_out_raster_lsat.png|<div>raster lsat5.5 lsat5.4 lsat5.3<br/>end</div>
File:ps_out_raster3.png|<div>raster lsat5.5 lsat5.4 lsat5.3<br>end</div>
File:ps_out_raster_mask.png|<div>raster elevation<br/>&nbsp;maskcell census_26 elevation<br/>end</div>
File:ps_out_raster_mask1.png|<div>raster elevation<br>&nbsp;maskcell urban_neg<br>&nbsp;maskcolor indigo<br>end</div>
File:ps_out_raster_mask1.png|<div>raster elevation<br/>&nbsp;maskcell census_26 elevation<br/>&nbsp;maskcolor indigo<br/>end</div>
File:ps_out_raster_mask2.png|<div>raster elevation elevation_shade<br>&nbsp;maskcell urban_neg elevation<br>end</div>
|
File:ps_out_raster_mask3.png|<div>raster lsat5.5 lsat5.4 lsat5.3<br>&nbsp;maskcell urban_neg elevation<br>&nbsp;maskcolor indigo<br>end</div>
File:ps_out_raster_mask0.png|<div>raster zipcodes_wake<br/>&nbsp;maskcell zipcodes_wake<br/>&nbsp;maskcolor 200:200:120<br/>end</div>
File:ps_out_raster_outline.png|<div>raster basin_50K elevation_shade<br>&nbsp;maskcell basin_50K<br>&nbsp;outline<br>&nbsp;&nbsp;width .2mm<br/>&nbsp;end<br/>end</div>
File:ps_out_raster_mask2.png|<div>raster zipcodes_wake<br/>&nbsp;maskcell zipcodes_wake elev_state_500m<br/>&nbsp;outline<br/>&nbsp;&nbsp;width .2mm<br/>&nbsp;end<br/>end</div>
File:ps_out_raster_setcolor.png|<div>raster basin_50K elevation_shade<br>&nbsp;maskcell basin_50K<br>&nbsp;maskcolor white<br>&nbsp;setcolor 37 magenta<br>end</div>
File:ps_out_raster_mask3.png|<div>raster zipcodes_wake<br/>&nbsp;maskcell zipcodes_wake elev_state_500m<br/>&nbsp;outline<br/>&nbsp;&nbsp;width .2mm<br/>&nbsp;&nbsp;color white<br/>&nbsp;end<br/>&nbsp;setcolor 37 black<br/>end</div>
File:ps_out_raster_grey.png|<div>raster elevation<br>&nbsp;grey yes<br>end</div>
</gallery>
</gallery>


== Vector maps ==
== Vector maps ==


All vector map accept optionally the following commands.
All vector map accept optionally the following commands:




Line 327: Line 397:
; masked yes|no : Masked or not by raster mask (default ''no'').
; masked yes|no : Masked or not by raster mask (default ''no'').


; label (text) : For description or title in vlegend.
; label (text) : For description or title in ''vlegend''.
 
; legend [(number)]: Position in legend (-1, no legend) or enter in a block ''legend''.
 


; lpos (number) : Position where vector is plotted in legend and block.


=== vareas ===
=== vareas ===


Draw areas on the map.  
Draw areas on the map.<br>
The areas always are drawn first, on the bottom of other type of maps.
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.
; vareas (vector) : ''vector'' is a vector of areas, except when ''lwidth'' is different to zero that ''vector'' is a vector of lines.


''<u>The next commands are optionals</u>.''


; line : Block ''line'' to set the style of the border line of the areas.
''<u>The next commands are optionals</u>:''
 
; type area|line : Default ''area''.


; lwidth (dimen) : Line map draws as an area with a width = ''lwidth'' (positive or negative).
; line : Block ''line''. Style of the boundary.


; 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).
; fill : Block ''fill''. Style of the area.


; island yes|no : Draw island as normal areas (fill as normal area then hide it).
; 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.


; pat (epsfile) : Pattern in a EPS file.
; setnorule (text) : Text label when default conditions.


; pscale (number) : Scale of pattern.
; setrule (n1-n2[<tt>:</tt>color][|dimen] text) : Make a item of a sublegend with label the ''text'' and title the text of the ''label''.<br>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'').


; pwidth (dimen) : Width of the lines of pattern.
''<u>Special commands</u>:''


; setrule (n1-n2[<tt>:</tt>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''.
; island yes|no : Draw island as normal areas (fill as normal area then hide it).


==== Examples ====
; mirror (dimen [number]) : The line is drawn as an area with a copy of the line placed with polar coordinates: ''dimen' and ''angle''.


{| border="0"
<gallery caption="vareas: sample gallery" widths="200px" heights="200px" perrow="3">
|-
File:ps_out_vareas0.png|fill<br>&nbsp;color indigo
|[[File:ps_out_vareas0.png|150px]]
File:ps_out_vareas4.png|fill<br>&nbsp;color indigo<br>&nbsp;limit 3mm
|<source lang="text">
File:ps_out_vareas3.png|fill<br>&nbsp;pat patterns/diag_up.eps
vareas geology
File:ps_out_vareas1.png|rgbcol - cat<br>setrule 0-500:red A<br/>setrule 500-1000:green B<br/>setrule 1000-5000:blue C
  where GEO_NAME like 'Zb'
File:ps_out_vareas2.png|island no
  fcolor indigo
File:ps_out_vareas5.png|vareas roadsmajor<br>&nbsp;cat 24,28,32,38,53<br>&nbsp;mirror 5 90<br>[and fill with pat cruz.eps]
end
</gallery>
</source>
|[[File:ps_out_vareas3.png|150px]]
|<source lang="text">
vareas geology
  where GEO_NAME like 'Zb'
  pat ../patterns/diag_up.eps
  pscale .5
  fcolor indigo
end
</source>
|-
|[[File:ps_out_vareas1.png|150px]]
|<source lang="text">
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
</source>
|[[File:ps_out_vareas2.png|150px]]
|<source lang="text">
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
</source>
|}


=== vlines ===
=== vlines ===


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


; vlines (vector) :
; vlines (vector) :
Line 413: Line 450:
''vector'' is a vector of lines, except if ''type'' is boundary that ''vector'' is a vector of areas.
''vector'' is a vector of lines, except if ''type'' is boundary that ''vector'' is a vector of areas.


''<u>The next commands are optionals</u>:''


; type boundary|line : Draw boundaries of a vector of areas or lines of a vector of lines (default ''line'').
''<u>Optional commands</u>:''
 
; type line|boundary : Draw boundaries of a vector of areas or lines of a vector of lines (default ''line'').


; line : Block ''line''. Normal 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.
; hline : Block ''line''. Highlight line.


; offset (dimen) : Works with ''hline'' to offset from the center of ''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[<tt>:</tt>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''.
; setrule (n1-n2[<tt>:</tt>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 ====
<gallery caption="vlines: sample gallery" widths="200px" heights="200px" perrow="3">
File:ps_out_vlines0.png|hline
File:ps_out_vlines1.png|line 0.05mm<br>setrule 100:brown|.25mm
</gallery>


{| border="0"
=== vpoints ===
|-
|[[File:ps_out_vlines0.png|150px]]
|<source lang="text">
vlines roadsmajor
  type line
  line
    width 1mm
    color yellow
  end
  hline
    width 1mm
    color red
  end
end
</source>
|}


=== vpoints ===
Draw points on the map.<br>The points always are drawn last, after ''vareas'' and ''vlines''.


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


; vpoints (vector) :
; 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.
''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.


''<u>The next commands are optionals</u>'':
''<u>The next commands are optionals</u>'':
Line 459: Line 486:
; type centroid|line|boundary|point : Type of draw (default ''point'').
; type centroid|line|boundary|point : Type of draw (default ''point'').


; symbol (epsfile) : Symbol to use.
; symbol (epsfile) : Symbol to use (default: basic/circle).


; line : Block ''line''. Type of line in the symbol.
; line : Block ''line''. Type of line in the symbol.
Line 465: Line 492:
; fcolor (color): Static fillcolor of 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.  
; 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''.
; 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.
; setsize (n1-n2[<tt>:</tt>size] text) : Variable size of symbols from data in ''column'' of database set in ''size''.
 
; rotate (number|column) : Angle to rotate the symbol, static ''number'' or dynamic in a ''column'' of the database.


; setrule (n1-n2[<tt>:</tt>size] text) : Variable size of symbols from data in ''column'' of database set in ''size''.
''<u>Special commands when type is line</u>'':


; dist (dimen) : Define the distance between symbol over the line (only when ''type'' is ''line'').
; dist (dimen) : Define the distance in paper between symbol over the line.


; cline : Block ''line''. Type of line that connect symbols (only when ''type'' is ''line'').
; cline : Block ''line''. Type of line that connect symbols.




==== Examples ====
<gallery caption="vpoints: sample gallery" widths="150px" heights="150px" perrow="4">
File:ps_out_vpoints0.png|''Points with same size ...''<br>&nbsp;size 5
File:ps_out_vpoints1.png|''Points with dynamic size ...''<br>&nbsp;size PT 5<br>&nbsp;scale 0.01 2
File:ps_out_vpoints2.png|''Points with conditional size ...''<br>&nbsp;size PT<br>&nbsp;setrule 200-1000:3 < 1000<br>&nbsp;setrule 1000-2500:9 > 1000
File:ps_out_vpoints3.png|''Points on line ...''<br>&nbsp;type line<br>&nbsp;dist 1cm
</gallery>


=== vlabels ===
=== vlabels ===


<u>in progress</u>
<u>in progress</u>


; vlabels none|(vector) :
; vlabels none|(vector) :


; font :
; font :
Line 497: Line 533:


; setrule (n1-n2 text)
; setrule (n1-n2 text)
<gallery caption="Sample gallery" widths="200px" heights="200px" perrow="3">
File:ps_out_vlabels0.png|vpoints firestations<br/n>&nbsp;[...]<br/n>end<br/>vlabels firestations<br/n>&nbsp;labelcol PUMPERS<br/n>&nbsp;font<br/n>&nbsp;&nbsp;name Univers-Bold<br/n>&nbsp;&nbsp;size 10<br/n>&nbsp;&nbsp;color yellow<br/n>&nbsp;end<br/n>end
</gallery>


== Legend of the maps ==
== Legend of the maps ==
Line 502: Line 543:
=== rlegend ===
=== 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'.
Legend of the raster map.<br>The units ''meters'' in the gradient legend is set with {{cmd|r.support}}.
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.  
; rlegend [text] : Text is the title of the legend.  


; raster (raster) : the ''raster'' map to take the data of legend.
; raster (raster) : the ''raster'' map to take the data of legend.


''<u>The next commads are optionals</U>'':
''<u>The next commads are optionals</U>'':
Line 522: Line 564:


; cols (number) [(number)] : Number of columns with symbols and separation between columns (default ''1'').
; 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''.
; nodata yes|no : Remove category ''no data''.


; order (n1,n2,...) : To reorder items.
; order (n1,n2,...) : To reorder the items.


''<u>For gradient legends</u>''
''<u>For gradient legends</u>''
Line 541: Line 585:
; whiteframe (dimen) : Width of the white frame around the bar color.
; whiteframe (dimen) : Width of the white frame around the bar color.


==== Examples ====
<gallery caption="Sample gallery" widths="250px" heights="250px" perrow="3">
File:ps_out_rlegend.png|rlegend Zip Codes (wake)<br/>&nbsp;raster zipcodes_wake<br/>&nbsp;cols 2 0<br/>&nbsp;swidth 8mm<br/>&nbsp;order 20,10,30,22,34<br/>end
File:ps_out_rlegend1.png|rlegend<br/>&nbsp;raster elevation<br/>&nbsp;height 8cm<br/>end
File:ps_out_rlegend2.png|rlegend<br/>&nbsp;raster elevation<br/>&nbsp;width 8cm<br/>&nbsp;vertical no<br/>end
</gallery>
 
=== vlegend ===
 
Legend of the vector maps.
 
 
; vlegend [text] : Optional the title or head of the legend.
 
 
''<u>The next commands are optionals</u>'':
 
; title : Block ''font'' for title of legend.
 
; font : Block font for normal text of legend.
 
; frame :
 
; 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.


{| border="0"
|-
|[[File:ps_out_rlegend.png|150px]]
|<source lang="text">
rlegend Zip Codes (wake)
  raster zipcodes_wake
  cols 2 0
  swidth 8mm
  order 20,10,30,22,34
end
</source>
|[[File:ps_out_rlegend1.png|55px]]
|<source lang="text">
rlegend
  raster elevation
  height 8cm
end
</source>
|[[File:ps_out_rlegend2.png|200px]]
|<source lang="text">
rlegend
  raster elevation
  width 8cm
  vertical no
end
</source>
|}


=== vlegend ===
<gallery caption="vlegend: sample gallery" widths="250px" heights="150px" perrow="3">
File:ps_output_vlegend0.png
</gallery>


; vlegend [text] :
== Conversion to PDF ==


; title :  
You can obtain good results with these settings:
  ps2pdf14 -dPDFSETTINGS=/prepress -dEmbedAllFonts=true map.ps map.pdf


; font :
== Example for ps.output control script ==


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


; cols (number.1 [number.2]) :
<source lang="text">
paper A4
landscape y
end
maparea
height 12cm
border .8mm
color grey
end


; swidth (dimen) :
grid
major 100000
  width .1mm
  color white
end
minor 50000
  width .1mm
  color white
  style 1
end
font
  name Univers
  size 6
  extend 1.2
  color black
end
fcolor black
format +out
trim 3
end


; interline (dimen) :
raster ortho.r ortho.g ortho.b
end
</source>


[[Category: ps.map]]
[[Category: ps.map]]
[[Category:Printing]]

Latest revision as of 20:49, 2 August 2013

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

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.
outline yes|no
Outline of the 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
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.

fill

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.

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

legend

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

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

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.

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 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.
draw
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.

palette

testing


palette


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.


grid|geogrid


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.
font
Block font.
fcolor (color)
Color of the border.
cross (number)
Replace lines by cross


scalebar

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.
frame
Block frame
font
Block font
fcolor (color)
Fillcolor.
height (dimen)
Height of the bar or ticks.
zero yes|no
Set position relative to zero value of the scalebar.


note

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;
frame
Block frame.
font
Block font.
width (dimen)
Width of note.
angle (number)
number of degrees to rotate (do not work fine).


draw

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

raster

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.
See http://grass.osgeo.org/wiki/Ps.out_Making_maps#The_second_output
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.
outline
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.


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:

type area|line
Default area.
line
Block line. Style of the boundary.
fill
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.

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.


Optional commands:

type line|boundary
Draw boundaries of a vector of areas or lines of a vector of lines (default line).
line
Block line. Normal line.
hline
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.

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 (default: basic/circle).
line
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.
cline
Block line. Type of line that connect symbols.


vlabels

in progress


vlabels none|(vector)


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


Legend of the maps

rlegend

Legend of the raster map.
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).
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.

vlegend

Legend of the vector maps.


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


The next commands are optionals:

title
Block font for title of legend.
font
Block font for normal text of legend.
frame
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.ps map.pdf

Example for ps.output control script

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

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

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

raster ortho.r ortho.g ortho.b
end