Skip to content

Mapview problems with CRS, WKT,rgdal with projections #343

@fabeit

Description

@fabeit

I am not even sure where to start but mapview is not working anymore for me, I cannot plot anything anymore and I wonder if it's related to the recent changes to PROJ6.

When I try to use it with a raster I get

y <- raster(ncol=180, nrow=75, xmn=-180, xmx=180, ymn=-60, ymx=90)
y=setValues(y,1)
class      : RasterLayer 
dimensions : 75, 180, 13500  (nrow, ncol, ncell)
resolution : 2, 2  (x, y)
extent     : -180, 180, -60, 90  (xmin, xmax, ymin, ymax)
crs        : +proj=longlat +datum=WGS84 +no_defs 
source     : memory
names      : layer 
values     : 0.0104, 7.2  (min, max)

Error in rgdal::rawTransform(projfrom, projto, nrow(xy), xy[, 1], xy[,  : 
  target crs creation failed: generic error of unknown origin
In addition: Warning messages:
1: In showSRID(uprojargs, format = "PROJ", multiline = "NO") :
  Discarded ellps WGS 84 in CRS definition: +proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs
2: In showSRID(uprojargs, format = "PROJ", multiline = "NO") :
  Discarded datum WGS_1984 in CRS definition
3: In rgdal::rawTransform(projfrom, projto, nrow(xy), xy[, 1], xy[,  :
  48 projected point(s) not finite
4: In rgdal::rawTransform(projfrom, projto, nrow(xy), xy[, 1], xy[,  :
  48 projected point(s) not finite
5: In showSRID(uprojargs, format = "PROJ", multiline = "NO") :
  Discarded ellps WGS 84 in CRS definition: +proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs
6: In showSRID(uprojargs, format = "PROJ", multiline = "NO") :
  Discarded datum WGS_1984 in CRS definition
7: In CPL_crs_from_input(x) :
  GDAL Error 4: Unable to open EPSG support file gcs.csv.  Try setting the GDAL_DATA environment variable to point to the directory containing EPSG csv files.
8: In wkt(pto) : CRS object has no comment
9: In rgdal::rawTransform(projfrom, projto, nrow(xy), xy[, 1], xy[,  :
  Using PROJ not WKT2 strings 

When I try with a polygon

t=rasterToPolygons(y)
class       : SpatialPolygonsDataFrame 
features    : 3845 
extent      : -180, 180, -58, 90  (xmin, xmax, ymin, ymax)
crs         : +proj=longlat +datum=WGS84 +no_defs 
variables   : 1
names       :              layer 
min values  : 0.0104000000283122 
max values  :   7.19999980926514 
> mapview(t)

Error in st_crs.character(comment(x)) : invalid crs: GEOGCRS["unknown",
    DATUM["World Geodetic System 1984",
        ELLIPSOID["WGS 84",6378137,298.257223563,
            LENGTHUNIT["metre",1]],
        ID["EPSG",6326]],
    PRIMEM["Greenwich",0,
        ANGLEUNIT["degree",0.0174532925199433],
        ID["EPSG",8901]],
    CS[ellipsoidal,2],
        AXIS["longitude",east,
            ORDER[1],
            ANGLEUNIT["degree",0.0174532925199433,
                ID["EPSG",9122]]],
        AXIS["latitude",north,
            ORDER[2],
            ANGLEUNIT["degree",0.0174532925199433,
                ID["EPSG",9122]]]]

I have just reinstalled all packages

> packageVersion('mapview')
[1] ‘2.9.0> packageVersion('raster')
[1] ‘3.3.13> packageVersion('sp')
[1] ‘1.4.2> packageVersion('rgdal')
[1] ‘1.5.16

What's happening all of a sudden? I never had these problems.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions