layout: true --- class: middle, inverse, no-number .left-title[ <img src="https://github.com/bcgov/bcdata/raw/master/inst/sticker/bcdata.png" alt="bcdata" /> ] .large.right-title[ <br><br><br> Sam Albers Stephanie Hazlitt Andy Teucher ------ Exchange Lab Lunch and Learn 2019-03-26 ] --- class: inverse background-image: url(http://vietkings.org/userfiles/Parthenon.jpg) # Pillars of Data Science -- ## Data Acquisition -- ## Data Processing -- ## Machine Learning & Statistics -- ## Analytics -- ## Communication --- class: middle, inverse .pull-left[ # A workflow? ] .pull-right[ ![](img/workflow.png) ] --- class: middle, inverse background-image: url(https://images.unsplash.com/photo-1497002961800-ea7dbfe18696?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1352&q=80) # What happens when you are asked to reproduce an analysis? --- class: middle, inverse background-image: url(https://images.unsplash.com/photo-1497002961800-ea7dbfe18696?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1352&q=80) # Can you replicate the analysis with different data? --- class: middle, inverse background-image: url(https://images.unsplash.com/photo-1497002961800-ea7dbfe18696?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1352&q=80) # What happens when a data-driven decision is audited? --- background-image: url(img/data-science-workflow.png) # Auditable, Replicable and Reproducible .footnote[https://rstudio-education.github.io/tidyverse-cookbook/] --- # Write your analysis in code .pull-left[ <img src="https://www.python.org/static/community_logos/python-logo-master-v3-TM.png" alt="python" style="width:800px;"/> ] .pull-right[ <img src="https://www.r-project.org/logo/Rlogo.png" alt="python" style="width:300px;"/> ] ??? # What is R? - R is an open-source programming language for data analysis and visualization. - In many ways it is similar to other general purpose languages like Python - originally created as a statistical programming language - designed from the ground up around the manipulation, analysis, and visualization of data - easy to make publication-quality graphics. - available for Windows, MacOS and most popular Linux distributions. - You can run it interactively by typing directly into the console, or from a sequence of commands written in scripts. - Scripts can be run against a dataset to produce a defined output, such as a chart or another dataset which contains the results of the analysis. - Most common languages are python, R, C++, Java - Open source programming languages - Data analysis focus - Cross-platform --- class: inverse, middle background-image: url(https://images.unsplash.com/photo-1515879218367-8466d910aaa4?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1950&q=80) background-size: cover # POLL: What programming languages do people use? --- class: inverse background-image: url(https://www.herocollector.com/Content/ArticleImages/7a716739-72cb-40d5-acfc-dfc35783d8a5.jpg) background-size: cover # How do we reduce the cognitive load for interactive programming? --- # dplyr <center><img src="https://raw.githubusercontent.com/allisonhorst/stats-illustrations/master/rstats-artwork/dplyr_wrangling.png" style="width: 700px;"/></center> .footnote[Artwork by [@allison_horst](https://twitter.com/allison_horst)] --- class: inverse, left, middle # dplyr code break --- background-image: url(img/data-science-workflow-not.png) # Not Auditable, Replicable and Reproducible .footnote[https://rstudio-education.github.io/tidyverse-cookbook/] ??? # Why R? The entire workflow can be done efficiently in **R**, including: - reading in raw data from many different sources - spatial and non-spatial, - preparing the data for analysis, including easily integrating tabular and spatial data, - performing spatial data manipulation and analysis, - performing statistical analysis - creating publication-quality graphs and figures. - All your iteration happens in one place, and is recorded in scripts - **enables reproducible, repeatable, shareable analysis** v --- class: middle, inverse background-image: url(https://i.imgur.com/modde9i.gif) background-size: cover # make your data available in code --- class: inverse background-image: url(https://upload.wikimedia.org/wikipedia/commons/d/d5/British_Columbia_Parliament_Building%2C_Victoria%2C_British_Columbia%2C_Canada.jpg) background-size: cover # Pillars of Data Science in BC Government ## <span style="color:#e3a82b">Data Acquisition</span> ## Data Processing ## Machine Learning & Statistics ## Analytics ## Communication --- class: inverse, middle background-image: url(https://images.unsplash.com/photo-1511721285502-9f81e79be874?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1868&q=80) background-size: cover # POLL: When was the last time you used the B.C. Data Catalogue? --- background-image: url(img/data-catalogue.png) background-size: cover --- background-image: url(img/dds.png) background-size: cover ??? BCGW Data Distribution Service Way better than it was before - Still a manual process - GUI - Can't be scripted, not repeatable --- class: inverse # What's the problem here? -- ## Not getting the data through code --- # Application Programming Interfaces (APIs) ![](img/bc_api.png) ??? APIs Data BC provides important APIs: - the catalogue - search and query data in the catalogue - Web mapping service - download spatial data - image overlay (WMS) OR the features themselves as points, lines, polygons (WFS) - most warehouse objects with public record in the catalogue --- class: middle .Large.pull-left[ # Let's make a package one function() two function() I need a function() ] .pull-right[ ![](img/rfbf.png) ] ??? - As with most FOSS projects, initially made to solve personal problem, and several people had the same problem - Solve (shared) friction point of manual searching and downloading data from BCDC and getting it into R - conversation --- class: inverse .pull-left[ # What can bcdata do? ## Search records in the catalogue ## Open a browser in R ## Get data ] .pull-right[ <img src="https://github.com/bcgov/bcdata/raw/master/inst/sticker/bcdata.png" alt="bcdata" /> ] ??? - Collaboration - first R package (personally) - sat in a room with a whiteboard and mapped out desired functionality and syntax - Great approach - Think landed in a good place - **Today focus on _getting_ data** --- ## bcdc_get_data() - tabular ```r bcdc_get_data(record = "major-projects-inventory-economic-points", resource = '2b69cc4b-4076-4272-a5a0-1c731455e063') ``` <PRE class="fansi fansi-output"><CODE><span style='color: #555555;'># A tibble: 966 x 39</span><span> PROJECT_ID PROJECT_NAME PROJECT_DESCRIP~ ESTIMATED_COST UPDATE_ACTIVITY </span><span style='color: #555555;font-style: italic;'><dbl></span><span> </span><span style='color: #555555;font-style: italic;'><chr></span><span> </span><span style='color: #555555;font-style: italic;'><chr></span><span> </span><span style='color: #555555;font-style: italic;'><dbl></span><span> </span><span style='color: #555555;font-style: italic;'><chr></span><span> </span><span style='color: #555555;'> 1</span><span> </span><span style='text-decoration: underline;'>4</span><span>088 Barclay x T~ Proposed 105-un~ 60 New proposed p~ </span><span style='color: #555555;'> 2</span><span> </span><span style='text-decoration: underline;'>4</span><span>071 Valley View~ Addition of 525~ 34 New proposed p~ </span><span style='color: #555555;'> 3</span><span> </span><span style='text-decoration: underline;'>4</span><span>089 Fifteen Fif~ Proposed 42 sto~ 20 </span><span style='color: #BB0000;'>NA</span><span> </span><span style='color: #555555;'> 4</span><span> </span><span style='text-decoration: underline;'>4</span><span>075 Sheffield E~ Proposed elemen~ 52 New proposed p~ </span><span style='color: #555555;'> 5</span><span> </span><span style='text-decoration: underline;'>4</span><span>076 Highway 1 Q~ Replacement of ~ 121 New proposed p~ </span><span style='color: #555555;'> 6</span><span> </span><span style='text-decoration: underline;'>4</span><span>078 Kootenay La~ Improvements to~ </span><span style='color: #BB0000;'>NA</span><span> New proposed p~ </span><span style='color: #555555;'> 7</span><span> </span><span style='text-decoration: underline;'>4</span><span>074 Highway 1 W~ Proposed wideni~ 236 New proposed p~ </span><span style='color: #555555;'> 8</span><span> </span><span style='text-decoration: underline;'>4</span><span>087 Beverly Con~ Development of ~ 18 New proposed p~ </span><span style='color: #555555;'> 9</span><span> </span><span style='text-decoration: underline;'>4</span><span>072 Kootenay Bo~ A new ambulator~ 39 New proposed p~ </span><span style='color: #555555;'>10</span><span> </span><span style='text-decoration: underline;'>4</span><span>077 Highway 14 ~ Improvements to~ 86 New proposed p~ </span><span style='color: #555555;'># ... with 956 more rows, and 34 more variables: ENVIRONMENTAL_ASSESSMENT_STAGE </span><span style='color: #555555;font-style: italic;'><chr></span><span style='color: #555555;'>, # CONSTRUCTION_TYPE </span><span style='color: #555555;font-style: italic;'><chr></span><span style='color: #555555;'>, CONSTRUCTION_SUBTYPE </span><span style='color: #555555;font-style: italic;'><chr></span><span style='color: #555555;'>, PROJECT_TYPE </span><span style='color: #555555;font-style: italic;'><chr></span><span style='color: #555555;'>, # REGION </span><span style='color: #555555;font-style: italic;'><chr></span><span style='color: #555555;'>, MUNICIPALITY </span><span style='color: #555555;font-style: italic;'><chr></span><span style='color: #555555;'>, DEVELOPER </span><span style='color: #555555;font-style: italic;'><chr></span><span style='color: #555555;'>, ARCHITECT </span><span style='color: #555555;font-style: italic;'><chr></span><span style='color: #555555;'>, # PROJECT_STATUS </span><span style='color: #555555;font-style: italic;'><chr></span><span style='color: #555555;'>, PROJECT_STAGE </span><span style='color: #555555;font-style: italic;'><chr></span><span style='color: #555555;'>, PROJECT_CATEGORY_NAME </span><span style='color: #555555;font-style: italic;'><chr></span><span style='color: #555555;'>, # PUBLIC_FUNDING_IND </span><span style='color: #555555;font-style: italic;'><lgl></span><span style='color: #555555;'>, PROVINVIAL_FUNDING </span><span style='color: #555555;font-style: italic;'><lgl></span><span style='color: #555555;'>, FEDERAL_FUNDING </span><span style='color: #555555;font-style: italic;'><lgl></span><span style='color: #555555;'>, # MUNICIPAL_FUNDING </span><span style='color: #555555;font-style: italic;'><lgl></span><span style='color: #555555;'>, OTHER_PUBLIC_FUNDING </span><span style='color: #555555;font-style: italic;'><lgl></span><span style='color: #555555;'>, GREEN_BUILDING_IND </span><span style='color: #555555;font-style: italic;'><lgl></span><span style='color: #555555;'>, # GREEN_BUILDING_DESC </span><span style='color: #555555;font-style: italic;'><chr></span><span style='color: #555555;'>, CLEAN_ENERGY_IND </span><span style='color: #555555;font-style: italic;'><lgl></span><span style='color: #555555;'>, INDIGENOUS_IND </span><span style='color: #555555;font-style: italic;'><lgl></span><span style='color: #555555;'>, # INDIGENOUS_NAMES </span><span style='color: #555555;font-style: italic;'><chr></span><span style='color: #555555;'>, INDIGENOUS_AGREEMENT </span><span style='color: #555555;font-style: italic;'><chr></span><span style='color: #555555;'>, CONSTRUCTION_JOBS </span><span style='color: #555555;font-style: italic;'><dbl></span><span style='color: #555555;'>, # OPERATING_JOBS </span><span style='color: #555555;font-style: italic;'><dbl></span><span style='color: #555555;'>, STANDARDIZED_START_DATE </span><span style='color: #555555;font-style: italic;'><chr></span><span style='color: #555555;'>, # STANDARDIZED_COMPLETION_DATE </span><span style='color: #555555;font-style: italic;'><chr></span><span style='color: #555555;'>, LATITUDE </span><span style='color: #555555;font-style: italic;'><dbl></span><span style='color: #555555;'>, LONGITUDE </span><span style='color: #555555;font-style: italic;'><dbl></span><span style='color: #555555;'>, # LATITUDE_DMS </span><span style='color: #555555;font-style: italic;'><chr></span><span style='color: #555555;'>, LONGITUDE_DMS </span><span style='color: #555555;font-style: italic;'><chr></span><span style='color: #555555;'>, TELEPHONE </span><span style='color: #555555;font-style: italic;'><chr></span><span style='color: #555555;'>, PROJECT_WEBSITE </span><span style='color: #555555;font-style: italic;'><chr></span><span style='color: #555555;'>, # FIRST_ENTRY_DATE </span><span style='color: #555555;font-style: italic;'><date></span><span style='color: #555555;'>, LAST_UPDATE </span><span style='color: #555555;font-style: italic;'><date></span><span> </span></CODE></PRE> --- ## Major Projects in British Columbia ![](graphics/prod/figsunnamed-chunk-5-1.png)<!-- --> --- ## bcdc_query_geodata() - spatial data ```r bcdc_query_geodata("municipalities-legally-defined-administrative-areas-of-bc") ``` <PRE class="fansi fansi-output"><CODE>Querying <span style='color: #BB0000;'>'municipalities-legally-defined-administrative-areas-of-bc'</span><span> record * Using </span><span style='color: #0000BB;'>collect()</span><span> on this object will return </span><span style='color: #00BB00;'>161</span><span> features and </span><span style='color: #00BB00;'>17</span><span> fields * At most six rows of the record are printed here ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- Simple feature collection with 6 features and 17 fields geometry type: MULTIPOLYGON dimension: XY bbox: xmin: 982247.4 ymin: 544632.7 xmax: 1480241 ymax: 1113853 epsg (SRID): 3005 proj4string: +proj=aea +lat_1=50 +lat_2=58.5 +lat_0=45 +lon_0=-126 +x_0=1000000 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs </span><span style='color: #555555;'># A tibble: 6 x 18</span><span> id LGL_ADMIN_AREA_~ ADMIN_AREA_NAME ADMIN_AREA_ABBR~ ADMIN_AREA_BOUN~ ADMIN_AREA_TYPE </span><span style='color: #555555;font-style: italic;'><chr></span><span> </span><span style='color: #555555;font-style: italic;'><int></span><span> </span><span style='color: #555555;font-style: italic;'><chr></span><span> </span><span style='color: #555555;font-style: italic;'><chr></span><span> </span><span style='color: #555555;font-style: italic;'><chr></span><span> </span><span style='color: #555555;font-style: italic;'><chr></span><span> </span><span style='color: #555555;'>1</span><span> WHSE~ 3 The Corporatio~ Burns Lake Legal Municipality </span><span style='color: #555555;'>2</span><span> WHSE~ 4 District of Fo~ Fort St James Legal Municipality </span><span style='color: #555555;'>3</span><span> WHSE~ 5 Village of Fra~ Fraser Lake Legal Municipality </span><span style='color: #555555;'>4</span><span> WHSE~ 6 Village of Gra~ Granisle Legal Municipality </span><span style='color: #555555;'>5</span><span> WHSE~ 84 District of La~ Lake Country Legal Municipality </span><span style='color: #555555;'>6</span><span> WHSE~ 85 The Corporatio~ Peachland Legal Municipality </span><span style='color: #555555;'># ... with 12 more variables: ADMIN_AREA_GROUP_NAME </span><span style='color: #555555;font-style: italic;'><chr></span><span style='color: #555555;'>, CHANGE_REQUESTED_ORG </span><span style='color: #555555;font-style: italic;'><chr></span><span style='color: #555555;'>, # UPDATE_TYPE </span><span style='color: #555555;font-style: italic;'><chr></span><span style='color: #555555;'>, WHEN_UPDATED </span><span style='color: #555555;font-style: italic;'><chr></span><span style='color: #555555;'>, OIC_NUMBER </span><span style='color: #555555;font-style: italic;'><chr></span><span style='color: #555555;'>, OIC_YEAR </span><span style='color: #555555;font-style: italic;'><chr></span><span style='color: #555555;'>, # AFFECTED_ADMIN_AREA_ABRVN </span><span style='color: #555555;font-style: italic;'><chr></span><span style='color: #555555;'>, FEATURE_AREA_SQM </span><span style='color: #555555;font-style: italic;'><dbl></span><span style='color: #555555;'>, FEATURE_LENGTH_M </span><span style='color: #555555;font-style: italic;'><dbl></span><span style='color: #555555;'>, # OBJECTID </span><span style='color: #555555;font-style: italic;'><int></span><span style='color: #555555;'>, SE_ANNO_CAD_DATA </span><span style='color: #555555;font-style: italic;'><chr></span><span style='color: #555555;'>, geometry </span><span style='color: #555555;font-style: italic;'><MULTIPOLYGON [m]></span><span> </span></CODE></PRE> --- class: inverse, left, middle # bcdata code break --- ## Select columns (attributes) with select() ```r bcdc_query_geodata("municipalities-legally-defined-administrative-areas-of-bc") %>% * select(ADMIN_AREA_ABBREVIATION, ADMIN_AREA_GROUP_NAME) ``` <PRE class="fansi fansi-output"><CODE>Querying <span style='color: #BB0000;'>'municipalities-legally-defined-administrative-areas-of-bc'</span><span> record * Using </span><span style='color: #0000BB;'>collect()</span><span> on this object will return </span><span style='color: #00BB00;'>161</span><span> features and </span><span style='color: #00BB00;'>5</span><span> fields * At most six rows of the record are printed here ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- Simple feature collection with 6 features and 5 fields geometry type: MULTIPOLYGON dimension: XY bbox: xmin: 982247.4 ymin: 544632.7 xmax: 1480241 ymax: 1113853 epsg (SRID): 3005 proj4string: +proj=aea +lat_1=50 +lat_2=58.5 +lat_0=45 +lon_0=-126 +x_0=1000000 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs </span><span style='color: #555555;'># A tibble: 6 x 6</span><span> id LGL_ADMIN_AREA_~ ADMIN_AREA_ABBR~ ADMIN_AREA_GROU~ OBJECTID </span><span style='color: #555555;font-style: italic;'><chr></span><span> </span><span style='color: #555555;font-style: italic;'><int></span><span> </span><span style='color: #555555;font-style: italic;'><chr></span><span> </span><span style='color: #555555;font-style: italic;'><chr></span><span> </span><span style='color: #555555;font-style: italic;'><int></span><span> </span><span style='color: #555555;'>1</span><span> WHSE~ 3 Burns Lake Regional Distri~ </span><span style='text-decoration: underline;'>30</span><span>085 </span><span style='color: #555555;'>2</span><span> WHSE~ 4 Fort St James Regional Distri~ </span><span style='text-decoration: underline;'>30</span><span>086 </span><span style='color: #555555;'>3</span><span> WHSE~ 5 Fraser Lake Regional Distri~ </span><span style='text-decoration: underline;'>30</span><span>087 </span><span style='color: #555555;'>4</span><span> WHSE~ 6 Granisle Regional Distri~ </span><span style='text-decoration: underline;'>30</span><span>088 </span><span style='color: #555555;'>5</span><span> WHSE~ 84 Lake Country Regional Distri~ </span><span style='text-decoration: underline;'>30</span><span>120 </span><span style='color: #555555;'>6</span><span> WHSE~ 85 Peachland Regional Distri~ </span><span style='text-decoration: underline;'>30</span><span>121 </span><span style='color: #555555;'># ... with 1 more variable: geometry </span><span style='color: #555555;font-style: italic;'><MULTIPOLYGON [m]></span><span> </span></CODE></PRE> ??? Familiar syntax Processing on server --- ## Filter rows (features) with filter() ```r bcdc_query_geodata("municipalities-legally-defined-administrative-areas-of-bc") %>% select(ADMIN_AREA_ABBREVIATION, ADMIN_AREA_GROUP_NAME) %>% * filter(ADMIN_AREA_GROUP_NAME == "Capital Regional District") ``` <PRE class="fansi fansi-output"><CODE>Querying <span style='color: #BB0000;'>'municipalities-legally-defined-administrative-areas-of-bc'</span><span> record * Using </span><span style='color: #0000BB;'>collect()</span><span> on this object will return </span><span style='color: #00BB00;'>13</span><span> features and </span><span style='color: #00BB00;'>5</span><span> fields * At most six rows of the record are printed here ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- Simple feature collection with 6 features and 5 fields geometry type: MULTIPOLYGON dimension: XY bbox: xmin: 1174651 ymin: 368738.7 xmax: 1195365 ymax: 403223.9 epsg (SRID): 3005 proj4string: +proj=aea +lat_1=50 +lat_2=58.5 +lat_0=45 +lon_0=-126 +x_0=1000000 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs </span><span style='color: #555555;'># A tibble: 6 x 6</span><span> id LGL_ADMIN_AREA_~ ADMIN_AREA_ABBR~ ADMIN_AREA_GROU~ OBJECTID </span><span style='color: #555555;font-style: italic;'><chr></span><span> </span><span style='color: #555555;font-style: italic;'><int></span><span> </span><span style='color: #555555;font-style: italic;'><chr></span><span> </span><span style='color: #555555;font-style: italic;'><chr></span><span> </span><span style='color: #555555;font-style: italic;'><int></span><span> </span><span style='color: #555555;'>1</span><span> WHSE~ 258 Central Saanich Capital Regiona~ </span><span style='text-decoration: underline;'>30</span><span>210 </span><span style='color: #555555;'>2</span><span> WHSE~ 259 Colwood Capital Regiona~ </span><span style='text-decoration: underline;'>30</span><span>211 </span><span style='color: #555555;'>3</span><span> WHSE~ 260 Esquimalt Capital Regiona~ </span><span style='text-decoration: underline;'>30</span><span>212 </span><span style='color: #555555;'>4</span><span> WHSE~ 261 Highlands Capital Regiona~ </span><span style='text-decoration: underline;'>30</span><span>213 </span><span style='color: #555555;'>5</span><span> WHSE~ 262 Langford Capital Regiona~ </span><span style='text-decoration: underline;'>30</span><span>214 </span><span style='color: #555555;'>6</span><span> WHSE~ 263 Metchosin Capital Regiona~ </span><span style='text-decoration: underline;'>30</span><span>215 </span><span style='color: #555555;'># ... with 1 more variable: geometry </span><span style='color: #555555;font-style: italic;'><MULTIPOLYGON [m]></span><span> </span></CODE></PRE> --- ## Get the data with collect() ```r crd_mun <- bcdc_query_geodata("municipalities-legally-defined-administrative-areas-of-bc") %>% select(ADMIN_AREA_ABBREVIATION, ADMIN_AREA_GROUP_NAME, FEATURE_AREA_SQM) %>% filter(ADMIN_AREA_GROUP_NAME == "Capital Regional District") %>% * collect() ``` ```r mapview(crd_mun, zcol = "ADMIN_AREA_ABBREVIATION", layer = "Municipality") ```
--- ## Let's find the 'greenest' city in the CRD In addition to normal logical predicates (`==`, `!=`, `>`, `<`, etc.), `filter()` can take *geometric predicates*: `EQUALS`, `DISJOINT`, `INTERSECTS`, `TOUCHES`, `CROSSES`, `WITHIN`, `CONTAINS`, `OVERLAPS`, `DWITHIN` ```r crd_greenspaces <- bcdc_query_geodata("local-and-regional-greenspaces") %>% select(PARK_NAME, PARK_TYPE, PARK_PRIMARY_USE) %>% * filter(INTERSECTS(crd_mun)) %>% collect() ``` .footnote[https://catalogue.data.gov.bc.ca/dataset/local-and-regional-greenspaces] --- class: inverse, middle background-image: url(https://images.unsplash.com/photo-1572093443093-e7f4e7e1029f?ixlib=rb-1.2.1&auto=format&fit=crop&w=1936&q=80) background-size: cover # POLL: Which municipality in the Capital Region District has the most parks by area? --- ```r muni_map <- mapview(crd_mun, zcol = "ADMIN_AREA_ABBREVIATION", layer = "Municipality") muni_map + mapview(crd_greenspaces, col.regions = "darkolivegreen") ```
--- class: inverse background-image: url(https://images.unsplash.com/photo-1572093443093-e7f4e7e1029f?ixlib=rb-1.2.1&auto=format&fit=crop&w=1936&q=80) background-cover: cover ## Find the amount of green space in each municipality -- ```r library(sf) crd_mun_parks <- crd_greenspaces %>% st_intersection(crd_mun) %>% group_by(ADMIN_AREA_ABBREVIATION, FEATURE_AREA_SQM) %>% summarise(grn_area = sum(st_area(geometry))) %>% mutate(percent_green = (as.numeric(grn_area) / FEATURE_AREA_SQM)) ``` --- ## Percent Greenspace in Capitol Regional District ![](graphics/prod/figsunnamed-chunk-18-1.png)<!-- --> --- ## Super important person: "Ok great now do this for Metro Vancouver" -- <center><img src="https://media.giphy.com/media/3ohhwuQsXM631E3U0o/giphy.gif" style="width: 500px;"/></center> --- ## Percent Greenspace in Metro Vancouver ```r mv_mun <- bcdc_query_geodata("municipalities-legally-defined-administrative-areas-of-bc") %>% select(ADMIN_AREA_ABBREVIATION, ADMIN_AREA_GROUP_NAME, FEATURE_AREA_SQM) %>% * filter(ADMIN_AREA_GROUP_NAME == "Metro Vancouver Regional District") %>% collect() ``` ```r all the other code... ``` --
--- ## Percent Greenspace in Metro Vancouver ![](graphics/prod/figsunnamed-chunk-23-1.png)<!-- --> --- class: middle, inverse background-image: url(https://upload.wikimedia.org/wikipedia/commons/thumb/6/6e/Monasterio_Khor_Virap%2C_Armenia%2C_2016-10-01%2C_DD_25.jpg/1280px-Monasterio_Khor_Virap%2C_Armenia%2C_2016-10-01%2C_DD_25.jpg) background-size: cover # Reproducible ✔️ # Repeatable ✔️ # Auditable ✔️ --- class: inverse background-image: url(https://images.unsplash.com/photo-1516216628859-9bccecab13ca?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1049&q=80) background-size: cover # Usage of bcdata ## bcgov ## private sector ## academia ??? ### bcgov - https://github.com/bcgov/river-profiles - https://github.com/bcgov/gwater-report - https://github.com/bcgov/FAIB ### private sector - https://github.com/poissonconsulting/fwabc ### academia - https://github.com/starzomskilab/parks-gbif-tool --- ## Kudos .large.wide-right[ - BC Data Catalogue Team - Michelle Douville - Simon Norris - Our bosses for giving us time/space for innovation and collaboration ] .wide-left[ <img src="https://media.giphy.com/media/1Z02vuppxP1Pa/giphy.gif" width=600px/> ] --- # Questions .large.right-column[ <br/> - Install from CRAN: - `install.packages("bcdata")` - Help & documentation: - https://bcgov.github.io/bcdata - Issues/bugs: - https://github.com/bcgov/bcdata/issues - Slides: - https://bcgov.github.io/bcgov-rstats-public-presentations/2020-03-26_bcdata_lunch_and_learn/bcdata-2020-lunch-and-learn.html ] .left-column[ <img src="https://github.com/bcgov/bcdata/raw/master/inst/sticker/bcdata.png" width=600px alt="bcdata" /> ]