Read a project from disk.
Usage
read_project(
  path,
  spatial_path = NULL,
  attribute_path = NULL,
  boundary_path = NULL,
  mode = "project"
)Arguments
- path
- characterfile path for the configuration file.
- spatial_path
- characterfile path for spatial data. Defaults to- NULLsuch that the file path is determined using the argument to- path.
- attribute_path
- characterfile path for attribute data. Defaults to- NULLsuch that the file path is determined using the argument to- path.
- boundary_path
- characterfile path for boundary data. Defaults to- NULLsuch that the file path is determined using the argument to- path.
- mode
- charactermode for importing the objects. Defaults to- "project"such that the mode is determined based on the contents of- path. If the- modeis- "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/RtmpsXqY7A/temp_libpath82d05f685712/wheretowork/extdata/projects/sim_raster/sim_raster_spatial.tif
#>     attribute: C:/Users/Daniel Wismer/AppData/Local/Temp/RtmpsXqY7A/temp_libpath82d05f685712/wheretowork/extdata/projects/sim_raster/sim_raster_attribute.csv.gz
#>     boundary: C:/Users/Daniel Wismer/AppData/Local/Temp/RtmpsXqY7A/temp_libpath82d05f685712/wheretowork/extdata/projects/sim_raster/sim_raster_boundary.csv.gz
#> 
#> $themes
#> $themes[[1]]
#> Theme
#>   id:        640f57a2-fada-495c-b57a-4326c1ce0336
#>   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:        10c1a3b7-c60c-45fa-92cb-53d6fb160ed6
#>   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:        392f50fc-104d-421d-9d71-0707d9538ba0
#>   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:        f4ed308e-ae16-4b5c-91b4-0df7376654ab
#>   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:        339a9a97-283f-48d0-b8eb-c116aa4f4644
#>   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:       79bb14b0-d5db-439d-9107-d05d0a1df591
#>   name:     Population count
#>   variable: .../sim_raster_spatial.tif#Population_count [total: 174.9 ha]
#>   pane:  684c7e7e-8f05-42ac-bf06-cb2aeeb8051c-Population_count
#>   current:  0.8
#>   visible:  TRUE
#>   invisible:  NA
#>   loaded:  TRUE
#>   hidden:  FALSE
#>   downloadable:  TRUE
#>   status:   FALSE
#>   factor:   0
#> 
#> $weights[[2]]
#> Weight
#>   id:       caffc143-bf94-4993-91d8-7c4ebea9c0ac
#>   name:     Transportation network
#>   variable: .../sim_raster_spatial.tif#Transportation_network [total: 140.56 ha]
#>   pane:  d9dc039c-67ea-4f67-805b-1f2de7c12ee6-Transportation_network
#>   current:  0.82
#>   visible:  TRUE
#>   invisible:  NA
#>   loaded:  TRUE
#>   hidden:  FALSE
#>   downloadable:  TRUE
#>   status:   FALSE
#>   factor:   0
#> 
#> $weights[[3]]
#> Weight
#>   id:       cfb7e023-adf6-4858-a7ad-9b63f638333f
#>   name:     Sea level rise
#>   variable: .../sim_raster_spatial.tif#Sea_level_rise [total: 144.44 ha]
#>   pane:  66aba46e-5ef9-4ce4-abd4-0b50e56d0910-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:       96c78afd-06b4-4f46-9ac4-4068a29aee97
#>   name:     Protected landscapes
#>   variable: .../sim_raster_spatial.tif#Protected_landscapes [total: 182 ]
#>   pane:  e15285ea-ecf6-4801-ab4d-ded893f5c42a-Protected_landscapes
#>   visible:  TRUE
#>   invisible:  NA
#>   loaded:  TRUE
#>   hidden:  FALSE
#>   downloadable:  TRUE
#>   status:   TRUE
#>   overlap:   NA
#> 
#> $includes[[2]]
#> Include
#>   id:       c457f19b-3dd5-4363-a7eb-bf60f78a3cf3
#>   name:     OECM areas
#>   variable: .../sim_raster_spatial.tif#OECM_areas [total: 157 ]
#>   pane:  665ef6c1-47f5-44fe-8a92-f83433c5f18c-OECM_areas
#>   visible:  TRUE
#>   invisible:  NA
#>   loaded:  TRUE
#>   hidden:  FALSE
#>   downloadable:  TRUE
#>   status:   TRUE
#>   overlap:   NA
#> 
#> 
#> $excludes
#> list()
#> 
#> $mode
#> [1] "advanced"
#>