Apply a Map Projection

DESCRIPTION:

Applies a projection to a geographic map. This function is part of the maps library. To make it available in your Spotfire S+ session, use the command library(maps).

USAGE:

mapproject(x, y, projection="mercator",
     parameters=NULL, orientation=c(90,0,m))

ARGUMENTS:

x,y
vectors giving longitude and latitude coordinates of points on the earth's surface to be projected. A list containing components named x and y may also be given. Missing values ( NAs) are allowed. The coordinate system is degrees of longitude east of Greenwich and degrees north of the equator, so that points in the U.S. have negative longitude and positive latitude, for example.
projection
character string that names a map projection to use.
parameters
optional numeric vector of parameters to use with the projection argument.
orientation
vector of up to three numbers specifying the orientation of non-standard projections. The default is c(90,0,m), where m is the middle of the longitude range.

VALUE:

list with components named x and y containing the projected coordinates; NA s project to NAs. Points deemed unprojectable (such as north of 80 degrees latitude in the Mercator projection) are returned as NA.

Each time mapproject is called, it creates a data set called .Last.projection on frame 0. This data set is a list with components named projection , parameters , and orientation, containing the arguments from the call to mapproject. Subsequent calls to mapproject use information from .Last.projection. Since map uses mapproject to do its projections, calls to mapproject that follow a call to map need not supply arguments other than x and y.

DETAILS:

Each standard projection is displayed with the Prime Meridian (longitude 0) as a straight vertical line, along which North is up. The orientation of nonstandard projections is specified by the three values parameters=c(lat,lon,rot). Imagine a transparent gridded sphere around the globe. First turn the overlay about the North Pole so that the Prime Meridian of the overlay coincides with meridian lon on the globe. Then tilt the North Pole of the overlay along its Prime Meridian to latitude lat on the globe. Finally, turn the overlay about its "North Pole" again so that its Prime Meridian coincides with the previous position of (the overlay) meridian rot. Project the desired map in the standard form appropriate to the overlay, but presenting information from the underlying globe.

In the descriptions that follow (adapted from the McIlroy reference), each projection is shown as a function call. If the projection requires additional parameters, these are shown as arguments to the function. The descriptions are grouped into families.

Equatorial projections centered on the Prime Meridian (longitude 0). Parallels are straight horizontal lines.

mercator() equally spaced straight meridians, conformal, straight compass courses
sinusoidal() equally spaced parallels, equal-area, same as bonne(0)
cylequalarea(lat0) equally spaced straight meridians, equal-area, true scale on lat0
cylindrical() central projection on tangent cylinder

rectangular(lat0) equally spaced parallels, equally spaced straight meridians, true scale on lat0
gall(lat0) parallels spaced stereographically on prime meridian, equally spaced straight meridians, true scale on lat0
mollweide() (homalographic) equal-area, hemisphere is a circle

Azimuthal projections centered on the North Pole. Parallels are concentric circles. Meridians are equally spaced radial lines.
azequidistant() equally spaced parallels, true distances from pole
azequalarea() equal-area
gnomonic() central projection on tangent plane, straight great circles
perspective(dist) viewed along earth's axis dist earth radii from center of earth
orthographic() viewed from infinity
stereographic() conformal, projected from opposite pole
laue() radius = tan(2 * colatitude) used in xray crystallography
fisheye(n) stereographic seen through medium with refractive index n

Polar conic projections symmetric about the Prime Meridian. Parallels are segments of concentric circles. Except in the Bonne projection, meridians are equally spaced radial lines orthogonal to the parallels.
conic(lat0) central projection on cone tangent at lat0
simpleconic(lat0,lat1) equally spaced parallels, true scale on lat0 and lat1
lambert(lat0,lat1) conformal, true scale on lat0 and lat1
albers(lat0,lat1) equal-area, true scale on lat0 and lat1
bonne(lat0) equally spaced parallels, equal-area, parallel lat0 developed from tangent cone

Projections with bilateral symmetry about the Prime Meridian and the equator.
polyconic() parallels developed from tangent cones, equally spaced along Prime Meridian
aitoff() equal-area projection of globe onto 2-to-1 ellipse, based on azequalarea
lagrange() conformal, maps whole sphere into a circle
bicentric(lon0) points plotted at true azimuth from two centers on the equator at longitudes +lon0 and -lon0, great circles are straight lines (a stretched gnomonic projection)
elliptic(lon0) points are plotted at true distance from two centers on the equator at longitudes +lon0 and -lon0
globular() hemisphere is circle, circular arc meridians equally spaced on equator, circular arc parallels equally spaced on 0- and 90-degree meridians
vandergrinten() sphere is circle, meridians as in globular, circular arc parallels resemble mercator

Miscellaneous projections.
harrison(dist,angle) oblique perspective from above the North Pole, dist earth radii from center of earth, looking along the Date Line angle degrees off vertical
trapezoidal(lat0,lat1) equally spaced parallels, straight meridians equally spaced along parallels, true scale at lat0 and lat1 on Prime Meridian

Retroazimuthal projections. At every point the angle between vertical and a straight line to "Mecca", latitude lat0 on the prime meridian, is the true bearing of Mecca.
mecca(lat0) equally spaced vertical meridians
homing(lat0) distances to Mecca are true

Maps based on the spheroid. Of geodetic quality, these projections do not make sense for tilted orientations. For descriptions, see corresponding maps above.
sp_mercator()
sp_albers(lat0,lat1)

REFERENCES:

Becker, R. A. and Wilks, A. R. (1991). Maps in S. AT&T Bell Laboratories Statistics Research Report.

McIlroy, M.D. (1990). Documentation for proj(3) from Tenth Edition UNIX Manual, Volume 1. Saunders College Publishing.

EXAMPLES:

# load the maps library
library(maps)
# Bonne equal-area projection with state abbreviations
map(proj='bonne', param=45)
text(mapproject(state.center), labels=state.abb)