<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://grasswiki.osgeo.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=%E2%9A%A0%EF%B8%8FLarah</id>
	<title>GRASS-Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://grasswiki.osgeo.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=%E2%9A%A0%EF%B8%8FLarah"/>
	<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/wiki/Special:Contributions/%E2%9A%A0%EF%B8%8FLarah"/>
	<updated>2026-05-25T19:58:30Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://grasswiki.osgeo.org/w/index.php?title=Ps.map_graph_paper&amp;diff=11869</id>
		<title>Ps.map graph paper</title>
		<link rel="alternate" type="text/html" href="https://grasswiki.osgeo.org/w/index.php?title=Ps.map_graph_paper&amp;diff=11869"/>
		<updated>2010-10-14T09:24:06Z</updated>

		<summary type="html">&lt;p&gt;⚠️Larah: /* See also */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Creating graph paper with ps.map ==&lt;br /&gt;
&lt;br /&gt;
The {{cmd|ps.map}} module is quite flexible. This example will demonstrate how to use it to create your own graph paper (free!) and save it into a PostScript or PDF file ready for printing whenever you need it. With some slight tweaks you can make A3, Legal-sized, etc. paper with the grid resolution of your choosing.&lt;br /&gt;
&lt;br /&gt;
This is not the most efficient method, but it's just a demonstration after all. If it were more efficient I'd include the PDFs on this page for you to download directly, but it's easy enough to cut and paste the examples below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Background ===&lt;br /&gt;
&lt;br /&gt;
Some useful numbers and facts to know before we start:&lt;br /&gt;
&lt;br /&gt;
* PostScript's (and thus PDF's) natural unit is the ''point''. As in a &amp;quot;''10 point''&amp;quot; font size. A point is 1/72 of an inch, and so a 72 point font is 1&amp;quot; tall when printed. So for PostScript tasks it is both common and easiest to work directly with inches.&lt;br /&gt;
&lt;br /&gt;
* A sheet of A4 paper is 8.268&amp;quot; x 11.693&amp;quot;. A sheet of Letter sized paper is 8.5&amp;quot; x 11&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* 25.4 mm = 1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* The aspect ratio of metric paper sizes is: &amp;lt;tt&amp;gt;length = width * sqrt(2)&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Creating graph paper with a 1/4 inch grid ===&lt;br /&gt;
&lt;br /&gt;
First create a new location using inches as the base unit.&lt;br /&gt;
&lt;br /&gt;
Assuming you used the text-based interactive startup wizard:&lt;br /&gt;
* Create a new location&lt;br /&gt;
* [D] - Other projection&lt;br /&gt;
* Projection: eqc  (Plate Caree)&lt;br /&gt;
* No datum&lt;br /&gt;
* Ellipsoid: sphere&lt;br /&gt;
* Radius of Earth: just use the default&lt;br /&gt;
* Latitude, Longitude of center.. just set to 0.0&lt;br /&gt;
* Enter plural form of units [meters]: inches&lt;br /&gt;
* Enter conversion factor from inches to meters: 0.0254&lt;br /&gt;
&lt;br /&gt;
* set region: &lt;br /&gt;
: Here we will want to calculate the size of the grid canvas. It will be a little smaller than the paper size. So given the above dimensions for Letter-sized paper with 1/2&amp;quot; margins on the sizes and 1&amp;quot; on the top and the bottom, the grid canvas will be 7.5&amp;quot; x 9&amp;quot;. So set north=9, south=0, west=0, and east=7.5. Set the resolution to 0.25. The exact default region is not important, it's just to get us started.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
(round down to nearest whole grid)&lt;br /&gt;
g.region  n=9 s=0 w=0 e=7.25 res=0.25&lt;br /&gt;
&lt;br /&gt;
 a4 - 1/2&amp;quot; margins = 7.268 x 10.693&amp;quot; = 184.6 x 271.6022mm&lt;br /&gt;
 a4 - margins = 7.268 x &lt;br /&gt;
   1/4&amp;quot; boxes: 7.268/.25 = 29.072 x 42.772 boxes&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next start up GRASS in a new mapset in this new location.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
While the {{cmd|d.grid}} command can be used multiple times at different grid distances, unfortunately ''ps.map'''s '''grid''' instuction can only be used once. You can use {{cmd|v.mkgrid}} to make a grid pattern though, so first we'll use that to make copies of two grid sizes.&lt;br /&gt;
&lt;br /&gt;
 v.mkgrid inch_grid grid=9,7 position=coor coor=0,0 box=1,1&lt;br /&gt;
 &lt;br /&gt;
 g.region -p # check that res=0.25; read rows,cols for grid option&lt;br /&gt;
 v.mkgrid quarter_inch_grid grid=36,30&lt;br /&gt;
&lt;br /&gt;
This will let us draw a 1&amp;quot; black grid over the top of a 1/4&amp;quot; grey grid for a nice effect.&lt;br /&gt;
&lt;br /&gt;
If you were just displaying to the screen you could have done:&lt;br /&gt;
 d.grid 0.25 -b -t color=220:220:220&lt;br /&gt;
 d.grid 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== On A4 paper ====&lt;br /&gt;
&lt;br /&gt;
For A4 paper we'll use a 1/2&amp;quot; margin on the left and right, a 1&amp;quot; margin on the top, and a bit of a bigger margin on the bottom to leave room for a ruler.&lt;br /&gt;
&lt;br /&gt;
So we are left with &amp;lt;tt&amp;gt;8.268&amp;quot; - (2 * 0.5&amp;quot;) = 7.268&amp;quot;&amp;lt;/tt&amp;gt; wide and &amp;lt;tt&amp;gt;11.693&amp;quot; - 1&amp;quot; - 1.5&amp;quot; = 9.193&amp;quot;&amp;lt;/tt&amp;gt; tall. To maintain whole grid boxes we'll round this down to 7.25&amp;quot; x 9&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
 g.region  n=9 s=0 w=0 e=7.25 res=0.25&lt;br /&gt;
&lt;br /&gt;
And save it as a named region for future reference.&lt;br /&gt;
 g.region save=a4&lt;br /&gt;
&lt;br /&gt;
With all that set up we can run ''ps.map''. The map scale is 1:1, we use the vector grid we made with ''v.mkgrid'' to render the finer mesh, and the '''grid''' instruction to render the darker 1&amp;quot; overlay grid. Finally we'll place a 5&amp;quot; ruler at the bottom of the page with the '''scalebar''' instruction.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ps.map out=quarter_inch_a4.ps &amp;lt;&amp;lt; EOF&lt;br /&gt;
&lt;br /&gt;
paper a4&lt;br /&gt;
  left 0.5&lt;br /&gt;
  right 0.5&lt;br /&gt;
  top 1.0&lt;br /&gt;
  bottom 1.5&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
scale 1:1&lt;br /&gt;
&lt;br /&gt;
vareas quarter_inch_grid&lt;br /&gt;
  fcolor none&lt;br /&gt;
  color grey&lt;br /&gt;
  width 0.5&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
grid 1&lt;br /&gt;
  color black&lt;br /&gt;
  width 0.5&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
scalebar s&lt;br /&gt;
  where 4.134 10.75&lt;br /&gt;
# (4.134 is width a4 / 2, so the center of the page)&lt;br /&gt;
  length 5&lt;br /&gt;
  segment 20&lt;br /&gt;
  numbers 4&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can convert PostScript to PDF with the `ps2pdf` program that comes with {{wikipedia|Ghostscript}}:&lt;br /&gt;
 ps2pdf quarter_inch_a4.ps&lt;br /&gt;
&lt;br /&gt;
==== On Letter paper ====&lt;br /&gt;
&lt;br /&gt;
This is mostly the same, we just modify the margins a bit and the region to match. This time the margin math is a bit simpler.&lt;br /&gt;
&lt;br /&gt;
 11&amp;quot; tall - margins = 9&amp;quot; grid canvas height&lt;br /&gt;
 &lt;br /&gt;
 8.5&amp;quot; wide - 1/2&amp;quot; margins = 7.5&amp;quot; grid canvas width&lt;br /&gt;
&lt;br /&gt;
So we (re)set the region to these numbers: (just 1/4&amp;quot; wider than the A4 one)&lt;br /&gt;
 g.region n=9 e=7.5&lt;br /&gt;
&lt;br /&gt;
And save it for future reference:&lt;br /&gt;
 g.region save=letter&lt;br /&gt;
&lt;br /&gt;
And again we run ''ps.map'' with a similar set of commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ps.map out=quarter_inch_letter.ps &amp;lt;&amp;lt; EOF&lt;br /&gt;
&lt;br /&gt;
paper us-letter&lt;br /&gt;
  left 0.5&lt;br /&gt;
  right 0.5&lt;br /&gt;
  top 0.75&lt;br /&gt;
  bottom 1.25&lt;br /&gt;
  end&lt;br /&gt;
scale 1:1&lt;br /&gt;
vareas quarter_inch_grid&lt;br /&gt;
  fcolor none&lt;br /&gt;
  color grey&lt;br /&gt;
  width 0.5&lt;br /&gt;
  end&lt;br /&gt;
grid 1&lt;br /&gt;
  color black&lt;br /&gt;
  width 0.5&lt;br /&gt;
  end&lt;br /&gt;
scalebar s&lt;br /&gt;
  where 4.25 10.35&lt;br /&gt;
# 4.25 = width letter / 2&lt;br /&gt;
  length 5&lt;br /&gt;
  segment 20&lt;br /&gt;
  numbers 4&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And convert the PostScript output to a PDF:&lt;br /&gt;
 ps2pdf quarter_inch_letter.ps&lt;br /&gt;
&lt;br /&gt;
=== Creating graph paper with a 1 mm grid ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To create graph paper with a 1 mm grid (and 1 cm dark-line overlay) create another custom location, but this time use millimeters as the unit.&lt;br /&gt;
&lt;br /&gt;
 Enter plural form of units [meters]: millimeters&lt;br /&gt;
 Enter conversion factor from millimeters to meters: 0.001&lt;br /&gt;
&lt;br /&gt;
This time we set the default region to canvas size in mm. The canvas size for our 1/4&amp;quot; grid was just about right so we'll reuse that: &amp;lt;tt&amp;gt;9&amp;quot; * 25.4 = 228.6mm&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;7.5 * 25.4 = 190.5mm&amp;lt;/tt&amp;gt;. Rounding to the nearest cm that's 230mm x 190mm. So the region is:&lt;br /&gt;
&lt;br /&gt;
 n=230  s=0  w=0  e=190  res=1&lt;br /&gt;
&lt;br /&gt;
Once in the region we make our vector grids, first the 1cm x 1cm grid:&lt;br /&gt;
&lt;br /&gt;
 v.mkgrid cm_grid grid=23,19 position=coor coor=0,0 box=10,10&lt;br /&gt;
&lt;br /&gt;
Then the 1mm grid:&lt;br /&gt;
 g.region -p # read rows,cols&lt;br /&gt;
 # that adds up to a lot of boxes, so we consolidate it internally&lt;br /&gt;
 v.mkgrid mm_grid_raw grid=230,190&lt;br /&gt;
 v.build.polylines in=mm_grid_raw out=mm_grid&lt;br /&gt;
 g.remove vect=mm_grid_raw&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== On A4 paper ====&lt;br /&gt;
&lt;br /&gt;
A4 paper is a little narrower, so we chop off a 1cm column:&lt;br /&gt;
&lt;br /&gt;
 g.region n=230 e=180 s=0 w=0 res=1&lt;br /&gt;
&lt;br /&gt;
And save it in case we want to go back to it later,&lt;br /&gt;
 g.region save=a4&lt;br /&gt;
&lt;br /&gt;
This time we have to do a little math to calculate how big the margins should be to keep the grid canvas centered on the page:&lt;br /&gt;
  width of grid: 180 mm / 25.4 = 7.087&amp;quot;&lt;br /&gt;
  ( width a4 - width grid ) / 2 = 0.59&amp;quot; margins&lt;br /&gt;
&lt;br /&gt;
The rest is the same as before- draw the fine grid then the darker 10mm grid over the top of it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ps.map out=mm_a4.ps &amp;lt;&amp;lt; EOF&lt;br /&gt;
&lt;br /&gt;
paper a4&lt;br /&gt;
  left 0.59&lt;br /&gt;
  right 0.59&lt;br /&gt;
  top 1.0&lt;br /&gt;
  bottom 1.5&lt;br /&gt;
  end&lt;br /&gt;
scale 1:1&lt;br /&gt;
vareas mm_grid&lt;br /&gt;
  fcolor none&lt;br /&gt;
  color 180:180:180&lt;br /&gt;
  width 0.5&lt;br /&gt;
  end&lt;br /&gt;
grid 10&lt;br /&gt;
  color black&lt;br /&gt;
  width 0.5&lt;br /&gt;
  end&lt;br /&gt;
scalebar s&lt;br /&gt;
  where 4.134 10.75&lt;br /&gt;
# 4.134 = width a4 / 2&lt;br /&gt;
  length 100&lt;br /&gt;
  segment 10&lt;br /&gt;
  numbers 2&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Convert PostScript to PDF:&lt;br /&gt;
 ps2pdf mm_a4.ps&lt;br /&gt;
&lt;br /&gt;
If you want to keep the PostScript file you might use `ps2ps` to shrink it. The 1mm fine vector mesh map can make the file pretty huge. Simply zipping it helps too.&lt;br /&gt;
&lt;br /&gt;
==== On Letter paper ====&lt;br /&gt;
&lt;br /&gt;
We set the region size back a little bit wider:&lt;br /&gt;
 g.region n=230 e=190 s=0 w=0 res=1&lt;br /&gt;
&lt;br /&gt;
And recalculate the margin size:&lt;br /&gt;
  width grid: 190 mm / 25.4 = 7.48&amp;quot;&lt;br /&gt;
  ( width letter - width grid ) / 2 = 0.51&amp;quot; margins&lt;br /&gt;
&lt;br /&gt;
And run ps.map:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ps.map out=mm_letter.ps &amp;lt;&amp;lt; EOF&lt;br /&gt;
&lt;br /&gt;
paper us-letter&lt;br /&gt;
  left 0.51&lt;br /&gt;
  right 0.51&lt;br /&gt;
  top 0.75&lt;br /&gt;
  bottom 1.25&lt;br /&gt;
  end&lt;br /&gt;
scale 1:1&lt;br /&gt;
vareas mm_grid&lt;br /&gt;
  fcolor none&lt;br /&gt;
  color 180:180:180&lt;br /&gt;
  width 0.5&lt;br /&gt;
  end&lt;br /&gt;
grid 10&lt;br /&gt;
  color black&lt;br /&gt;
  width 0.5&lt;br /&gt;
  end&lt;br /&gt;
scalebar s&lt;br /&gt;
  where 4.25 10.35&lt;br /&gt;
# 4.25 = width letter / 2&lt;br /&gt;
  length 100&lt;br /&gt;
  segment 10&lt;br /&gt;
  numbers 2&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Convert to PDF:&lt;br /&gt;
 ps2pdf mm_letter.ps&lt;br /&gt;
&lt;br /&gt;
== More ideas ==&lt;br /&gt;
&lt;br /&gt;
For a cleaner page you might try replacing the vector grid and '''grid''' line instruction with a series of crosses:&lt;br /&gt;
&lt;br /&gt;
 grid 10&lt;br /&gt;
   color black&lt;br /&gt;
   cross 1&lt;br /&gt;
   width 0.5&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
or fiducial marks:&lt;br /&gt;
&lt;br /&gt;
 vpoints two_inch_grid&lt;br /&gt;
   type centroid&lt;br /&gt;
   symbol extra/fiducial&lt;br /&gt;
   rotate 45&lt;br /&gt;
   color black&lt;br /&gt;
   size 8&lt;br /&gt;
   width 0.2&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* I'm pretty sure [[GMT]] has a graph paper demo; if so I got the idea for this demo from them. (''link?'')&lt;br /&gt;
* Hort guide how to write a [http://www.bookwormlab.com/descriptive-essay descriptive essay]&lt;br /&gt;
&lt;br /&gt;
[[Category: ps.map]]&lt;br /&gt;
[[Category: Documentation]]&lt;/div&gt;</summary>
		<author><name>⚠️Larah</name></author>
	</entry>
</feed>