Hi, 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. But the main point is that my workflow was fine in R 4.0.0 and the older sp version, and after i upgraded to the newest R and updated all packages i am getting the projection warning. So, first file: buff 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: pln 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(buff) CRS arguments: +proj=utm +zone=16 +datum=WGS84 +units=m +no_defs crs(pln) 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, Monica
sp:gIntersection warning message about projection
2 messages · Monica Palaseanu-Lovejoy, Bede-Fazekas Ákos
Hello Monica, The format of CRS definition changed a lot in the last years. I saw similar errors thrown by package sf, and transforming or CRS modification solved the problem. Does rgeos::gIntersection() work if you run one of the following lines before intersection?: proj4string(pln) <- proj4string(buff) pln <- spTransform(pln, proj4string(buff)) pln <- spTransform(x = pln, CRSobj = "+proj=utm +zone=16 +datum=WGS84 +units=m +no_defs"); buff<- spTransform(x = buff, CRSobj = "+proj=utm +zone=16 +datum=WGS84 +units=m +no_defs") Have a nice week, ?kos Bede-Fazekas Hungarian Academy of Sciences 2020.10.21. 16:29 keltez?ssel, Monica Palaseanu-Lovejoy ?rta:
Hi, 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. But the main point is that my workflow was fine in R 4.0.0 and the older sp version, and after i upgraded to the newest R and updated all packages i am getting the projection warning. So, first file: buff 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: pln 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(buff) CRS arguments: +proj=utm +zone=16 +datum=WGS84 +units=m +no_defs crs(pln) 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, Monica [[alternative HTML version deleted]]
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo