Skip to content

Commit f990016

Browse files
committed
precompile vignettes
1 parent 8a9fa43 commit f990016

14 files changed

Lines changed: 51 additions & 49 deletions

vignettes/bcdata.Rmd

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,10 @@ bcdc_search_facets(facet = "license_id")
140140
#> 11 license_id 52 Open Data Licence - Office of the Registrar of Lobbyists for British Columbia
141141
#> 12 license_id 45 Open Data Commons - Public Domain Dedication and Licence
142142
#> 13 license_id 25 King's Printer Licence - British Columbia
143-
#> 14 license_id 42 Elections BC Open Data Licence
144-
#> 15 license_id 51 BC Energy Regulator Open Data License
145-
#> 16 license_id 22 Access Only
143+
#> 14 license_id 54 ICI Society Data Sharing Licence
144+
#> 15 license_id 42 Elections BC Open Data Licence
145+
#> 16 license_id 51 BC Energy Regulator Open Data License
146+
#> 17 license_id 22 Access Only
146147
#> count
147148
#> 1 80
148149
#> 2 2
@@ -151,15 +152,16 @@ bcdc_search_facets(facet = "license_id")
151152
#> 5 5
152153
#> 6 3
153154
#> 7 62
154-
#> 8 1672
155+
#> 8 1683
155156
#> 9 2
156157
#> 10 5
157158
#> 11 1
158159
#> 12 2
159160
#> 13 1
160-
#> 14 19
161-
#> 15 5
162-
#> 16 1457
161+
#> 14 6
162+
#> 15 19
163+
#> 16 6
164+
#> 17 1447
163165
```
164166

165167
Finally, you can retrieve the _metadata_ for a single catalogue record by using the record name or permanent ID with `bcdc_get_record()`. It is advised to use the permanent ID rather than the human-readable name in non-interactive situations---like scripts---to guard against future name changes of a record:
@@ -192,7 +194,7 @@ Once you have located the B.C. Data Catalogue record with the data you want, you
192194
``` r
193195
## Get the data resource for the `bc-highwaycams` catalogue record
194196
bcdc_get_data("bc-highwaycams")
195-
#> # A tibble: 1,035 × 13
197+
#> # A tibble: 1,034 × 13
196198
#> links_bchighwaycam links_imageDisplay links_imageThumbnail links_replayTheDay id
197199
#> <chr> <chr> <chr> <chr> <dbl>
198200
#> 1 https://images.drivebc.ca/bchig… https://images.dr… https://images.driv… https://images.dr… 2
@@ -205,13 +207,13 @@ bcdc_get_data("bc-highwaycams")
205207
#> 8 https://images.drivebc.ca/bchig… https://images.dr… https://images.driv… https://images.dr… 11
206208
#> 9 https://images.drivebc.ca/bchig… https://images.dr… https://images.driv… https://images.dr… 12
207209
#> 10 https://images.drivebc.ca/bchig… https://images.dr… https://images.driv… https://images.dr… 13
208-
#> # ℹ 1,025 more rows
210+
#> # ℹ 1,024 more rows
209211
#> # ℹ 8 more variables: highway_number <chr>, highway_locationDescription <chr>, camName <chr>,
210212
#> # caption <chr>, credit <chr>, orientation <chr>, latitude <dbl>, longitude <dbl>
211213

212214
## OR use the permanent ID, which is better for scripts or non-interactive use
213215
bcdc_get_data("6b39a910-6c77-476f-ac96-7b4f18849b1c")
214-
#> # A tibble: 1,035 × 13
216+
#> # A tibble: 1,034 × 13
215217
#> links_bchighwaycam links_imageDisplay links_imageThumbnail links_replayTheDay id
216218
#> <chr> <chr> <chr> <chr> <dbl>
217219
#> 1 https://images.drivebc.ca/bchig… https://images.dr… https://images.driv… https://images.dr… 2
@@ -224,14 +226,14 @@ bcdc_get_data("6b39a910-6c77-476f-ac96-7b4f18849b1c")
224226
#> 8 https://images.drivebc.ca/bchig… https://images.dr… https://images.driv… https://images.dr… 11
225227
#> 9 https://images.drivebc.ca/bchig… https://images.dr… https://images.driv… https://images.dr… 12
226228
#> 10 https://images.drivebc.ca/bchig… https://images.dr… https://images.driv… https://images.dr… 13
227-
#> # ℹ 1,025 more rows
229+
#> # ℹ 1,024 more rows
228230
#> # ℹ 8 more variables: highway_number <chr>, highway_locationDescription <chr>, camName <chr>,
229231
#> # caption <chr>, credit <chr>, orientation <chr>, latitude <dbl>, longitude <dbl>
230232

231233
## OR use the result from bcdc_get_record()
232234
my_record <- bcdc_get_record("6b39a910-6c77-476f-ac96-7b4f18849b1c")
233235
bcdc_get_data(my_record)
234-
#> # A tibble: 1,035 × 13
236+
#> # A tibble: 1,034 × 13
235237
#> links_bchighwaycam links_imageDisplay links_imageThumbnail links_replayTheDay id
236238
#> <chr> <chr> <chr> <chr> <dbl>
237239
#> 1 https://images.drivebc.ca/bchig… https://images.dr… https://images.driv… https://images.dr… 2
@@ -244,7 +246,7 @@ bcdc_get_data(my_record)
244246
#> 8 https://images.drivebc.ca/bchig… https://images.dr… https://images.driv… https://images.dr… 11
245247
#> 9 https://images.drivebc.ca/bchig… https://images.dr… https://images.driv… https://images.dr… 12
246248
#> 10 https://images.drivebc.ca/bchig… https://images.dr… https://images.driv… https://images.dr… 13
247-
#> # ℹ 1,025 more rows
249+
#> # ℹ 1,024 more rows
248250
#> # ℹ 8 more variables: highway_number <chr>, highway_locationDescription <chr>, camName <chr>,
249251
#> # caption <chr>, credit <chr>, orientation <chr>, latitude <dbl>, longitude <dbl>
250252
```

vignettes/efficiently-query-spatial-data-in-the-bc-data-catalogue.Rmd

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Querying Spatial Data with bcdata"
3-
date: "2026-02-06"
3+
date: "2026-07-08"
44
output: rmarkdown::html_vignette
55
vignette: >
66
%\VignetteIndexEntry{Querying Spatial Data with bcdata}
@@ -194,28 +194,28 @@ Again we recognize this is [WFS-enabled](https://en.wikipedia.org/wiki/Web_Featu
194194
``` r
195195
bcdc_query_geodata("6a2fea1b-0cc4-4fc2-8017-eaf755d516da")
196196
#> Querying 'local-and-regional-greenspaces' record
197-
#> • Using collect() on this object will return 9212 features and 19 fields
197+
#> • Using collect() on this object will return 9488 features and 19 fields
198198
#> • At most six rows of the record are printed here
199199
#> ────────────────────────────────────────────────────────────────────────────────────────────────────
200200
#> Simple feature collection with 6 features and 19 fields
201-
#> Geometry type: POLYGON
201+
#> Geometry type: MULTIPOLYGON
202202
#> Dimension: XY
203-
#> Bounding box: xmin: 1205933 ymin: 459093.3 xmax: 1212220 ymax: 460485.6
203+
#> Bounding box: xmin: 1205812 ymin: 461894.2 xmax: 1210343 ymax: 463217.4
204204
#> Projected CRS: NAD83 / BC Albers
205205
#> # A tibble: 6 × 20
206206
#> id LOCAL_REG_GREENSPACE…¹ PARK_NAME PARK_TYPE PARK_PRIMARY_USE REGIONAL_DISTRICT MUNICIPALITY
207207
#> <chr> <int> <chr> <chr> <chr> <chr> <chr>
208-
#> 1 WHSE_B… 49 Woodward… Local Park Metro Vancouver Richmond
209-
#> 2 WHSE_B… 50 Woodward… Local Park Metro Vancouver Richmond
210-
#> 3 WHSE_B… 51 Doggie P… Local Park Metro Vancouver Richmond
211-
#> 4 WHSE_B… 52 Bike Ter… Local Athletic Metro Vancouver Richmond
212-
#> 5 WHSE_B… 53 Great We… Local Trail Metro Vancouver Richmond
213-
#> 6 WHSE_B… 54 Imperial… Local Park Metro Vancouver Richmond
208+
#> 1 WHSE_B… 40 Wowk Nei… Local Park Metro Vancouver Richmond
209+
#> 2 WHSE_B… 41 Hugh Boy… Local Park Metro Vancouver Richmond
210+
#> 3 WHSE_B… 42 Sandifor… Local Park Metro Vancouver Richmond
211+
#> 4 WHSE_B… 43 Kozier N… Local Park Metro Vancouver Richmond
212+
#> 5 WHSE_B… 44 Maple La… Local Park Metro Vancouver Richmond
213+
#> 6 WHSE_B… 45 South Ar… Local Park Metro Vancouver Richmond
214214
#> # ℹ abbreviated name: ¹​LOCAL_REG_GREENSPACE_ID
215215
#> # ℹ 13 more variables: CIVIC_NUMBER <int>, CIVIC_NUMBER_SUFFIX <chr>, STREET_NAME <chr>,
216216
#> # LATITUDE <dbl>, LONGITUDE <dbl>, WHEN_UPDATED <date>, WEBSITE_URL <chr>,
217217
#> # LICENCE_COMMENTS <chr>, FEATURE_AREA_SQM <dbl>, FEATURE_LENGTH_M <dbl>, OBJECTID <int>,
218-
#> # SE_ANNO_CAD_DATA <chr>, geometry <POLYGON [m]>
218+
#> # SE_ANNO_CAD_DATA <chr>, geometry <MULTIPOLYGON [m]>
219219
```
220220

221221
Since we are interested in only "Park" data we can subset our query:
@@ -225,28 +225,28 @@ Since we are interested in only "Park" data we can subset our query:
225225
bcdc_query_geodata("6a2fea1b-0cc4-4fc2-8017-eaf755d516da") %>%
226226
filter(PARK_PRIMARY_USE == "Park")
227227
#> Querying 'local-and-regional-greenspaces' record
228-
#> • Using collect() on this object will return 4528 features and 19 fields
228+
#> • Using collect() on this object will return 4590 features and 19 fields
229229
#> • At most six rows of the record are printed here
230230
#> ────────────────────────────────────────────────────────────────────────────────────────────────────
231231
#> Simple feature collection with 6 features and 19 fields
232-
#> Geometry type: POLYGON
232+
#> Geometry type: MULTIPOLYGON
233233
#> Dimension: XY
234-
#> Bounding box: xmin: 1205029 ymin: 459093.3 xmax: 1212220 ymax: 461188.7
234+
#> Bounding box: xmin: 1205812 ymin: 461894.2 xmax: 1210343 ymax: 463217.4
235235
#> Projected CRS: NAD83 / BC Albers
236236
#> # A tibble: 6 × 20
237237
#> id LOCAL_REG_GREENSPACE…¹ PARK_NAME PARK_TYPE PARK_PRIMARY_USE REGIONAL_DISTRICT MUNICIPALITY
238238
#> <chr> <int> <chr> <chr> <chr> <chr> <chr>
239-
#> 1 WHSE_B… 49 Woodward… Local Park Metro Vancouver Richmond
240-
#> 2 WHSE_B… 50 Woodward… Local Park Metro Vancouver Richmond
241-
#> 3 WHSE_B… 51 Doggie P… Local Park Metro Vancouver Richmond
242-
#> 4 WHSE_B… 54 Imperial… Local Park Metro Vancouver Richmond
243-
#> 5 WHSE_B… 55 Stevesto… Local Park Metro Vancouver Richmond
244-
#> 6 WHSE_B… 56 Mariner'… Local Park Metro Vancouver Richmond
239+
#> 1 WHSE_B… 40 Wowk Nei… Local Park Metro Vancouver Richmond
240+
#> 2 WHSE_B… 41 Hugh Boy… Local Park Metro Vancouver Richmond
241+
#> 3 WHSE_B… 42 Sandifor… Local Park Metro Vancouver Richmond
242+
#> 4 WHSE_B… 43 Kozier N… Local Park Metro Vancouver Richmond
243+
#> 5 WHSE_B… 44 Maple La… Local Park Metro Vancouver Richmond
244+
#> 6 WHSE_B… 45 South Ar… Local Park Metro Vancouver Richmond
245245
#> # ℹ abbreviated name: ¹​LOCAL_REG_GREENSPACE_ID
246246
#> # ℹ 13 more variables: CIVIC_NUMBER <int>, CIVIC_NUMBER_SUFFIX <chr>, STREET_NAME <chr>,
247247
#> # LATITUDE <dbl>, LONGITUDE <dbl>, WHEN_UPDATED <date>, WEBSITE_URL <chr>,
248248
#> # LICENCE_COMMENTS <chr>, FEATURE_AREA_SQM <dbl>, FEATURE_LENGTH_M <dbl>, OBJECTID <int>,
249-
#> # SE_ANNO_CAD_DATA <chr>, geometry <POLYGON [m]>
249+
#> # SE_ANNO_CAD_DATA <chr>, geometry <MULTIPOLYGON [m]>
250250
```
251251

252252
Here we see that this greatly reduces the number of features that we are dealing with (and correspondingly the amount of data that needs to be transferred over the web). Remember also that we still have not actually requested the full data set. This is just still a preview. Also this query still includes all municipal parks in BC while we only want the ones in the three school districts - the polygons defined by the `districts` object. To find that subset of parks we can make use of the built-in geometric operators which allow us to perform spatial operations remotely fine tuning our query even further. Here using the `INTERSECTS` function is appropriate and since this is a last tuning step, we can call `collect` and assign a name to this object. These requests can sometimes take quite a long:

vignettes/explore-silviculture-data-using-bcdata.Rmd

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Exploring Silviculture Data with bcdata"
3-
date: "2026-02-06"
3+
date: "2026-07-08"
44
output: rmarkdown::html_vignette
55
vignette: >
66
%\VignetteIndexEntry{Exploring Silviculture Data with bcdata}
@@ -88,8 +88,8 @@ We see that this is a [Web Feature Service-enabled](https://en.wikipedia.org/wik
8888
# Query the data using the permanent ID of the record to guard against name changes
8989
bcdc_query_geodata("258bb088-4113-47b1-b568-ce20bd64e3e3")
9090
#> Querying 'results-forest-cover-silviculture' record
91-
#> • Using collect() on this object will return 976169 features and 159 fields
92-
#> • Accessing this record requires pagination and will make 98 separate requests to the WFS.
91+
#> • Using collect() on this object will return 984709 features and 159 fields
92+
#> • Accessing this record requires pagination and will make 99 separate requests to the WFS.
9393
#> • See ?bcdc_options
9494
#> • At most six rows of the record are printed here
9595
#> ────────────────────────────────────────────────────────────────────────────────────────────────────
@@ -182,7 +182,7 @@ Let's look at the dimensions of this now much more manageable data object we hav
182182

183183
``` r
184184
dim(trees_dpg)
185-
#> [1] 253 160
185+
#> [1] 259 160
186186
```
187187

188188
We can see there are several treatment units planted with western larch, and we can make a quick map of these harvested openings for the Prince George Natural Resource District:

vignettes/local-filter.Rmd

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Update to `filter()` behaviour in bcdata v0.4.0"
3-
date: "2026-02-06"
3+
date: "2026-07-08"
44
output: rmarkdown::html_vignette
55
vignette: >
66
%\VignetteIndexEntry{Update to `filter()` behaviour in bcdata v0.4.0}
@@ -73,24 +73,24 @@ bcdc_query_geodata("local-and-regional-greenspaces") %>%
7373
## • At most six rows of the record are printed here
7474
## ────────────────────────────────────────────────────────────────────────────────────────────────────
7575
## Simple feature collection with 6 features and 19 fields
76-
## Geometry type: POLYGON
76+
## Geometry type: MULTIPOLYGON
7777
## Dimension: XY
78-
## Bounding box: xmin: 1187080 ymin: 409342.1 xmax: 1191300 ymax: 410578
78+
## Bounding box: xmin: 1199043 ymin: 387901.5 xmax: 1199503 ymax: 390352.7
7979
## Projected CRS: NAD83 / BC Albers
8080
## # A tibble: 6 × 20
8181
## id LOCAL_REG_GREENSPACE…¹ PARK_NAME PARK_TYPE PARK_PRIMARY_USE REGIONAL_DISTRICT MUNICIPALITY
8282
## <chr> <int> <chr> <chr> <chr> <chr> <chr>
83-
## 1 WHSE_B… 8423 Lillian … Local Park Capital North Saani
84-
## 2 WHSE_B… 8422 Nymph Po… Local Park Capital North Saani
85-
## 3 WHSE_B… 8447 H.M.S. P… Local Park Capital North Saani
86-
## 4 WHSE_B… 8434 Wain Park Local Park Capital North Saani
87-
## 5 WHSE_B… 8446 Prentice… Local Park Capital North Saani
88-
## 6 WHSE_B… 8448 <NA> Local Park Capital North Saani
83+
## 1 WHSE_B… 7806 Beach Ac… Local Water Access Capital District of
84+
## 2 WHSE_B… 8020 Balmacar… Local Water Access Capital District of
85+
## 3 WHSE_B… 7871 Vantreig… Local Park Capital District of
86+
## 4 WHSE_B… 7844 Montague… Local Park Capital District of
87+
## 5 WHSE_B… 7882 Houlihan… Local Park Capital District of
88+
## 6 WHSE_B… 7895 Casa Mar… Local Green Space Capital District of
8989
## # ℹ abbreviated name: ¹​LOCAL_REG_GREENSPACE_ID
90-
## # ℹ 13 more variables: CIVIC_NUMBER <int>, CIVIC_NUMBER_SUFFIX <chr>, STREET_NAME <chr>,
90+
## # ℹ 13 more variables: CIVIC_NUMBER <chr>, CIVIC_NUMBER_SUFFIX <chr>, STREET_NAME <chr>,
9191
## # LATITUDE <dbl>, LONGITUDE <dbl>, WHEN_UPDATED <date>, WEBSITE_URL <chr>,
9292
## # LICENCE_COMMENTS <chr>, FEATURE_AREA_SQM <dbl>, FEATURE_LENGTH_M <dbl>, OBJECTID <int>,
93-
## # SE_ANNO_CAD_DATA <chr>, geometry <POLYGON [m]>
93+
## # SE_ANNO_CAD_DATA <chr>, geometry <MULTIPOLYGON [m]>
9494
```
9595

9696
There is another illustration in the ["querying spatial data vignette"](https://bcgov.github.io/bcdata/articles/efficiently-query-spatial-data-in-the-bc-data-catalogue.html#a-note-about-using-local-r-functions-in-constructing-filter-queries).
-1.76 KB
Loading

vignettes/vignette-fig-bbox-1.png

-281 Bytes
Loading
-219 Bytes
Loading
-258 Bytes
Loading
-259 Bytes
Loading
-2.77 KB
Loading

0 commit comments

Comments
 (0)