[R-sig-Geo] SpTransform problem : conversion from WGS84 to UTM32N unregular
Roger Bivand
Roger.Bivand at nhh.no
Fri Feb 13 14:07:43 CET 2015
On Fri, 13 Feb 2015, FVASBIEN at atmo-alsace.net wrote:
>
> Hi list,
>
> I use a kriging package for several years and it works successfully in my
> automated air-quality forecasting chain, by using old versions of
> libraries(e.g. 2009/2010 versions of sp, rgdal, …).
> Currently, I’ve to change of server (from 32 bits to 64 bits) and I’ve
> installed the same package (and so the last delivered versions of
> libraries) on this new server.
This does not tell us your platform, R or package versions. Critically,
you do not say how you installed rgdal. If we assume 2010, then this may
be R 2.11; this indicates rgdal 0.6-29 as a Windows binary for which we
could determine the version of the external PROJ4 library used for
coordinate transformation (the earliest Windows binary on CRAN for R 2.9
is 0.6-24).
If Linux, http://cran.r-project.org/src/contrib/Archive/rgdal gives the
release archive. In running R and loaded rgdal, getPROJ4VersionInfo()
provides the version of PROJ4. What would then be important is which PROJ4
version was used, and possibly how it was installed. If .deb or .rpm, this
may be interpolated. Changes in spTransform since rgdal migrated from
sourceforge to R-Forge in September 2010 are:
https://r-forge.r-project.org/scm/viewvc.php/pkg/R/project.R?root=rgdal&r1=263&r2=508
from around l. 71, and
https://r-forge.r-project.org/scm/viewvc.php/pkg/src/projectit.cpp?root=rgdal&r1=263&r2=508
from line 254.
>
> I encounter an annoying problem: by using strictly the same package and the
> same inputs data, the conversion of grids from Lon-Lat WGS84 (irregular
> grid) to UTM32 doesn’t lead to a strictly regular grid, and this leads to a
> problem for the kriging process.
> By using the old libraries versions, the UTM32 grid obtained is strictly
> regular with a step of 3km !
This is not a reproducible example. You should provide actual copy&paste
code. The opportunities for user error are endless.
>
> Concretely, my package begins by extracting the longitude and latitude of
> my CTM model outputs at 3km resolution. I assign to these data the WGS84
> projection via the attribute "CRS (" + init = epsg: 4326 ")". After this
> treatment, I obtain as expected a list of lon-lat on each cell centroide.
> This is the next step which raises concern: to convert this grid into a
> regular grid, I apply the grid conversion into utm32 via the spTransform
> package and the attribute "CRS ("+proj=utm +zone=32 +ellps=intl
> +towgs84=-87, -96 , -120 +units=m +no_defs”)".
spTransform() is a method, spaces are not permitted in +towgs84=.
My domain covers the East of
> France and goes across Germany, hence the “towgs84” params added.
> After this treatment, I obtain the coordinates of my grid in UTM32 North
> zone, but these are not strictly regular (decimal data appear) and the step
> never strictly equals to 3km.
>
> Does anyone have any feedback or experience about my problem ? I thought to
> an update in the attributes of the spTransform package, but I’ve found no
> answer yet…
Did you just ask, or actually look at the source? Do you have properly
journalled history files for what you say you did on 5-year-old software?
How do we know that this is neither a consequence of changing from 32-bit
to 64-bit, nor user error?
I have already seen this posting twice as list admin, and did ask
explicitly for:
"Well-constructed self-contained examples get answers very quickly,
hand-waving gets ignored. Here you must document which versions performed
as you expected, and which do not now (use sessionInfo() and report full
message output as packages are loaded). It could be that the earlier
behaviour was a user error or bug corrected in a newer release."
I don't think that you followed my advice.
Roger
> Any information regarding my problem would be nice !
>
> Thanks you,
>
> Greetings,
> Florent.
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
--
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 91 00
e-mail: Roger.Bivand at nhh.no
More information about the R-sig-Geo
mailing list