Skip to content

crs$wkt = NA possible? #1359

Closed
Closed
@mdsumner

Description

@mdsumner

I see obstructive error with

library(sf)
crs <- st_crs("+proj=longlat +datum=WGS84")
## assume we don't have PROJ/GDAL library available, we're preserving "input"
crs$wkt <- NA_character_ 
st_sfc(st_point(cbind(1, 1)), crs = crs)
Geometry set for 1 feature 
geometry type:  POINT
dimension:      XY
bbox:           xmin: 1 ymin: 1 xmax: 1 ymax: 1
Error in CPL_crs_parameters(x) : crs not found

and even if constructing manually, the error is pervasive:

example(read_sf)
g <- st_geometry(nc)
## again, purely simulating construction/preservation from non-PROJ/GDAL environment
attr(g, "crs")$wkt <- NA_character_ 

g
Geometry set for 100 features 
geometry type:  MULTIPOLYGON
dimension:      XY
bbox:           xmin: -84.32385 ymin: 33.88199 xmax: -75.45698 ymax: 36.58965
Error in CPL_crs_parameters(x) : crs not found

plot(g)
Error in CPL_crs_parameters(x) : crs not found

This in CRAN 0.9-1, and also in trunk. Will you consider a PR for allowing NA wkt string and non-NA input?

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