NavList:
A Community Devoted to the Preservation and Practice of Celestial Navigation and Other Methods of Traditional Wayfinding
Plotting sheet update
From: Russell Sher
Date: 1998 Jan 14, 12:31 AM
From: Russell Sher
Date: 1998 Jan 14, 12:31 AM
Hi -- The plotting sheet from John Huges has been updated by him to include an
option of supressing the longitude as well as fixing a bug regarding the
display of minutes of latitude for the southern hemisphere (mmm. there is a
definite northern hemisphere bias from you guys !!)
see attached... (hope it gets through -- or email me)
all credits to John Huges
Russell
%!PS-Adobe-1.0
%%Document-Fonts: Helvetica
%%Title: Plotting Sheets for Large-Scale Navigation
%%Creator: John F. Hughes
%%Creation Date: January 9, 1995
%%Pages: 1
%%EndComments
%Copyright 1995, Brown University, Providence, RI
%
%Permission to use and modify this software and its documentation for any
%purpose other than its incorporation into a commercial product is hereby
%granted without fee. Permission to copy and distribute this software and its
%documentation only for non-commercial use is also granted without fee,
%provided, however, that the above copyright notice appear in all copies, that
%both that copyright notice and this permission notice appear in supporting
%documentation, that the name of Brown University not be used in advertising or
%publicity pertaining to distribution of the software without specific, written
%prior permission, and that the person doing the distribution notify Brown
%University of such distributions outside of his or her organization. Brown
%University makes no representations about the suitability of this software for
%any purpose. It is provided "as is" without express or implied warranty.
%Brown University requests notification of any modifications to this software
%or its documentation.
%
%Send the following redistribution information:
%
% Name:
% Organization:
% Address (postal and/or electronic):
%
%To:
% Software Librarian
% Computer Science Department, Box 1910
% Brown University
% Providence, RI 02912
%
% or
%
% brusd@cs.brown.edu
%
%We will acknowledge all electronic notifications.
%==
%== Plotting sheets, in Postscript. Landscape format.
%== Parameters for plotting sheets are set below,
%== at lines marked with like these: %**
%==
%==
%== This program has not been extensively tested, but
%== as it stands, it seems to work fine on an Apple LaserWriter,
%== at least in the case where the max and min latitude and the
%== min longitude are all specified in even degrees (no minutes)
%==
%== Author: John Hughes (jfh@cs.brown.edu), 3/22/93
%==
%== Revisions: 1/9/95 -- multipage output removed, postscript
%== structuring conventions have been followed.
%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==
% startup definitions %
%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==
%/saveobj save def
/edef {
exch def
} def
/angdef { % Define an angle in degrees and minutes; store internally
% in minutes;
% degrees minutes name angdef => -
3 1 roll % /name deg mins
exch 60 mul add def
} def
/inch { 72 mul} def
%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==
% Plotting Sheet parameters %
%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==
%== Minimum and maximum latitude, in degrees and minutes
%== Negative values indicate South longitude
%==
%**
-2 00 /min-lat angdef
2 00 /max-lat angdef
%**
%==
%== How many degrees and minutes per division line on the page?
%== This number should divide evenly into 1 degree, or be an integer
%== multiple of one degree
%==
%**
1 0 /lat-spacing angdef % this sets it to 1 degree, 0 minutes
%**
%==
%== Minimum longitude, in degrees and minutes
%== Negative values indicate West longitude
%==
%**
-68 00 /min-long angdef % 68 degrees west longitude
%**
%==
%== Set this to 1 to include compass rose, 0 to leave out
%== Compass rose is the lesser of 1.5" or lat-spacing in radius
%==
%**
1 /draw-compass edef % do include the compass rose
0 /magnetic-too edef % and do include the magnetic one, too.
-17 -30 /variation angdef % EAST angles are positive, WEST are negative
%**
%==
%== Width and height of paper (in landscape format; actual paper
%== is loaded on paper tray in portrait format in Apple Laserwriter.)
%**
11.88 inch /paper-height edef
16.8 inch /paper-width edef
%**
%==
%== The margin of the paper---the border on which the printer cannot
%== print. About 1/4" on an Apple Laserwriter
%==
%**
.25 inch /margin-width edef
%**
%==
%== width and height of plotting sheet (may use multiple sheets
%== of paper) (should be smaller than "paper size"
%== because of the margin width above)
%==
%**
10.88 inch /sheet-height edef
15.8 inch /sheet-width edef
%**
%==
%== How many degrees and minutes per tick-mark on the rulings?
%== This number should divide evenly into lat-spacing.
%==
%**
0 1 /tick-spacing angdef
%**
%==
%== How many degrees and minutes between large tick-marks
%== on the rulings? Should divide evenly into lat-spacing,
%== and be an integer multiple of tick-spacing
%==
%**
0 5 /mega-tick-spacing angdef
%**
%==
%== How many degree and minutes between labels on tick marks on the
%== rulings? Should be an integer multiple of mega-tick-spacing
%==
%**
0 10 /tick-label-spacing angdef
%**
%==
%== Should I show the longitudes, or do you want to fill in your
%== own? "true" means "show them" and "false" means "don't bother"
%==
%**
false /show-longitude-labels edef
%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%%
% Convert to landscape format
%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%%
paper-height 0 translate 90 rotate
%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%%
% Helper routines
%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%%
/kshow { % define a "show" command that blanks
% out a white box behind chars, with
% .02 inch "halo" all around
10 dict begin
/text edef
gsave
text stringwidth pop .04 inch add /width edef
1 setgray
-.02 inch -.02 inch rmoveto
width 0 rlineto
0 .14 inch rlineto
width neg 0 rlineto closepath fill
0 setgray
grestore
text show
end
} def
/ang-print { % Convert an angle to degrees and
% minutes and print at current locn
% usage: angle flag ang-print
% Flag = 0 for E/W, 1 for N/S
40 dict begin
/flag edef
/angle edef
angle 0 lt {
1
}
{
0
} ifelse /negflag edef
negflag 1 eq {
angle neg /angle edef
} if
angle 60 div cvi /deg edef
angle deg 60 mul sub cvi /min edef
20 string /text edef
deg 5 string cvs /degtext edef
min 5 string cvs /mintext edef
degtext false charpath .05 inch 0 rmoveto (\312) false charpath
mintext false charpath .05 inch 0 rmoveto (\302) false charpath
flag 0 eq {
negflag 0 eq {
(E)
}
{
(W)
}ifelse
}
{
negflag 0 eq {
(N)
}
{
(S)
}ifelse
} ifelse
false charpath stroke
end
} def
/arrowto {
8 dict begin
currentpoint /y0 edef /x0 edef
/y1 edef /x1 edef
x0 y0 moveto
x1 y1 lineto stroke
/x2 x1 .04 inch sub def
/x3 x1 .04 inch add def
/y2 y1 .2 inch sub def
newpath
x1 y1 moveto
x2 y2 lineto
x3 y2 lineto
x1 y1 lineto
fill
end
} def
%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%%
% Draw a compass rose;
%
% arguments: xpos, ypos (in inches), diameter (in inches)
% variation an angle, in minutes
%
%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%%
/compass {
gsave
20 dict begin
/variation edef
/diameter edef
/ypos edef
/xpos edef
xpos ypos translate
newpath
/radius % The radius is...
diameter 2 div
def
0 0 radius 0 360 arc stroke % Draw the basic circle
variation 60 div rotate
0 1 359 { % and the tick marks every degree
pop
-1 rotate
0 radius moveto
0 .05 inch rlineto stroke
} for
0 5 355 { % and the larger ticks every 5 degrees
pop
-5 rotate
0 radius moveto
0 .1 inch rlineto stroke
} for
0 10 350 { % and print the angle labels every 10 deg.
10 string cvs /angle edef
0 radius .18 inch add moveto
angle stringwidth % but remember to find the width of
pop 2 div neg 0 rmoveto % the label and offset it, so as to
angle kshow % center the label
-10 rotate
} for
end
grestore
} def
%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%%
% Draw a "magnetic" compass rose;
%
% arguments: xpos, ypos (in inches), diameter (in inches)
% enclosing-diameter (in inches)
% variation (an angle, in minutes)
% label-option (set to 1 to get cross-hairs and "variation" label
%
%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%%
/magnetic-compass {
gsave
20 dict begin
/label-option edef
/variation edef
/enclosing-diameter edef
/diameter edef
/ypos edef
/xpos edef
xpos ypos translate
0 0 diameter variation compass
variation 60 div neg rotate
label-option 1 eq {
newpath
0 0 moveto
/radius % The radius is...
diameter 2 div
def
/mradius radius .1 inch sub def
0 mradius sub 0 moveto
0 mradius add 0 lineto
stroke
newpath
0 0 mradius sub moveto
0 0 mradius add lineto
stroke
newpath
0 radius moveto
0 enclosing-diameter 2 div arrowto stroke
newpath
/variation-string 40 string def
gsave
(Variation) stringwidth pop .04 inch add /var-width edef
grestore
var-width .3 inch add neg 0.1 inch moveto
(Variation) show
newpath
.3 inch 0.1 inch moveto variation 0 ang-print
} if
grestore
} def
%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%%
% Draw a "complete" compass rose:
%
% arguments: xpos, ypos (in inches), diameter (in inches)
% variation (an angle, in minutes)
% magnetic-flag (1 if you want to include a "magnetic" rose inside the
% main compass rose)
%
%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%%
/full-compass{
20 dict begin
/magnetic-flag edef
neg /variation edef
/diameter edef
/ypos edef
/xpos edef
0 diameter 2 div .25 inch add moveto
0 diameter 2 div .75 inch add arrowto stroke
xpos ypos diameter 0 compass
magnetic-flag 1 eq {
xpos ypos diameter .8 inch sub diameter variation 1 magnetic-compass
} if
end
} def
%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%%
%== Set up coordinates so that one unit in y = 1 minute of latitude
%== and longitude coords in minutes can be converted to x coords w/
%== xcvt
%==
%== And the center of the page is (mid-long, mid-lat)
%==
%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%%
lat-spacing 5 div /margin edef
sheet-height % number of units currently on y-axis
max-lat min-lat sub % number of units we want on y-axis in core of drawing
margin 2 mul add % a little room around the edge for labels...
div /yscale edef
max-lat min-lat sub 2 div min-lat add % mid latitude
60 div cos yscale mul abs /xscale edef % Ratio of lat and long spacing
% Find the maximum longitude...
% xscale pstack
sheet-width xscale div min-long add margin 2 mul sub /max-long edef
%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%%
% Rescale everything to the new units so
% that one minute of latitude is 1 unit on the y axis
%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%%
yscale yscale scale
sheet-width yscale div /sheet-width edef
sheet-height yscale div /sheet-height edef
paper-width yscale div /paper-width edef
paper-height yscale div /paper-height edef
margin-width yscale div /margin-width edef
/inch {72 mul yscale div } def
/xcvt { %% convert from an angle to an x coordinate
yscale div xscale mul
} def
%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%%
% Reset the coordinate system origin so that lat and long between
% the min and max values correspond to locations on the printable
% part of the sheet
%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%%
% First put the origin of the coord system at (mid-lat, mid-long)
min-long max-long add 2 div xcvt neg
min-lat max-lat add 2 div neg translate
% And then put this new origin at the mid-sheet location
sheet-width 2 div sheet-height 2 div translate
% And move everything over by the margin width to get it all on the
% printable part of the page
margin-width margin-width translate
%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%%
% Find out how much we can actually fit onto the printable
% part of a page...
%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%%
paper-width margin-width 2 mul sub /usable-paper-width edef
paper-height margin-width 2 mul sub /usable-paper-height edef
%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%%
%== Set up a big loop to work through multiple pages...
%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%%
%-- removed in 1995 version: sheet-width usable-paper-width div ceiling .01 add /nwide edef
%-- removed in 1995 version: sheet-height usable-paper-height div ceiling .01 add /ntall edef
%-- removed in 1995 version: 1 1 nwide {
%-- removed in 1995 version: dup == (width) ==
%-- removed in 1995 version: gsave
%-- removed in 1995 version: 1 sub usable-paper-width mul neg 0 translate
% 0 usable-paper-height translate
%-- removed in 1995 version: 1 1 ntall {
%-- removed in 1995 version: gsave
%-- removed in 1995 version: dup ==
%-- removed in 1995 version: 1 sub usable-paper-height mul neg 0 exch translate
%==
%== Make the lower left corner of the page be
%== (min-long - margin, min-lat - margin)
%==
min-long margin sub xcvt /minx edef
max-long margin add xcvt /maxx edef
min-lat margin sub /miny edef
max-lat margin add /maxy edef
min-lat max-lat add 2 div /center-y edef
min-long max-long add 2 div /a edef
a lat-spacing div cvi lat-spacing mul
xcvt /center-x edef
%%EndProlog
%%Page: 1 1
%%PageFonts: Helvetica
0 setlinewidth % Everything is in thin lines
/Helvetica findfont .1 inch scalefont setfont
% using a 1/10" font height
currentfont /FontBBox get aload pop
/upy edef pop /downy edef pop upy downy sub /char-height edef
%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%%
% AT LAST! Do the actual drawing on the pages... %
% Draw (1) Horizontal lines with labels %
% (2) Tick marks and minute marks on the horiz. %
% line nearest to the center of the sheet %
% (3) Vertical lines with longitude labels %
% (4) Tick marks on the center one %
% (5) Compass rose, if requested %
%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%%
min-lat lat-spacing max-lat { % Draw horizontal lines with labels
/y edef newpath
minx y moveto
maxx y lineto stroke % Draw the line itself
minx .05 inch add
y .04 inch add moveto % Go to left end of line
y 1 ang-print % And print the angle, in N/S form (latitude)
} for
/y center-y def % Record the current y-value
min-long tick-spacing max-long { % draw tick marks on center line
xcvt /x edef
/y1 y .07 inch add def % small ticks are .07 inches long
x y moveto
x y1 lineto stroke
} for
min-long mega-tick-spacing max-long { % and mega-ticks...
xcvt /x edef
/y1 y .15 inch add def % big ticks are .15 inches long
x y moveto
x y1 lineto stroke
} for
min-long tick-label-spacing max-long { % and label the ticks
dup /angle edef
xcvt /x edef
/y1 y .2 inch add def
angle 60 div cvi % find the "minutes" part
60 mul angle exch sub cvi
/angle edef
angle 0 lt {angle 60 add /angle edef} if
x y1 moveto
angle 10 string cvs % first measure its size
dup stringwidth
pop 2 div neg 0 rmoveto % and use this to center it
kshow
} for
min-long lat-spacing max-long { % vertical lines and labels
dup /angle edef xcvt /x edef newpath
x miny moveto
x maxy lineto stroke
x miny margin add .2 inch sub moveto
show-longitude-labels {angle 0 ang-print} if
%==
%== changed in response to request from Russell Sher, 1/13/98
} for
/x center-x def
min-lat tick-spacing max-lat { % and tick marks
/y edef
/x1 x .07 inch add def
x y moveto
x1 y lineto stroke
} for
min-lat mega-tick-spacing max-lat { % and mega-ticks
/y edef
/x1 x .15 inch add def
x y moveto
x1 y lineto stroke
} for
min-lat tick-label-spacing max-lat { % and labels
dup /angle edef
/y edef
/x1 x .2 inch add def
angle 60 div cvi
60 mul angle exch sub cvi /angle edef
angle 0 lt {angle neg /angle edef} if
%== Fixed line above 1/13/98 to get the tick-marks right in southern hemisphere, at
%== prompting of Russell Sher.
x y moveto .18 inch 0 rmoveto
angle 10 string cvs
0 -.04 inch rmoveto
kshow
} for
%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%%
% Draw a compass rose, labelled at 10 degree intervals,
% if requested.
%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%==%%
draw-compass 1 eq {
center-x center-y translate
newpath
/diameter % The radius is...
1.5 inch lat-spacing lt % the lesser of
{1.5 inch} % 1.5 inches or...
{lat-spacing} ifelse % The spacing between latitude lines
2 mul def
0 0 diameter variation magnetic-too full-compass
} if
showpage % Print the page and eject it
%-- removed in 1995 version: grestore
%-- removed in 1995 version: } for % end of "ntall" loop
%-- removed in 1995 version: grestore
%-- removed in 1995 version: } for % end of "nwide" loop
%%Trailer
%saveobj restore
%xloc
%yloc
%diameter
%variation
%magnetic-too
%full-compass%
%
%showpage % Print the page and eject it
% 0 0 radius 0 360 arc stroke % Draw the basic circle
% 0 1 359 { % and the tick marks every degree
% pop
% -1 rotate
% 0 radius moveto
% 0 -.05 inch rlineto stroke
% } for
% 0 5 355 { % and the larger ticks every 5 degrees
% pop
% -5 rotate
% 0 radius moveto
% 0 -.1 inch rlineto stroke
% } for
% 0 10 350 { % and print the angle labels every 10 deg.
% 10 string cvs /angle edef
% 0 radius .24 inch sub moveto
% angle stringwidth % but remember to find the width of
% pop 2 div neg 0 rmoveto % the label and offset it, so as to
% angle kshow % center the label
% -10 rotate
% } for
%
%} if
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=
=-= TO UNSUBSCRIBE, send this message to majordomo@ronin.com: =-=
=-= navigation =-=
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=






