AreaFillPatterns: Difference between revisions

From GRASS-Wiki
Jump to navigation Jump to search
 
(24 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[http://grass.ibiblio.org/grass61/manuals/html61_user/ps.map.html#vareas ps.map's vector area filling command] will let you set a fill pattern ([http://en.wikipedia.org/wiki/Hatching hatching]). You can create custom patterns. User contributed patterns can be found on this page.
[http://grass.osgeo.org/grass64/manuals/html64_user/ps.map.html#vareas ps.map's vector area filling command] will let you set a fill pattern ([http://en.wikipedia.org/wiki/Hatching hatching]). You can create custom patterns. User contributed patterns can be found on this page.


''Alternative'':
''Alternative'':
Line 14: Line 14:
=== Authoring instructions ===
=== Authoring instructions ===


Use ps.map's vareas instruction '''pat''' command - full path to pattern file. Pattern file contains header and simple PS commands. It is similar to EPS but more limited, that means that each pattern file is EPS file but EPS files are not usually usefull as pattern files because contain restricted commands. Color and width of patterns is set by acolor and pwidth until it is overwritten in pattern file. Currently the only way to create pattern file is text editor.
Use the ps.map ''vareas'' command's '''pat''' instruction with the full path to pattern file. The pattern file contains header and simple PS commands. It is similar to EPS but more limited, meaning that while each pattern file is a true EPS file, most EPS files are not usually useful as pattern files because they contain restricted commands. Color and width of patterns are set by '''fcolor''' and '''width''' instructions until overwritten in the pattern file. The pattern may be scaled with the '''scale''' instruction. Several standard hatching patterns are provided in <TT>$GISBASE/etc/paint/patterns/</TT>. You can also create your own custom pattern files in a text editor.


=== Example Pattern files ===
=== Example use ===


==== Vertical line ====
* [[Psmap_fill_patterns|Example ps.map script]] showing all standard fill patterns. Uses the [http://grass.osgeo.org/download/data6.php Spearfish sample dataset].
('''|''')
%!PS-Adobe-2.0 EPSF-1.2
%%BoundingBox: 0 0 10 10
newpath
5 0 moveto
5 10 lineto
stroke


''[insert demonstrative image here]''
vareas fields
  pat $GISBASE/etc/paint/patterns/brick.eps
  where label ~ 'Natl. Forest'
  fcolor green
  end


=== Example Pattern files ===


==== Vertical line (70% spacing) ====
* Standard pattern files can be found in <tt>$GISBASE/etc/paint/patterns/</tt> or from the [http://trac.osgeo.org/grass/browser/grass/branches/develbranch_6/ps/ps.map/patterns/ SVN web interface]. There are now a few more patterns than are shown here (zigzag and railroad), and the broken lines in these sample images (eg diag_down) have been fixed.
('''|''')
%!PS-Adobe-2.0 EPSF-1.2
%%BoundingBox: 0 0 10 10
newpath
5 0 moveto
5 7 lineto
stroke


''[insert demonstrative image here]''
<ul><ul>
[[Image:Fillpatterns.png]]
</ul></ul>
''[http://bambi.otago.ac.nz/hamish/grass/fillpatterns.ps PostScript version of this image]'' (created with {{cmd|ps.map}} and {{cmd|v.mkgrid}})


Not shown: (''new'')
* horiz_zigzag.eps
* vert_zigzag.eps
* railroad_down.eps
* railroad_up.eps


==== Horizontal line ====
==== Vertical line ====
('''-''')
%!PS-Adobe-2.0 EPSF-1.2
%%BoundingBox: 0 0 10 10
newpath
0 5 moveto
10 5 lineto
stroke


''[insert demonstrative image here]''
As an example, here is the entire contents of the drawing rules file for the vertical line pattern ('''|'''):


==== Horizontal line (70% spacing) ====
('''-''')
%!PS-Adobe-2.0 EPSF-1.2
%%BoundingBox: 0 0 10 10
newpath
0 5 moveto
7 5 lineto
stroke
''[insert demonstrative image here]''
==== Horizontal/vertical cross-hatch ====
('''+''')
  %!PS-Adobe-2.0 EPSF-1.2
  %!PS-Adobe-2.0 EPSF-1.2
  %%BoundingBox: 0 0 10 10
  %%BoundingBox: 0 0 10 10
Line 73: Line 50:
  5 0 moveto
  5 0 moveto
  5 10 lineto
  5 10 lineto
stroke
0 5 moveto
10 5 lineto
  stroke
  stroke


''[insert demonstrative image here]''
within a 10x10 bounding box it simply moves the pen to x=5,y=0 and draws a line to x=5,y=10. This pattern is then tiled over and over again within the fill area.


=== User contributions ===


==== Horizontal/vertical cross-hatch (70% spacing) ====
<!-- add yours here -->
('''+''')
-
%!PS-Adobe-2.0 EPSF-1.2
%%BoundingBox: 0 0 10 10
newpath
5 0 moveto
5 7 lineto
stroke
0 5 moveto
7 5 lineto
stroke
 
''[insert demonstrative image here]''
 
 
==== Diagonal line (bottom left to upper right) ====
('''/''')
%!PS-Adobe-2.0 EPSF-1.2
%%BoundingBox: 0 0 10 10
newpath
0 0 moveto
10 10 lineto
stroke


''[insert demonstrative image here]''
<!-- ''[insert demonstrative image here]'' -->


==== Diagonal line (bottom left to upper right) (70% spacing) ====
('''/''')
%!PS-Adobe-2.0 EPSF-1.2
%%BoundingBox: 0 0 10 10
newpath
0 0 moveto
7 7 lineto
stroke


''[insert demonstrative image here]''
[[Category: ps.map]]
 
 
==== Diagonal line (upper left to bottom right) ====
('''\''')
%!PS-Adobe-2.0 EPSF-1.2
%%BoundingBox: 0 0 10 10
newpath
0 10 moveto
10 0 lineto
stroke
 
''[insert demonstrative image here]''
 
 
==== Diagonal line (upper left to bottom right) (70% spacing) ====
('''\''')
%!PS-Adobe-2.0 EPSF-1.2
%%BoundingBox: 0 0 10 10
newpath
0 7 moveto
7 0 lineto
stroke
 
''[insert demonstrative image here]''
 
 
==== Diagonal cross-hatch ====
('''X''')
%!PS-Adobe-2.0 EPSF-1.2
%%BoundingBox: 0 0 10 10
newpath
0 10 moveto
10 0 lineto
stroke
0 0 moveto
10 10 lineto
stroke
 
''[insert demonstrative image here]''
 
==== Diagonal cross-hatch (70% spacing) ====
('''X''')
%!PS-Adobe-2.0 EPSF-1.2
%%BoundingBox: 0 0 10 10
newpath
0 7 moveto
7 0 lineto
stroke
0 0 moveto
7 7 lineto
stroke
 
''[insert demonstrative image here]''
 
=== User contributions ===
 
<!-- add yours here -->
-

Latest revision as of 13:38, 10 June 2009

ps.map's vector area filling command will let you set a fill pattern (hatching). You can create custom patterns. User contributed patterns can be found on this page.

Alternative: QGIS will let you load a GRASS map (with the GDAL GRASS-plugin installed) and change the area fill pattern on-screen.


Contributions

Please include a small example graphic. Upload instructions.

Also please include your name and some sort of license information.
e.g. "© 2006 Sara Grassuser, released into the public domain without restriction." This way others may freely improve and further distribute your work (e.g. it can be distributed with the next official GRASS release).

Authoring instructions

Use the ps.map vareas command's pat instruction with the full path to pattern file. The pattern file contains header and simple PS commands. It is similar to EPS but more limited, meaning that while each pattern file is a true EPS file, most EPS files are not usually useful as pattern files because they contain restricted commands. Color and width of patterns are set by fcolor and width instructions until overwritten in the pattern file. The pattern may be scaled with the scale instruction. Several standard hatching patterns are provided in $GISBASE/etc/paint/patterns/. You can also create your own custom pattern files in a text editor.

Example use

vareas fields
  pat $GISBASE/etc/paint/patterns/brick.eps
  where label ~ 'Natl. Forest'
  fcolor green
  end

Example Pattern files

  • Standard pattern files can be found in $GISBASE/etc/paint/patterns/ or from the SVN web interface. There are now a few more patterns than are shown here (zigzag and railroad), and the broken lines in these sample images (eg diag_down) have been fixed.

PostScript version of this image (created with ps.map and v.mkgrid)

Not shown: (new)

  • horiz_zigzag.eps
  • vert_zigzag.eps
  • railroad_down.eps
  • railroad_up.eps

Vertical line

As an example, here is the entire contents of the drawing rules file for the vertical line pattern (|):

%!PS-Adobe-2.0 EPSF-1.2
%%BoundingBox: 0 0 10 10
newpath
5 0 moveto
5 10 lineto
stroke

within a 10x10 bounding box it simply moves the pen to x=5,y=0 and draws a line to x=5,y=10. This pattern is then tiled over and over again within the fill area.

User contributions

-