GPS2UTM {utilitiesR} | R Documentation |
converts GPS coordinates to UTM coordinates
GPS2UTM(gps, using = c("proj", "rgdal"), inverse = FALSE, zone = 56, hemisphere = c("south", "north"))
gps |
a nx2 matrix with LON then LAT |
using |
one of 'proj' or 'rgdal': use proj executable (must be in $PATH) or rgdal package |
inverse |
whether to invert (ie UTM2GPS), default FALSE (i.e. GPS -> UTM) |
zone |
the zone for conversion (either zone the UTM coordinates are in, or what zone to give UTM coordinates relative to). If doing GPS to UTM conversion and the zone argument is missing, we will calculate the zone that the average longitude is in and give all UTMs in that zone (even if they are infinite!) If doing GPS to UTM conversion and the zone argument is NULL, we will give *each* converted UTM in the closest zone (zone includes the start point and excludes the end point, e.g. Zone 1 is [-180, -174)) In either case, attr(out, 'zone') will be a vector with the zone. For UTM to GPS conversions, you MUST supply a zone. |
hemisphere |
hemisphere for conversion. If doing UTM to GPS conversion, this MUST be provided. If doing GPS to UTM conversion and this is missing, we provide all UTMs relative to the hemisphere that the mean latitude is in (0 is North). If doing GPS to UTM conversion and this is NULL, we provide all UTMs relative to the hemisphere that each coordinate is in. In either case, attr(out, 'hemisphere') is a vector with the hemispheres. |
You need either package 'rgdal' [need libgdal1-dev in ubuntu and libproj-dev] OR 'proj' in your path [proj-bin in ubuntu].
If doing conversion from UTM to GPS, it is *very important* to know the zone and the hemisphere, as an easting/northing pair can be valid in both hemispheres, and/or multiple zones.
If doing conversion from GPS to UTM, it's not as improtant to know the zone/hemisphere, as the hemisphere can be told from the latitude.
The zone can be calculated as (wikipedia):
The UTM system divides the surface of the Earth ... into 60 zones, each of 6 degrees of longitude in width. Zone 1 covers longitude 180 to 174 degrees W; zone numbering increases eastward to zone 60 that covers longitude 174 to 180 E.
a nx2 matrix with UTM (colnames 'X' and 'Y') or GPS ('lon' and 'lat'). For GPS to UTM conversion: In addition, it has attributes 'zone' and 'hemisphere' being vectors of length n with the zone/hemisphere of each coordinate. Coordinates that could not be converted are set to NA.
Other coordinates: formatGPS
,
getUTMZone
, UTM2GPS