riatelab / cartography

Thematic Cartography for R
http://riatelab.github.io/cartography/docs/
398 stars 46 forks source link

CRS issues #54

Closed rsbivand closed 4 years ago

rsbivand commented 5 years ago

The getGridLayer example now fails with PROJ 6.1.0 on st_crs(x) == st_crs(y) with current sf (@edzer) and:

> mygrid <- getGridLayer(x = mtq, cellsize = 3e7, type = "hexagonal", var = "POP")
Error in st_geos_binop("intersects", x, y, sparse = sparse, prepared = prepared) : 
  st_crs(x) == st_crs(y) is not TRUE
> sf_extSoftVersion()
          GEOS           GDAL         proj.4 GDAL_with_GEOS 
       "3.7.2"        "3.0.0"        "6.1.0"         "true" 
> debug(getGridLayer)
...
Browse[2]> st_crs(x)
Coordinate Reference System:
  EPSG: 32620 
  proj4string: "+proj=utm +zone=20 +datum=WGS84 +units=m +no_defs"
...
Browse[2]> st_crs(grid)
Coordinate Reference System:
  EPSG: 32620 
  proj4string: "+proj=utm +zone=20 +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"
Browse[2]> 
Error in st_geos_binop("intersects", x, y, sparse = sparse, prepared = prepared) : 
  st_crs(x) == st_crs(y) is not TRUE
>
rCarto commented 5 years ago

Thank you for letting me know. My guess is that the problem is related to a mixed use of sp and sf. Commit 3740956 make use of sf only and should fix the crs mismatch...

rsbivand commented 5 years ago

I've submitted rgdal anyway. I think @edzer knows how to set up CI with current PROJ and GDAL.

edzer commented 5 years ago

I do, but I don't use it. I'm using CI with ubuntugis-unstable PPA, which hasn't migrated to GDAL 3 yet.

rsbivand commented 5 years ago

The problem is still present. it is NOT sp/sf. It is probably PROJ version related.

rCarto commented 4 years ago

I've just retested the current master with @Nowosad docker (GEOS 3.8.0, GDAL 3.0.2, PROJ 6.2.1) and it seems to work fine.