[R] sp:gIntersection warning message about projection

Robert Lovejoy mon|c@p@|@|ovejoy @end|ng |rom gm@||@com
Tue Oct 20 15:37:15 CEST 2020


I am using in my workflow gIntersection from sp package. Part of my
relevant sessionInfo is:
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763)

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

other attached packages:
[1] CircStats_0.2-6 boot_1.3-25     MASS_7.3-53     stringr_1.4.0
[5] rgeos_0.5-5     maptools_1.0-2  rgdal_1.5-18    raster_3.3-13
[9] sp_1.4-4

So i am using 2  SpatialLinesDataFrame that are results of previous
computation. I am not sure i can give a viable examples, but maybe this can
be solved without. If not i will figure out how i can give you a workable
example. Or if you know if there are in R already loaded 2 different line
shapefiles with projection then i will see if i can replicate this problem.

So, first file:
class       : SpatialLinesDataFrame
features    : 1
extent      : 560525.5, 561302.4, 4698908, 4701110  (xmin, xmax, ymin, ymax)
crs         : +proj=utm +zone=16 +datum=WGS84 +units=m +no_defs
variables   : 2
names       : ID, buff_dist
value       :  2,       135

second file:

class       : SpatialLinesDataFrame
features    : 1
extent      : 560615.6, 560705.4, 4698905, 4699180  (xmin, xmax, ymin, ymax)
crs         : +proj=utm +zone=16 +datum=WGS84 +units=m +no_defs
variables   : 2
names       :                x,                y
value       : 560615.564407584, 4698904.71208346

Please observe that both files have identical projections.

p1 <- gIntersection(buff, pln)
Warning message:
In RGEOSBinTopoFunc(spgeom1, spgeom2, byid, id, drop_lower_td,
unaryUnion_if_byid_false,  :
  spgeom1 and spgeom2 have different proj4 strings

This warning is baffling since both files have same projection:
CRS arguments:
 +proj=utm +zone=16 +datum=WGS84 +units=m +no_defs

CRS arguments:
 +proj=utm +zone=16 +datum=WGS84 +units=m +no_defs

Probably i am doing something wrong but for the life of me i cannot see it
as yet.

Thanks so much for any help, take care,

	[[alternative HTML version deleted]]

More information about the R-help mailing list