-
Notifications
You must be signed in to change notification settings - Fork 301
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
R CMD check with R_SF_ST_READ_USE_STREAM=true #2296
Comments
Same error with released GDAL 3.8.1: |
Confirmed; the issue is that |
I will dig deeper after the kids are in bed, but I think the culprit might be the promote multi option when converting from wkb to sfc. That's implemented in wk at the moment (because sf's built in wkb parser doesn't do promote to multi if I remember correctly) |
It seems like the two interpretations of "promote to multi" are slightly different: wk seems to do this unconditionally, whereas sf seems to do this only when required. I can't find a PR where this changed...I forget how deeply I poked this when writing implementing this in library(sf)
#> Linking to GEOS 3.12.1, GDAL 3.8.3, PROJ 9.3.1; sf_use_s2() is TRUE
tf <- tempfile(fileext = ".gpkg")
data.frame(
a = 2:1,
geom = sf::st_as_sfc(c("LINESTRING EMPTY", "LINESTRING (1 2, 3 4)"))
) |>
sf::write_sf(tf)
#> writing: substituting ENGCRS["Undefined Cartesian SRS with unknown unit"] for missing CRS
sf::read_sf(tf, use_stream = FALSE, promote_to_multi = TRUE)
#> Simple feature collection with 2 features and 1 field (with 1 geometry empty)
#> Geometry type: LINESTRING
#> Dimension: XY
#> Bounding box: xmin: 1 ymin: 2 xmax: 3 ymax: 4
#> Projected CRS: Undefined Cartesian SRS with unknown unit
#> # A tibble: 2 x 2
#> a geom
#> <int> <LINESTRING>
#> 1 2 EMPTY
#> 2 1 (1 2, 3 4)
sf::read_sf(tf, use_stream = FALSE, promote_to_multi = FALSE)
#> Simple feature collection with 2 features and 1 field (with 1 geometry empty)
#> Geometry type: LINESTRING
#> Dimension: XY
#> Bounding box: xmin: 1 ymin: 2 xmax: 3 ymax: 4
#> Projected CRS: Undefined Cartesian SRS with unknown unit
#> # A tibble: 2 x 2
#> a geom
#> <int> <LINESTRING>
#> 1 2 EMPTY
#> 2 1 (1 2, 3 4)
sf::read_sf(tf, use_stream = TRUE, promote_to_multi = TRUE)
#> Simple feature collection with 2 features and 1 field (with 1 geometry empty)
#> Geometry type: MULTILINESTRING
#> Dimension: XY
#> Bounding box: xmin: 1 ymin: 2 xmax: 3 ymax: 4
#> Projected CRS: Undefined Cartesian SRS with unknown unit
#> # A tibble: 2 x 2
#> a geom
#> <int> <MULTILINESTRING>
#> 1 2 EMPTY
#> 2 1 ((1 2, 3 4))
sf::read_sf(tf, use_stream = TRUE, promote_to_multi = FALSE)
#> Simple feature collection with 2 features and 1 field (with 1 geometry empty)
#> Geometry type: LINESTRING
#> Dimension: XY
#> Bounding box: xmin: 1 ymin: 2 xmax: 3 ymax: 4
#> Projected CRS: Undefined Cartesian SRS with unknown unit
#> # A tibble: 2 x 2
#> a geom
#> <int> <LINESTRING>
#> 1 2 EMPTY
#> 2 1 (1 2, 3 4) Created on 2024-02-12 with reprex v2.1.0 |
Running
CMD check
for GDAL 3.8.2RC1, I setR_SF_ST_READ_USE_STREAM=true
, and hit a problem intests/empty.R
, lines 91-92:00check.log
I guess this is not new for GDAL 3.8.2, will check when this train gets to Bergen.
The text was updated successfully, but these errors were encountered: