Created
February 22, 2016 00:20
-
-
Save geotheory/2e53c0a4591601a88b4b to your computer and use it in GitHub Desktop.
Return proj4 CRS object defining a two-point equidistant projection fitting a spatial object
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require(raster) | |
project_tpe = function(d, x=0, y=0){ | |
d = data.frame(t(as.matrix(extent(d)))) | |
dy = mean(d$y) | |
CRS(paste0("+proj=tpeqd +lat_1=", dy, " +lon_1=", d$x[1], | |
" +lat_2=", dy, " +lon_2=", d$x[2], " +x_0=", x, " +y_0=", y, | |
" +ellps=WGS84 +datum=WGS84 +units=m +no_defs")) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment