Robert Lovejoy
2020-Oct-20 13:37 UTC
[R] sp:gIntersection warning message about projection
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. 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]]
Probably better asked on the r-sig-geo list, which is specifically for spatial statistics. Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Tue, Oct 20, 2020 at 6:38 AM Robert Lovejoy <monicapalalovejoy at gmail.com> wrote:> 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. > > 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-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]