PBSmapping (version 2.72.1)

addCompass: Add Compass to Map

Description

Add a compass rose to an existing map, similar to those found on nautical charts showing both true north and magnetic north.

Usage

addCompass(X, Y, rot="magN", cex=1, 
   col.compass=c("gainsboro","blue","yellow","black"), ...)

Arguments

X

Longitude coordinate (degrees N) for centroid of compass rose.

Y

Latitude coordinate (degrees W) for centroid of compass rose.

rot

Rotation (degrees) counterclockwise from 0 degrees (true North). See Details.

cex

Character expansion to use in the display.

col.compass

Colours for compass rose components (in order): 1=background compass, 2=rotated arms, 3=central button, 4=pch (broder).

Additional parameters to pass to the text function.

Value

No valule returned.

Details

The basic idea comes from Jim Lemon (see References), but is modified here to reflect a compass rose used on BC nautical charts.

The default rotation ("magN") is a calculation of the initial bearing of a great-circle arc from the compass position to the north geomagnetic pole using the function calcGCdist.

References

[R-sig-Geo] How to display a compass rose on a map

Magnetic North, Geomagnetic and Magnetic Poles

See Also

addBubbles, addLabels, addPoints, addStipples, calcGCdist

Examples

Run this code
# NOT RUN {
local(envir=.PBSmapEnv,expr={
  data(nepacLL,envir=.PBSmapEnv)
  par(mfrow=c(1,1),mar=c(3,4,0.5,0.5))
  plotMap(nepacLL, xlim=c(-134.5,-124.5), ylim=c(48,55), plt=NULL,
    col="lightyellow", cex.axis=1.2, cex.lab=1.5)
  addCompass(-132, 49.5, cex=1.5)
})
# }

Run the code above in your browser using DataLab