Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch wk_crs_projjson for GDAL < 3.1 #214

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

anthonynorth
Copy link
Contributor

Fixes wk_crs_projjson() for crs objects when GDAL < 3.1.

Closes #212

@codecov-commenter
Copy link

codecov-commenter commented Dec 18, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (030fcce) 98.85% compared to head (cf58c0e) 98.87%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #214      +/-   ##
==========================================
+ Coverage   98.85%   98.87%   +0.01%     
==========================================
  Files          85       85              
  Lines        6208     6208              
==========================================
+ Hits         6137     6138       +1     
+ Misses         71       70       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@anthonynorth
Copy link
Contributor Author

Ok that doesn't quite work. {sf} is inserting a NA_STRING, which isn't a character vector.

@paleolimbot
Copy link
Owner

Good catch that GDAL <3.1 is the problem though...I'll take a closer look soon!

@anthonynorth
Copy link
Contributor Author

This could actually be an {sf} bug and NA_STRING should be wrapped in Rf_ScalarString(NA_STRING)?

All my attempts to test for this value in R failed. We could create a C util to test for NA_STRING, but not sure we should.

@paleolimbot
Copy link
Owner

It should definitely be fixed in sf (but if it's not too much trouble to fix we should do it here, too).

@anthonynorth
Copy link
Contributor Author

Ok. The only workable solution I could come up with required a bit of C to use for the is.na() test.

SEXP wk_c_is_na_string(SEXP x) {
  return Rf_ScalarLogical(TYPEOF(x) == CHARSXP && x == NA_STRING);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

wk_crs_projjson(sf::st_crs(...)) test failure
3 participants