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/RtmpeKNVDW/temp_libpath14330523572fb/wheretowork/extdata/projects/sim_raster/sim_raster_spatial.tif
#> attribute: C:/Users/Daniel Wismer/AppData/Local/Temp/RtmpeKNVDW/temp_libpath14330523572fb/wheretowork/extdata/projects/sim_raster/sim_raster_attribute.csv.gz
#> boundary: C:/Users/Daniel Wismer/AppData/Local/Temp/RtmpeKNVDW/temp_libpath14330523572fb/wheretowork/extdata/projects/sim_raster/sim_raster_boundary.csv.gz
#>
#> $themes
#> $themes[[1]]
#> Theme
#> id: dcf16278-200f-464d-9e19-ae950aab38e7
#> 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: 671b4a90-a665-421c-bd5c-9547b39bef24
#> 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: 68cbea2b-477b-40a8-aec5-deec648ab8e9
#> 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: 07e393a5-64f0-4465-b0f9-5a21e77def2f
#> 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: db57ef9d-9283-4611-830e-caea83f42d51
#> 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: 56abc5d5-61d1-4006-b85f-42a76d495d92
#> name: Population count
#> variable: .../sim_raster_spatial.tif#Population_count [total: 174.9 ha]
#> pane: 9c38f673-c8b5-4104-9690-00e4c580f0bd-Population_count
#> current: 0.8
#> visible: TRUE
#> invisible: NA
#> loaded: TRUE
#> hidden: FALSE
#> downloadable: TRUE
#> status: FALSE
#> factor: 0
#>
#> $weights[[2]]
#> Weight
#> id: 135d3e72-2a82-4dcd-aec3-5a0085a8e6ed
#> name: Transportation network
#> variable: .../sim_raster_spatial.tif#Transportation_network [total: 140.56 ha]
#> pane: 7c30cd57-b2a9-4451-be0f-627b44e0b158-Transportation_network
#> current: 0.82
#> visible: TRUE
#> invisible: NA
#> loaded: TRUE
#> hidden: FALSE
#> downloadable: TRUE
#> status: FALSE
#> factor: 0
#>
#> $weights[[3]]
#> Weight
#> id: 6a99f157-3f66-4971-a30b-3d807edcc532
#> name: Sea level rise
#> variable: .../sim_raster_spatial.tif#Sea_level_rise [total: 144.44 ha]
#> pane: 0c700c4b-9bbd-43c1-937a-524f65a30cf1-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: 20c492a2-f313-4b94-9fe8-e071379221a9
#> name: Protected landscapes
#> variable: .../sim_raster_spatial.tif#Protected_landscapes [total: 182 ]
#> pane: ae9aa88c-4aec-4089-bcd0-f61433834b0a-Protected_landscapes
#> visible: TRUE
#> invisible: NA
#> loaded: TRUE
#> hidden: FALSE
#> downloadable: TRUE
#> status: TRUE
#> overlap: NA
#>
#> $includes[[2]]
#> Include
#> id: 93dc918b-86d8-4aa3-a70e-e95e565021e1
#> name: OECM areas
#> variable: .../sim_raster_spatial.tif#OECM_areas [total: 157 ]
#> pane: be80ecea-5bf3-4fb4-985e-ef114edca79d-OECM_areas
#> visible: TRUE
#> invisible: NA
#> loaded: TRUE
#> hidden: FALSE
#> downloadable: TRUE
#> status: TRUE
#> overlap: NA
#>
#>
#> $excludes
#> list()
#>
#> $mode
#> [1] "advanced"
#>