[R-sig-Geo] different projection transformation R and gdal commandline

Dominik Schneider Dominik.Schneider at colorado.edu
Mon Feb 15 21:57:09 CET 2016


Sorry, forgot to add the details. rgdal and gdal 1.11.3 were installed from
kyngchaos.com

> sessionInfo()
R version 3.2.3 (2015-12-10)
Platform: x86_64-apple-darwin14.5.0 (64-bit)
Running under: OS X 10.11.3 (El Capitan)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] parallel  stats     graphics  grDevices utils     datasets  methods
base

other attached packages:
 [1] rasterVis_0.37      latticeExtra_0.6-26 lattice_0.20-33
broom_0.4.0
 [5] tidyr_0.3.1         dplyr_0.4.3         doMC_1.3.4
 iterators_1.0.8
 [9] foreach_1.4.3       ncdf4_1.15          gridExtra_2.0.0
spdep_0.5-92
[13] Matrix_1.2-3        ipred_0.9-5         MASS_7.3-45
RColorBrewer_1.1-2
[17] rgdal_1.0-7         stringr_1.0.0       ggplot2_2.0.0       plyr_1.8.3

[21] reshape2_1.4.1      raster_2.5-2        sp_1.2-1
 gstat_1.1-0
[25] ProjectTemplate_0.6

loaded via a namespace (and not attached):
 [1] zoo_1.7-12       splines_3.2.3    colorspace_1.2-6 spacetime_1.1-5
 [5] survival_2.38-3  prodlim_1.5.7    hexbin_1.27.1    DBI_0.3.1
 [9] lava_1.4.1       munsell_0.4.2    gtable_0.1.2     codetools_0.2-14
[13] coda_0.18-1      psych_1.5.8      labeling_0.3     class_7.3-14
[17] xts_0.9-7        Rcpp_0.12.2      scales_0.3.0     FNN_1.1
[21] deldir_0.1-9     mnormt_1.5-3     digest_0.6.8     stringi_1.0-1
[25] grid_3.2.3       tools_3.2.3      LearnBayes_2.15  magrittr_1.5
[29] lazyeval_0.1.10  assertthat_0.1   R6_2.1.1         rpart_4.1-10
[33] boot_1.3-17      intervals_0.15.1 nnet_7.3-11      nlme_3.1-122


Dominik Schneider
c 518.956.3978


On Mon, Feb 15, 2016 at 1:37 PM, Dominik Schneider <
dominik.schneider at colorado.edu> wrote:

> Hi,
> I'm struggling to use a custom projection. I am seeing differences with
> someone using python proj4 bindings and when I compared my R results with
> my commandline results I got even more confused. the coordinate
> transformation is different for the two different methods.
>
> could someone explain to me which one is wrong and why?
> Thanks
>
> R:
> e=c(-112.25,-104.125,33,43.75)
> box=as(extent(e),'SpatialPolygons')
> proj4string(box)='+proj=longlat +datum=WGS84'
> pstring='+proj=lcc +lat_1=28 +lat_2=50 +lat_0=39.70001220694445 +lon_0=-98
> +x_0=0 +y_0=0 +ellps=sphere +a=6370000 +b=6370000 +units=m +no_defs'
> xmin(spTransform(box,CRS(pstring)))
> ## [1] -1306471
> ymin(spTransform(box,CRS(pstring)))
> ## [1] -713442.3
>
> commandline:
> iMac:~ $ gdaltransform -s_srs "+proj=longlat +datum=WGS84" -t_srs
> "+proj=lcc +lat_1=28 +lat_2=50 +lat_0=39.70001220694445 +lon_0=-98 +x_0=0
> +y_0
> =0  +ellps=sphere  +a=6370000 +b=6370000 +units=m +no_defs"
> -112.25 33.
> -1306675.75472246 -629522.472322824 0
>
>

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list