Skip to content

Should sp::CRS() cache CRS objects? #99

@rsbivand

Description

@rsbivand

In debugging the failure of spatsoc on PROJ 8.0.0 ropensci/spatsoc#34 which turned out to be a false warning from rgdal because verbatim "DATUM" was missing from the WKT2 representation (for WGS84, it says ENSEMBLE, not DATUM), I saw https://github.com/ropensci/spatsoc/blob/f333bbe8c772b9d4c64d6edfcd3bd464d5f6b68e/R/build_lines.R#L134-L142, with calls to sp::CRS() in an lapply(). From Rprof(), the churn through rgdal::checkCRSArgs_ng() to Call() is significant. The argument to sp::CRS() is here always the same.

Shall I start on drafting code for caching returned "CRS" objects? Might this extend to sf too? My initial take would be based on parseGRASS() caching in rgrass7 https://github.com/rsbivand/rgrass7/blob/911dad09e253025cfa304dc3dd6f17b8afd808ed/R/xml1.R#L1-L130, where the lookup is done if the input argument is matched in list names.

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