epsg: Functions to work with EPSG projection specifications

Description Usage Arguments References Examples

Description

Functions to work with EPSG projection specifications

Usage

1
2
3
4
5
agency.root(agency = NULL)

getEPSG(ref.id = 4326, verbose = TRUE, agency = NULL)

D_project(Df, coords = names(Df)[1:2], p4, p4old, verbose = TRUE, ...)

Arguments

agency

character;

ref.id

integer;

verbose

logical;

Df

an object to be coerced into a data.frame

coords

character; the names of the coordinates in Df

p4, p4old

character; these are the proj4 strings for the new (p4) and old (p4old) data. More specifically, p4 will be the new projection (set by CRS), and p4old is the old projection (set by proj4string).

...

additional parameters to elide

References

A list of EPSG projections: http://spatialreference.org/ref/epsg/

A list of PROJ commands: https://trac.osgeo.org/proj/wiki/GenParms

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
## Not run: 
library(maps)
library(maptools)
library(datasets)
data(state)
states <- data.frame(state.x77, state.center)
# HI/AK are in the middle of the ocean, so take them out:
states <- states[states$x > -121,]

# uses getEPSG to project if p4/p4old are missing
d1 <- D_project(states, c("x","y"))

# set p4
p <- getEPSG()
d2 <- D_project(states, c("x","y"), p)
all.equal(d1,d2) # TRUE

# reproject into UTM-11 in kilometers
d2u <- spTransform(d2, CRS("+proj=utm +zone=11 +ellps=WGS84 +units=km"))

# change the projection
pold <- p
p <- getEPSG(2153)  # UTM-11 in meters
d3 <- D_project(states, c("x","y"), p, pold)

layout(matrix(1:6,ncol=3))
us <- map("usa",plot=FALSE)
plot(d1, axes=TRUE); title("d1"); lines(us)
plot(d2, axes=TRUE);title("d2 (== d1)"); lines(us)
plot(d2u, axes=TRUE);title("d2 - utm11/km")
plot(d3, axes=TRUE);title("d3 - utm11/m")
#
# rotate with maptools (can also do this using ...)
plot(elide(d2u, rotate=45));title("d2 at 45") # clockwise
plot(elide(d2u, rotate=-45));title("d2 at -45") # counter-clockwise
#

## End(Not run)

abarbour/deform documentation built on Feb. 15, 2022, 6:24 p.m.