Read a project from disk.
Usage
read_project(
path,
spatial_path = NULL,
attribute_path = NULL,
boundary_path = NULL,
mode = "project"
)
Arguments
- path
character
file path for the configuration file.- spatial_path
character
file path for spatial data. Defaults toNULL
such that the file path is determined using the argument topath
.- attribute_path
character
file path for attribute data. Defaults toNULL
such that the file path is determined using the argument topath
.- boundary_path
character
file path for boundary data. Defaults toNULL
such that the file path is determined using the argument topath
.- mode
character
mode for importing the objects. Defaults to"project"
such that the mode is determined based on the contents ofpath
. If themode
is"advanced"
, then goal limits and mandatory include settings are disabled.
Details
Note that the status field for themes and weights will automatically
be set to FALSE
if the goal/weight values are zero.
This is to ensure that the application starts with a sensible
combination of settings.
Examples
# find data file paths
f1 <- system.file(
"extdata", "projects", "sim_raster", "sim_raster_data.yaml",
package = "wheretowork"
)
f2 <- system.file(
"extdata", "projects", "sim_raster", "sim_raster_spatial.tif",
package = "wheretowork"
)
f3 <- system.file(
"extdata", "projects", "sim_raster", "sim_raster_attribute.csv.gz",
package = "wheretowork"
)
f4 <- system.file(
"extdata", "projects", "sim_raster", "sim_raster_boundary.csv.gz",
package = "wheretowork"
)
# read project
x <- read_project(f1, f2, f3, f4)
# print project
print(x)
#> $name
#> [1] "Example GeoTIFF dataset"
#>
#> $author_name
#> [1] "Richard Schuster"
#>
#> $author_email
#> [1] "richard.schuster@natureconservancy.ca"
#>
#> $dataset
#> Dataset
#> paths:
#> spatial: C:/Users/Daniel Wismer/AppData/Local/Temp/RtmpsPEycp/temp_libpath58786e71151c/wheretowork/extdata/projects/sim_raster/sim_raster_spatial.tif
#> attribute: C:/Users/Daniel Wismer/AppData/Local/Temp/RtmpsPEycp/temp_libpath58786e71151c/wheretowork/extdata/projects/sim_raster/sim_raster_attribute.csv.gz
#> boundary: C:/Users/Daniel Wismer/AppData/Local/Temp/RtmpsPEycp/temp_libpath58786e71151c/wheretowork/extdata/projects/sim_raster/sim_raster_boundary.csv.gz
#>
#> $themes
#> $themes[[1]]
#> Theme
#> id: 9dbf9b86-0144-43ed-9cbd-971990492a10
#> name: Brown-necked Parrot (Brown-necked)
#> feature:
#> Brown-necked Parrot (Brown-necked) habitat [status: TRUE, current: 0.81, goal: 0.62]
#>
variable: .../sim_raster_spatial.tif#Brown_necked_Parrot_Brown_necked_ [total: 483 ha]
#>
#> $themes[[2]]
#> Theme
#> id: 69f2f933-6585-40cc-9dc4-5594807e1540
#> name: Gough Island Finch
#> feature:
#> Gough Island Finch habitat [status: TRUE, current: 0.83, goal: 0.54]
#>
variable: .../sim_raster_spatial.tif#Gough_Island_Finch [total: 25747.97 ha]
#>
#> $themes[[3]]
#> Theme
#> id: 22712436-3697-4ef5-befc-d0b05d13bf9a
#> name: Manus Boobook
#> feature:
#> Manus Boobook habitat [status: TRUE, current: 0.79, goal: 0.5]
#>
variable: .../sim_raster_spatial.tif#Manus_Boobook [total: 23474.88 ha]
#>
#> $themes[[4]]
#> Theme
#> id: 148994b8-f352-4e8f-bf6c-bc070d5830cd
#> name: Flufftails
#> feature:
#> Red-chested Flufftail [status: TRUE, current: 0.81, goal: 0.7]
#>
variable: .../sim_raster_spatial.tif#White_spotted_Flufftail_Northern_ [total: 16872.87 ha]
#> Chestnut-headed Flufftail [status: TRUE, current: 0.81, goal: 0.7]
#>
variable: .../sim_raster_spatial.tif#White_spotted_Flufftail_Northern_ [total: 16872.87 ha]
#> Tsingy Wood-Rail [status: TRUE, current: 0.81, goal: 0.73]
#>
variable: .../sim_raster_spatial.tif#White_spotted_Flufftail_Northern_ [total: 16872.87 ha]
#> Streaky-breasted Flufftail [status: TRUE, current: 0.81, goal: 0.74]
#>
variable: .../sim_raster_spatial.tif#White_spotted_Flufftail_Northern_ [total: 16872.87 ha]
#> Madagascar Flufftail [status: TRUE, current: 0.81, goal: 0.8]
#>
variable: .../sim_raster_spatial.tif#White_spotted_Flufftail_Northern_ [total: 16872.87 ha]
#> Buff-spotted Flufftail [status: TRUE, current: 0.81, goal: 0.86]
#>
variable: .../sim_raster_spatial.tif#White_spotted_Flufftail_Northern_ [total: 16872.87 ha]
#> White-winged Flufftail [status: TRUE, current: 0.81, goal: 0.76]
#>
variable: .../sim_raster_spatial.tif#White_spotted_Flufftail_Northern_ [total: 16872.87 ha]
#> White-spotted Flufftail [status: TRUE, current: 0.81, goal: 0.64]
#>
variable: .../sim_raster_spatial.tif#White_spotted_Flufftail_Northern_ [total: 16872.87 ha]
#> White-spotted Flufftail (Northern) [status: TRUE, current: 0.81, goal: 0.81]
#>
variable: .../sim_raster_spatial.tif#White_spotted_Flufftail_Northern_ [total: 16872.87 ha]
#>
#> $themes[[5]]
#> Theme
#> id: d5ccbc63-7515-4d15-a07d-8946d2e994a3
#> name: Todies
#> feature:
#> Puerto Rican Tody [status: TRUE, current: 0.79, goal: 0.6]
#>
variable: .../sim_raster_spatial.tif#Jamaican_Tody [total: 14614.97 ha]
#> Jamaican Tody [status: TRUE, current: 0.79, goal: 0.73]
#>
variable: .../sim_raster_spatial.tif#Jamaican_Tody [total: 14614.97 ha]
#>
#>
#> $weights
#> $weights[[1]]
#> Weight
#> id: 97b79808-e12f-40a1-9fd7-3ba30f72e81c
#> name: Population count
#> variable: .../sim_raster_spatial.tif#Population_count [total: 174.9 ha]
#> pane: 15460b73-c4fe-4906-beb5-49b0b189cdd1-Population_count
#> current: 0.8
#> visible: TRUE
#> invisible: NA
#> loaded: TRUE
#> hidden: FALSE
#> downloadable: TRUE
#> status: FALSE
#> factor: 0
#>
#> $weights[[2]]
#> Weight
#> id: 60b523a6-dfc9-4ac3-8f20-9d9ac31a3063
#> name: Transportation network
#> variable: .../sim_raster_spatial.tif#Transportation_network [total: 140.56 ha]
#> pane: b6873fe0-22ef-44d6-9990-ef11b234af83-Transportation_network
#> current: 0.82
#> visible: TRUE
#> invisible: NA
#> loaded: TRUE
#> hidden: FALSE
#> downloadable: TRUE
#> status: FALSE
#> factor: 0
#>
#> $weights[[3]]
#> Weight
#> id: 5f76c037-fedc-49b8-b98e-825785ee774f
#> name: Sea level rise
#> variable: .../sim_raster_spatial.tif#Sea_level_rise [total: 144.44 ha]
#> pane: 1fca56dc-48b5-4764-8df5-d093368c9ff5-Sea_level_rise
#> current: 0.79
#> visible: TRUE
#> invisible: NA
#> loaded: TRUE
#> hidden: FALSE
#> downloadable: TRUE
#> status: FALSE
#> factor: 0
#>
#>
#> $includes
#> $includes[[1]]
#> Include
#> id: 4e16ed04-bdf1-4954-a2b8-492969498ee7
#> name: Protected landscapes
#> variable: .../sim_raster_spatial.tif#Protected_landscapes [total: 182 ]
#> pane: 7a102dc3-369a-4240-9af9-863f00832539-Protected_landscapes
#> visible: TRUE
#> invisible: NA
#> loaded: TRUE
#> hidden: FALSE
#> downloadable: TRUE
#> status: TRUE
#> overlap: NA
#>
#> $includes[[2]]
#> Include
#> id: 82e1d6d7-5d21-490d-b606-37d0dd3ab58e
#> name: OECM areas
#> variable: .../sim_raster_spatial.tif#OECM_areas [total: 157 ]
#> pane: 8f605c5d-8bb3-4aee-82d3-20272d6b5c4f-OECM_areas
#> visible: TRUE
#> invisible: NA
#> loaded: TRUE
#> hidden: FALSE
#> downloadable: TRUE
#> status: TRUE
#> overlap: NA
#>
#>
#> $excludes
#> list()
#>
#> $mode
#> [1] "advanced"
#>