convUL {PBSmapping}R Documentation

Convert Coordinates between UTM and Lon/Lat

Description

Convert coordinates between UTM and Lon/Lat.

Usage

convUL (xydata, km=TRUE)

Arguments

xydata

data frame with columns X and Y.

km

use UTM coordinates in kilometres if true, or metres if false.

Details

xydata must possess a projection attribute that identifies the current projection. If the data frame contains UTM coordinates, it must also have a zone attribute equal to a number between 1 and 60 (inclusive). If it contains longitude/latitude coordinates and the zone attribute is missing, the function computes the mean longitude and uses that value to determine the zone. The longitude range of zone i is -186 + 6i < x <= -180 + 6i degrees.

This function converts the X and Y columns of xydata from "LL" to "UTM" or vice-versa. After the conversion, it adjusts the data frame's attributes accordingly.

Value

A data frame identical to xydata, except that the X and Y columns contain the results of the conversion and the projection attribute matches the new projection.

See Also

closePolys, fixBound.

Examples

#--- load the data
data(nepacLL, package="PBSmapping")
#--- set the zone attribute
attr(nepacLL, "zone") <- 9
#--- convert and plot the result
nepacUTM <- convUL(nepacLL)
plotMap(nepacUTM)

[Package PBSmapping version 2.61.9 Index]