Skip to content

Reverse dependency check failure #1

@rsbivand

Description

@rsbivand

00check.log
fails with (traceback):

> library(stppSim)
> load(file = system.file("extdata", "camden.rda",
+ package="stppSim"))
> boundary = camden$boundary 
> landuse <- camden$landuse
> spo <- artif_spo(poly = boundary, n_origin = 50, restriction_feat = landuse, n_foci=5, foci_separation = 0, mfocal = NULL, conc_type = "dispersed", p_ratio=20)
Error in h(simpleError(msg, call)) : 
  error in evaluating the argument 'obj' in selecting a method for function 'bbox': assignment of an object of class "character" is not valid for slot 'proj4string' in an object of class "Spatial"; is(value, "CRS") is not TRUE
> traceback()
18: h(simpleError(msg, call))
17: .handleSimpleError(function (cond) 
    .Internal(C_tryCatchHelper(addr, 1L, cond)), "assignment of an object of class \"character\" is not valid for slot 'proj4string' in an object of class \"Spatial\"; is(value, \"CRS\") is not TRUE", 
        base::quote(checkSlotAssignment(object, name, value)))
16: stop(gettextf("assignment of an object of class %s is not valid for slot %s in an object of class %s; is(value, \"%s\") is not TRUE", 
        dQuote(valueClass), sQuote(name), dQuote(cl), slotClass), 
        domain = NA)
15: checkSlotAssignment(object, name, value)
14: `slot<-`(`*tmp*`, what, value = "PROJCRS[\"OSGB 1936 / British National Grid\",\n    BASEGEOGCRS[\"OSGB 1936\",\n        DATUM[\"OSGB 1936\",\n            ELLIPSOID[\"Airy 1830\",6377563.396,299.3249646,\n                LENGTHUNIT[\"metre\",1]]],\n        PRIMEM[\"Greenwich\",0,\n            ANGLEUNIT[\"degree\",0.0174532925199433]],\n        ID[\"EPSG\",4277]],\n    CONVERSION[\"British National Grid\",\n        METHOD[\"Transverse Mercator\",\n            ID[\"EPSG\",9807]],\n        PARAMETER[\"Latitude of natural origin\",49,\n            ANGLEUNIT[\"degree\",0.0174532925199433],\n            ID[\"EPSG\",8801]],\n        PARAMETER[\"Longitude of natural origin\",-2,\n            ANGLEUNIT[\"degree\",0.0174532925199433],\n            ID[\"EPSG\",8802]],\n        PARAMETER[\"Scale factor at natural origin\",0.9996012717,\n            SCALEUNIT[\"unity\",1],\n            ID[\"EPSG\",8805]],\n        PARAMETER[\"False easting\",400000,\n            LENGTHUNIT[\"metre\",1],\n            ID[\"EPSG\",8806]],\n        PARAMETER[\"False northing\",-100000,\n            LENGTHUNIT[\"metre\",1],\n            ID[\"EPSG\",8807]]],\n    CS[Cartesian,2],\n        AXIS[\"(E)\",east,\n            ORDER[1],\n            LENGTHUNIT[\"metre\",1]],\n        AXIS[\"(N)\",north,\n            ORDER[2],\n            LENGTHUNIT[\"metre\",1]],\n    USAGE[\n        SCOPE[\"Engineering survey, topographic mapping.\"],\n        AREA[\"United Kingdom (UK) - offshore to boundary of UKCS within 49°45'N to 61°N and 9°W to 2°E; onshore Great Britain (England, Wales and Scotland). Isle of Man onshore.\"],\n        BBOX[49.75,-9,61.01,2.01]],\n    ID[\"EPSG\",27700]]")
13: asMethod(object)
12: as(object, superClass)
11: bbox(object)
10: validityMethod(as(object, superClass))
9: isTRUE(x)
8: anyStrings(validityMethod(as(object, superClass)))
7: validObject(.Object)
6: initialize(value, ...)
5: initialize(value, ...)
4: new("SpatialPoints", coords = coords, bbox = bbox, proj4string = proj4string)
3: SpatialPoints(cbind(ran_points$x, ran_points$y), proj4string = raster::crs(restriction_feat))
2: st_as_sf(SpatialPoints(cbind(ran_points$x, ran_points$y), proj4string = raster::crs(restriction_feat)))
1: artif_spo(poly = boundary, n_origin = 50, restriction_feat = landuse, 
       n_foci = 5, foci_separation = 0, mfocal = NULL, conc_type = "dispersed", 
       p_ratio = 20)

with GDAL 3.5.0RC1, PROJ 9.0.0, and current raster, terra, rgdal, etc. A guess is that raster::crs(restriction_feat) no longer returns what is expected, but I haven't checked, and expect that you always update packages from which you import. The error is the same with GDAL 3.4.3 and PROJ 7.2.1.

Note also that rgdal will retire during 2023, so reworking your package should be a priority; please follow: https://github.com/r-spatial/evolution and https://r-spatial.org/r/2022/04/12/evolution.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions