convUL: Convert Coordinates between UTM and Lon/Lat

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/PBSmapping.r

Description

Convert coordinates between UTM and Lon/Lat.

Usage

1
convUL (xydata, km=TRUE, southern=NULL)

Arguments

xydata

data frame with columns X and Y.

km

Boolean value; if TRUE, UTM coordinates within xydata are in kilometres; otherwise, metres.

southern

Boolean value; if TRUE, forces conversions from UTM to longitude/latitude to produce coordinates within the southern hemisphere. For conversions from UTM, this argument defaults to FALSE. For conversions from LL, the function determines southern from xydata.

Details

The object 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 geographic (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. If the data span more than one zone to the right or left of the intended central zone, the underlying algorithm may produce erroneous results. This limitation means that the user should use the most central zone of the mapped region, or allow the function to determine the central zone when converting from geographic to UTM coordinates. After the conversion, this routine 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.

Author(s)

Nicholas M. Boers, Associate Professor – Computer Science
MacEwan University, Edmonton AB
Last modified Rd: 2013-04-10

References

Ordnance Survey. (2010) A guide to coordinate systems in Great Britain. Report D00659 (v2.1). Southampton, UK.
http://www.ordnancesurvey.co.uk/oswebsite/gps/docs/A_Guide_to_Coordinate_Systems_in_Great_Britain.pdf.

See Also

closePolys, fixBound.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
local(envir=.PBSmapEnv,expr={
  oldpar = par(no.readonly=TRUE)
  #--- load the data
  data(nepacLL,envir=.PBSmapEnv)
  #--- set the zone attribute
  #--- use a zone that is most central to the mapped region
  attr(nepacLL, "zone") <- 6
  #--- convert and plot the result
  nepacUTM <- convUL(nepacLL)
  plotMap(nepacUTM)
  par(oldpar)
})

Example output

sh: 1: cannot create /dev/null: Permission denied

-----------------------------------------------------------
PBS Mapping 2.69.76 -- Copyright (C) 2003-2017 Fisheries and Oceans Canada

PBS Mapping comes with ABSOLUTELY NO WARRANTY;
for details see the file COPYING.
This is free software, and you are welcome to redistribute
it under certain conditions, as outlined in the above file.

A complete user guide 'PBSmapping-UG.pdf' is located at 
/usr/lib/R/site-library/PBSmapping/doc/PBSmapping-UG.pdf

Packaged on 2015-04-23
Pacific Biological Station, Nanaimo

All available PBS packages can be found at
http://code.google.com/p/pbs-software/

To see demos, type '.PBSfigs()'.
-----------------------------------------------------------


convUL: Converting coordinates within the northern hemisphere.

PBSmapping documentation built on Jan. 15, 2021, 3:41 p.m.