UTMConversion: UTM Conversion Tool

Description Usage Arguments Value Examples

View source: R/UTMConversion.R

Description

This function automatically converts a raster or shapefile from a longlat projection into the corresponding UTM projection.

Usage

1
UTMConversion(user_file)

Arguments

user_file

Can either be a sp/sf object or a raster file.

Value

The user_file in UTM projection.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
library(sp)
library(raster)
library(rgdal)
library(geosphere)

# Create a test polygon within Nigeria
my_extent <- extent(5,7,8,10)
my_poly <- as(my_extent, 'SpatialPolygons')
my_proj <- "+proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0"
proj4string(my_poly) <- CRS(my_proj)

# Apply the UTM conversion function
my_poly_utm <- UTMConversion(my_poly)
crs(my_poly_utm)

MBalthasar/SpatialDataToolbox documentation built on Jan. 29, 2020, 3:15 a.m.