Skip to content

wk_crs_projjson(sf::st_crs(...)) test failure #212

Description

@kyleam

On an Ubuntu 20.04-based system, I've hit into a wk test failure:

Error (test-pkg-sf.R:31:3): wk_crs_projjson() works for sf crs objects
Error in `expect_match(wk_crs_projjson(sf::st_crs(4326)), "GeographicCRS")`: is.character(act$val) is not TRUE
Backtrace:
    ▆
 1. └─testthat::expect_match(wk_crs_projjson(sf::st_crs(4326)), "GeographicCRS") at test-pkg-sf.R:31:3
 2.   └─base::stopifnot(is.character(act$val))

[ FAIL 1 | WARN 0 | SKIP 0 | PASS 1655 ]

I verified that I can trigger the same error with a Docker image based on rstudio/r-base:4.3.1-focal.

Dockerfile
FROM rstudio/r-base:4.3.1-focal
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
    apt-get install -y --no-install-recommends eatmydata && \
    eatmydata apt-get install -y --no-install-recommends locales && \
    echo 'en_US.UTF-8 UTF-8' >>/etc/locale.gen && locale-gen && \
    eatmydata apt-get install -y --no-install-recommends \
      git \
      libgdal-dev \
      libgeos-dev \
      libproj-dev \
      libudunits2-dev \
      sqlite3 \
      && \
    apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ARG COMMIT=24be4ac61913cba6a51eb30f1c740aed01e0222c
RUN git clone https://github.com/paleolimbot/wk.git && \
    git -C wk checkout "$COMMIT"
ARG CRAN=https://packagemanager.posit.co/cran/__linux__/focal/2023-12-14
RUN printf 'options(repos = c("CRAN"= "%s"))\n' "$CRAN" >/opt/R/4.3.1/lib/R/etc/Rprofile.site
RUN Rscript -e 'install.packages("remotes")' && \
    Rscript -e 'remotes::install_deps("wk", dependencies = TRUE, upgrade = "always")' && \
    rm -rf /tmp/R*
CMD ["Rscript", "-e", "testthat::test_local('/wk')"]

Here's what I see if I execute the R relevant code from that assertion:

> sf::st_crs(4326)
Coordinate Reference System:
  User input: EPSG:4326
  wkt:
GEOGCRS["WGS 84",
    DATUM["World Geodetic System 1984",
        ELLIPSOID["WGS 84",6378137,298.257223563,
            LENGTHUNIT["metre",1]]],
    PRIMEM["Greenwich",0,
        ANGLEUNIT["degree",0.0174532925199433]],
    CS[ellipsoidal,2],
        AXIS["geodetic latitude (Lat)",north,
            ORDER[1],
            ANGLEUNIT["degree",0.0174532925199433]],
        AXIS["geodetic longitude (Lon)",east,
            ORDER[2],
            ANGLEUNIT["degree",0.0174532925199433]],
    USAGE[
        SCOPE["unknown"],
        AREA["World"],
        BBOX[-90,-180,90,180]],
    ID["EPSG",4326]]

> wk::wk_crs_projjson(sf::st_crs(4326))
<CHARSXP: NA>

System library versions:

# apt-cache policy libproj-dev libgdal-dev libgeos-dev
libproj-dev:
  Installed: 6.3.1-1
  Candidate: 6.3.1-1
  Version table:
 *** 6.3.1-1 500
        500 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages
        100 /var/lib/dpkg/status
libgdal-dev:
  Installed: 3.0.4+dfsg-1build3
  Candidate: 3.0.4+dfsg-1build3
  Version table:
 *** 3.0.4+dfsg-1build3 500
        500 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages
        100 /var/lib/dpkg/status
libgeos-dev:
  Installed: 3.8.0-1build1
  Candidate: 3.8.0-1build1
  Version table:
 *** 3.8.0-1build1 500
        500 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages
        100 /var/lib/dpkg/status

Any idea what might be triggering the failure?

Thanks in advance

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