@@ -34,7 +34,7 @@ read_vri <- function(dsn = NULL, layer = "VEG_R1_PLY_polygon", wkt_filter = NULL
34
34
)
35
35
36
36
if (length(wkt_filter ) > 0 ){
37
- vri_query <- vri_query | > bcdata :: filter(bcdata :: INTERSECTS(sf :: st_as_sfc(wkt_filter )))
37
+ vri_query <- vri_query | > bcdata :: filter(local( bcdata :: INTERSECTS(sf :: st_as_sfc(wkt_filter ) )))
38
38
}
39
39
40
40
vri <- bcdata :: collect(vri_query )
@@ -99,14 +99,14 @@ read_bem <- function(dsn, layer = "BEM", wkt_filter = NULL) {
99
99
dsn = dsn ,
100
100
layer = layer ,
101
101
quiet = TRUE ,
102
- wkt_filter = if (is.null(wkt_filter )) {
102
+ wkt_filter = if (is.null(wkt_filter )) {
103
103
character (0 )
104
104
} else {
105
- sf :: st_as_text(sf :: st_as_sfc(wkt_filter ))
105
+ sf :: st_as_text(sf :: st_as_sfc(wkt_filter , crs = sf :: st_crs( albers ) ))
106
106
}
107
107
)
108
108
if (length(wkt_filter ) > 0 ){
109
- bem <- sf :: st_intersection(bem ,wkt_filter )
109
+ bem <- sf :: st_intersection(bem , sf :: st_as_sfc( wkt_filter , crs = sf :: st_crs( albers )) )
110
110
}
111
111
# Restructure bem while waiting for real info
112
112
bem <- rename_geometry(bem , " Shape" )
@@ -140,7 +140,7 @@ read_wetlands <- function(dsn = NULL, layer = "FWA_WETLANDS_POLY", wkt_filter =
140
140
bcdata :: select(GEOMETRY )
141
141
142
142
if (length(wkt_filter ) > 0 ){
143
- wl_query <- wl_query | > bcdata :: filter(bcdata :: INTERSECTS(sf :: st_as_sfc(wkt_filter )))
143
+ wl_query <- wl_query | > bcdata :: filter(local( bcdata :: INTERSECTS(sf :: st_as_sfc(wkt_filter ) )))
144
144
}
145
145
wetlands <- bcdata :: collect(wl_query )
146
146
@@ -177,7 +177,7 @@ read_rivers <- function(dsn = NULL, layer = "FWA_RIVERS_POLY", wkt_filter = cha
177
177
bcdata :: select(GEOMETRY )
178
178
179
179
if (length(wkt_filter ) > 0 ){
180
- rivers_query <- rivers_query | > bcdata :: filter(bcdata :: INTERSECTS(sf :: st_as_sfc(wkt_filter )))
180
+ rivers_query <- rivers_query | > bcdata :: filter(local( bcdata :: INTERSECTS(sf :: st_as_sfc(wkt_filter ) )))
181
181
}
182
182
rivers <- bcdata :: collect(rivers_query )
183
183
@@ -213,7 +213,7 @@ read_lakes <- function(dsn = NULL, layer = "FWA_LAKES_POLY", wkt_filter = chara
213
213
bcdata :: select(GEOMETRY )
214
214
215
215
if (length(wkt_filter ) > 0 ){
216
- lakes_query <- lakes_query | > bcdata :: filter(bcdata :: INTERSECTS(sf :: st_as_sfc(wkt_filter )))
216
+ lakes_query <- lakes_query | > bcdata :: filter(local( bcdata :: INTERSECTS(sf :: st_as_sfc(wkt_filter ) )))
217
217
}
218
218
lakes <- bcdata :: collect(lakes_query )
219
219
@@ -251,7 +251,7 @@ read_glaciers <- function(dsn = NULL, layer = "BTM_PLU_V1", wkt_filter = charac
251
251
bcdata :: select(GEOMETRY )
252
252
253
253
if (length(wkt_filter ) > 0 ){
254
- glaciers_query <- glaciers_query | > bcdata :: filter(bcdata :: INTERSECTS(sf :: st_as_sfc(wkt_filter )))
254
+ glaciers_query <- glaciers_query | > bcdata :: filter(local( bcdata :: INTERSECTS(sf :: st_as_sfc(wkt_filter ) )))
255
255
}
256
256
glaciers <- bcdata :: collect(glaciers_query )
257
257
@@ -287,7 +287,7 @@ read_ccb <- function(dsn = NULL, layer = "CNS_CUT_BL_polygon", wkt_filter = cha
287
287
bcdata :: select(HARVEST_YEAR )
288
288
289
289
if (length(wkt_filter ) > 0 ){
290
- ccb_query <- ccb_query | > bcdata :: filter(bcdata :: INTERSECTS(sf :: st_as_sfc(wkt_filter )))
290
+ ccb_query <- ccb_query | > bcdata :: filter(local( bcdata :: INTERSECTS(sf :: st_as_sfc(wkt_filter ) )))
291
291
}
292
292
ccb <- bcdata :: collect(ccb_query )
293
293
@@ -323,7 +323,7 @@ read_fire <- function(dsn = NULL, layer = "WHSE_FOREST_VEGETATION_VEG_BURN_SEVER
323
323
bcdata :: select(SHAPE )
324
324
325
325
if (length(wkt_filter ) > 0 ){
326
- wl_query <- wl_query | > bcdata :: filter(bcdata :: INTERSECTS(sf :: st_as_sfc(wkt_filter )))
326
+ wl_query <- wl_query | > bcdata :: filter(local( bcdata :: INTERSECTS(sf :: st_as_sfc(wkt_filter ) )))
327
327
}
328
328
fire <- bcdata :: collect(wl_query )
329
329
@@ -385,5 +385,3 @@ read_tsa <- function(tsa_name, Skeena_boundary=TRUE){
385
385
386
386
return (aoi )
387
387
}
388
-
389
-
0 commit comments