oce (version 1.8-2)

map2lonlat: Convert X and Y to Longitude and Latitude

Description

Convert from x-y coordinates to longitude and latitude. This is normally called internally within oce; see “Bugs”. A projection must already have been set up, by a call to mapPlot() or lonlat2map(). It should be noted that not all projections are handled well; see “Bugs”.

Usage

map2lonlat(x, y, init = NULL, debug = getOption("oceDebug"))

Value

A list containing longitude and latitude, with NA

values indicating points that are off the globe as displayed.

Arguments

x

vector containing the x component of points in the projected space, or a list containing items named x and y, in which case the next argument is ignored.

y

vector containing the y coordinate of points in the projected space (ignored if x is a list, as described above).

init

vector containing the initial guesses for longitude and latitude, presently ignored.

debug

an integer specifying whether debugging information is to be printed during the processing. This is a general parameter that is used by many oce functions. Generally, setting debug=0 turns off the printing, while higher values suggest that more information be printed. If one function calls another, it usually reduces the value of debug first, so that a user can often obtain deeper debugging by specifying higher debug values.

Bugs

oce uses the sf::sf_project() function to handle projections. Only those projections that have inverses are permitted within oce, and of that subset, some are omitted because the oce developers have experienced problems with them.

Author

Dan Kelley

See Also

lonlat2map() does the inverse operation.

A map must first have been created with mapPlot().

Other functions related to maps: formatPosition(), lonlat2map(), lonlat2utm(), mapArrows(), mapAxis(), mapContour(), mapCoordinateSystem(), mapDirectionField(), mapGrid(), mapImage(), mapLines(), mapLocator(), mapLongitudeLatitudeXY(), mapPlot(), mapPoints(), mapPolygon(), mapScalebar(), mapText(), mapTissot(), oceCRS(), shiftLongitude(), usrLonLat(), utm2lonlat()

Examples

Run this code
library(oce)
# Cape Split, in the Minas Basin of the Bay of Fundy
cs <- list(longitude = -64.49657, latitude = 45.33462)
xy <- lonlat2map(cs, projection = "+proj=merc")
map2lonlat(xy)

Run the code above in your browser using DataLab