Ps.output: Difference between revisions

From GRASS-Wiki
Jump to navigation Jump to search
 
(73 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 ==
Line 6: Line 7:
'''-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 caption="Sample gallery" widths="100px" heights="100px" perrow="3">
<gallery caption="Sample gallery" widths="100px" heights="100px" perrow="3">
Line 66: 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 74: 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 97: 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 102: Line 142:
=== paper ===
=== paper ===


Base size of paper.  
Size of paper.  




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




Line 119: 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 ===
Line 137: Line 179:




; border (dimen) : Width of the border map.<br>Usefull with ''in'' and ''out'' formats, ignored 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 146: 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 ===
Line 154: Line 198:
; palette
; palette


; light (color text) :
; dark (color text) :


; wheel (number text) :
; wheel (number text) :
Line 163: 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) :


; 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) :
; diverging (color.1 color.2 number text) :
Line 173: 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




Line 214: Line 264:




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




; length (dimen) : Length of the scale.
; 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.
; units meters|m|kilometers|km|feet|ft|miles|mil|nautical_miles|nm ([text]) : Unit of the length and ''text' to label the units.
Line 242: Line 292:
File:ps_out_scalebar_f.png|scalebar f
File:ps_out_scalebar_f.png|scalebar f
File:ps_out_scalebar_F.png|scalebar 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>
Line 253: Line 304:
; 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.
; 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 274: Line 327:
=== draw ===
=== draw ===


Draw predefined postscript code.
Simple script language to draw predefined postscript code.




; draw [paper|free] :  ''paper'': run before any map feature is drawn (equivalent to place inside ''paper'' block); and ''free'': run after all map features are drawn then it's draw over map but not clipped.
; 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''.




Line 297: Line 354:




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


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


; outline : Block ''line'' to define ...
; 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.


; 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="200px" heights="200px" 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<br/>&nbsp;maskcell zipcodes<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<br/>&nbsp;maskcell zipcodes elev_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<br/>&nbsp;maskcell zipcodes elev_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>


Line 342: Line 399:
; label (text) : For description or title in ''vlegend''.
; label (text) : For description or title in ''vlegend''.


; lpos (number) : Position where vector is plotted in legend and block.
; legend [(number)]: Position in legend (-1, no legend) or enter in a block ''legend''.
 




Line 354: Line 412:




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


; line : Block ''line'' to set the style of the border line of the areas.
; 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).


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


<gallery caption="Sample gallery" widths="250px" heights="250px" perrow="2">
<gallery caption="vareas: sample gallery" widths="200px" heights="200px" perrow="3">
File:ps_out_vareas0.png|<div>vareas geology<br/>&nbsp;where GEO_NAME like 'Zb'<br/>&nbsp;fcolor indigo<br/>end</div>
File:ps_out_vareas0.png|fill<br>&nbsp;color indigo
File:ps_out_vareas3.png|<div>vareas geology<br/>&nbsp;where GEO_NAME like 'Zb'<br/>&nbsp;pat ../patterns/diag_up.eps<br/>&nbsp;pscale .5<br/>&nbsp;fcolor indigo<br/>end</div>
File:ps_out_vareas4.png|fill<br>&nbsp;color indigo<br>&nbsp;limit 3mm
File:ps_out_vareas1.png|<div>vareas geology<br/>&nbsp;where GEO_NAME like 'Zb'<br/>&nbsp;pat ../patterns/diag_up.eps<br/>&nbsp;pscale .5<br/>&nbsp;fcolor - cat<br/>&nbsp;setrule 0-500:red 0 <= cat < 500<br/>&nbsp;setrule 500-1000:green 500 <= cat < 1000<br/>&nbsp;setrule 1000-5000:blue 1000 <= cat < 5000<br/>end</div>
File:ps_out_vareas3.png|fill<br>&nbsp;pat patterns/diag_up.eps
File:ps_out_vareas2.png|vareas geology<br/>&nbsp;where GEO_NAME like 'Zb'<br/>&nbsp;pat ../patterns/diag_up.eps<br/>&nbsp;pscale .5<br/>&nbsp;island no<br/>&nbsp;fcolor - cat<br/>&nbsp;setrule 0-500:red low cat<br/>&nbsp;setrule 500-1000:green middle cat<br/>&nbsp;setrule 1000-5000:blue high cat<br/>end</div>
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
File:ps_out_vareas2.png|island no
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]
</gallery>
</gallery>


=== vlines ===
=== vlines ===
Line 391: Line 451:




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


; type boundary|line : Draw boundaries of a vector of areas or lines of a vector of lines (default ''line'').
; 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''.


 
<gallery caption="vlines: sample gallery" widths="200px" heights="200px" perrow="3">
<gallery caption="Sample gallery" widths="250px" heights="250px" perrow="3">
File:ps_out_vlines0.png|hline
File:ps_out_vlines0.png|vlines roadsmajor<br/>&nbsp;type line<br/>&nbsp;line<br/>&nbsp;&nbsp;width 1mm<br/>&nbsp;&nbsp;color yellow<br/>&nbsp;end<br/>&nbsp;hline<br/>&nbsp;&nbsp;width 1mm<br/>&nbsp;&nbsp;color red<br/>&nbsp;end<br/>end
File:ps_out_vlines1.png|line 0.05mm<br>setrule 100:brown|.25mm
</gallery>
</gallery>


Line 430: 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.




<gallery caption="Sample gallery" widths="200px" heights="200px" perrow="3">
<gallery caption="vpoints: sample gallery" widths="150px" heights="150px" perrow="4">
File:ps_out_vpoints0.png|vpoints firestations<br/>&nbsp;fcolor red$.3<br/>&nbsp;line<br/>&nbsp;&nbsp;width .4mm<br/>&nbsp;&nbsp;color yellow<br/>&nbsp;end<br/>&nbsp;size 15<br/>end
File:ps_out_vpoints0.png|''Points with same size ...''<br>&nbsp;size 5
File:ps_out_vpoints1.png|vpoints firestations<br/>&nbsp;fcolor red$.3<br/>&nbsp;line<br/>&nbsp;&nbsp;width .4mm<br/>&nbsp;&nbsp;color yellow<br/>&nbsp;end<br/>&nbsp;size PUMPERS<br/>&nbsp;scale 8 4<br/>end
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|vpoints firestations<br/>&nbsp;fcolor red$.3<br/>&nbsp;line<br/>&nbsp;&nbsp;width .4mm<br/>&nbsp;&nbsp;color yellow<br/>&nbsp;end<br/>&nbsp;size PUMPERS<br/>&nbsp;setrule 0-2:10 bad pumpers<br/>&nbsp;setrule 2-5:30 ok pumpers<br/>end
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|vpoints roadsmajor<br/>&nbsp;symbol basic/arrow1<br/>&nbsp;size 10<br/>&nbsp;rotate 90<br/>&nbsp;fcolor red<br/>&nbsp;type line<br/>&nbsp;dist 1cm<br/>&nbsp;cline<br/>&nbsp;&nbsp;width .3mm<br/>&nbsp;&nbsp;color indigo<br/>&nbsp;end<br/>end
File:ps_out_vpoints3.png|''Points on line ...''<br>&nbsp;type line<br>&nbsp;dist 1cm
</gallery>
</gallery>


Line 469: 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 474: 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]].




Line 496: 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 523: Line 593:
=== vlegend ===
=== vlegend ===


; vlegend [text] :
Legend of the vector maps.


; title :


; font :
; 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.
 
 
<gallery caption="vlegend: sample gallery" widths="250px" heights="150px" perrow="3">
File:ps_output_vlegend0.png
</gallery>
 
== 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 ==


; 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