looks like not just an R issue as won't load (see Invalid Data Source warning)
Seems to be a Z dimension (elevation) issue potentially due to a mix of some Z mulitline strings and some not. Tip off was error when trying to plot in R
> path_stub <- "~/Library/CloudStorage/OneDrive-Personal/Projects/2024-073-sern-peace/data/bulltrout_williston"
> filename_spawn <- "BT_Williston_critical_spawning_segments_230112.shp"
> path <- fs::path(path_stub, filename_spawn)
> bt_spawn <- sf::st_read(path)
Reading layer `BT_Williston_critical_spawning_segments_230112' from data source
`/Users/airvine/Library/CloudStorage/OneDrive-Personal/Projects/2024-073-sern-peace/data/bulltrout_williston/BT_Williston_critical_spawning_segments_230112.shp'
using driver `ESRI Shapefile'
Simple feature collection with 110 features and 37 fields
Geometry type: MULTILINESTRING
Dimension: XY, XYZ
Bounding box: xmin: 926382 ymin: 1073716 xmax: 1280647 ymax: 1406620
z_range: zmin: 0 zmax: 1573
Projected CRS: NAD83 / BC Albers
> # plot with ggplot2
> ggplot(bt_spawn) +
+ geom_sf()
Error in `geom_sf()`:
! Problem while converting geom to grob.
ℹ Error occurred in the 1st layer.
Caused by error in `scan()`:
! scan() expected 'a real', got 'ParseException:'
Run `rlang::last_trace()` to see where the error occurred.
There were 50 or more warnings (use warnings() to see the first 50)
Error in `geom_sf()`:
! Problem while converting geom to grob.
ℹ Error occurred in the 1st layer.
Caused by error:
! ParseException: Unknown WKB type 331
Workaround is to remove the Z dimension with sf::st_zm()
looks like not just an R issue as won't load (see Invalid Data Source warning)
Seems to be a Z dimension (elevation) issue potentially due to a mix of some Z mulitline strings and some not. Tip off was error when trying to plot in R
Workaround is to remove the Z dimension with sf::st_zm()