Read a project from disk.

read_project(
  path,
  spatial_path = NULL,
  attribute_path = NULL,
  boundary_path = NULL,
  mode = "project",
  force_hidden = FALSE
)

Arguments

path

character file path for the configuration file.

spatial_path

character file path for spatial data. Defaults to NULL such that the file path is determined using the argument to path.

attribute_path

character file path for attribute data. Defaults to NULL such that the file path is determined using the argument to path.

boundary_path

character file path for boundary data. Defaults to NULL such that the file path is determined using the argument to path.

mode

character mode for importing the objects. Defaults to "project" such that the mode is determined based on the contents of path. If the mode is "advanced", then goal limits and mandatory include settings are disabled.

force_hidden

logical value for hiding TWI layers at import. Defaults to "False" such that hidden TWI layers are determined based on the contents of path.

Value

A list containing the following elements:

name

A character value indicating the name.

dataset

A Dataset object.

themes

A list of Theme objects.

weights

A list of Weight objects.

includes

A list of Include objects.

excludes

A list of Exclude objects.

mode

A character value indicating the mode.

force_hidden

A logical value indicating all TWI will be hidden.

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/marc.edwards/AppData/Local/Temp/RtmpUHgCYd/temp_libpath5524317a7145/wheretowork/extdata/projects/sim_raster/sim_raster_spatial.tif
#>     attribute: C:/Users/marc.edwards/AppData/Local/Temp/RtmpUHgCYd/temp_libpath5524317a7145/wheretowork/extdata/projects/sim_raster/sim_raster_attribute.csv.gz
#>     boundary: C:/Users/marc.edwards/AppData/Local/Temp/RtmpUHgCYd/temp_libpath5524317a7145/wheretowork/extdata/projects/sim_raster/sim_raster_boundary.csv.gz
#> 
#> $themes
#> $themes[[1]]
#> Theme
#>   id:        95f010cb-2b3c-4ccd-ae6c-10f274079126
#>   name:      Brown-necked Parrot (Brown-necked)
#>   feature: 
#>     Brown-necked Parrot (Brown-necked) habitat [status: TRUE, current: 0.78, goal: 0.83]
#>     
  variable: .../sim_raster_spatial.tif#Brown_necked_Parrot_Brown_necked_ [total: 1052 ha]
#> 
#> $themes[[2]]
#> Theme
#>   id:        46412dac-7a31-4508-928e-3d9bbb718b9f
#>   name:      Gough Island Finch
#>   feature: 
#>     Gough Island Finch habitat [status: TRUE, current: 0.78, goal: 0.7]
#>     
  variable: .../sim_raster_spatial.tif#Gough_Island_Finch [total: 1349 ha]
#> 
#> $themes[[3]]
#> Theme
#>   id:        f7e3776a-28b9-4ba6-bcb3-5a76673096b3
#>   name:      Manus Boobook
#>   feature: 
#>     Manus Boobook habitat [status: TRUE, current: 0.78, goal: 0.7]
#>     
  variable: .../sim_raster_spatial.tif#Manus_Boobook [total: 430 ha]
#> 
#> $themes[[4]]
#> Theme
#>   id:        d01047ae-2a03-426d-90ae-34956ac9d209
#>   name:      Waxbills and Allies
#>   feature: 
#>     Red-faced Crimsonwing [status: TRUE, current: 0.75, goal: 0.69]
#>     
  variable: .../sim_raster_spatial.tif#Red_faced_Crimsonwing [total: 12825.69 ha]
#>     African Firefinch [status: TRUE, current: 0.76, goal: 0.55]
#>     
  variable: .../sim_raster_spatial.tif#African_Firefinch [total: 7220.08 ha]
#>     Black-and-white Mannikin (Red-backed) [status: TRUE, current: 0.76, goal: 0.53]
#>     
  variable: .../sim_raster_spatial.tif#Black_and_white_Mannikin_Red_backed_ [total: 10138.58 ha]
#>     Black-throated Finch (White-rumped) [status: TRUE, current: 0.79, goal: 0.72]
#>     
  variable: .../sim_raster_spatial.tif#Black_throated_Finch_White_rumped_ [total: 22013.57 ha]
#>     Crimson Seedcracker [status: TRUE, current: 0.79, goal: 0.61]
#>     
  variable: .../sim_raster_spatial.tif#Crimson_Seedcracker [total: 21404.47 ha]
#>     Royal Parrotfinch [status: TRUE, current: 0.77, goal: 0.54]
#>     
  variable: .../sim_raster_spatial.tif#Royal_Parrotfinch [total: 237.31 ha]
#>     Red-billed Firefinch [status: TRUE, current: 0.8, goal: 0.81]
#>     
  variable: .../sim_raster_spatial.tif#Red_billed_Firefinch [total: 2697.52 ha]
#>     Quailfinch (Black-faced) [status: TRUE, current: 0.77, goal: 0.76]
#>     
  variable: .../sim_raster_spatial.tif#Quailfinch_Black_faced_ [total: 9964.19 ha]
#>     White-collared Oliveback [status: TRUE, current: 0.8, goal: 0.86]
#>     
  variable: .../sim_raster_spatial.tif#White_collared_Oliveback [total: 13706.62 ha]
#> 
#> $themes[[5]]
#> Theme
#>   id:        7fa1a5a3-8f18-41d2-980a-7b6dcec48f21
#>   name:      Penduline-Tits
#>   feature: 
#>     Eurasian Penduline-Tit [status: TRUE, current: 0.77, goal: 0.8]
#>     
  variable: .../sim_raster_spatial.tif#Eurasian_Penduline_Tit [total: 5229.66 ha]
#>     Verdin [status: TRUE, current: 0.81, goal: 0.64]
#>     
  variable: .../sim_raster_spatial.tif#Verdin [total: 16793.02 ha]
#>     Mouse-colored Penduline-Tit [status: TRUE, current: 0.75, goal: 0.66]
#>     
  variable: .../sim_raster_spatial.tif#Mouse_colored_Penduline_Tit [total: 15611.47 ha]
#>     Forest Penduline-Tit [status: TRUE, current: 0.74, goal: 0.68]
#>     
  variable: .../sim_raster_spatial.tif#Forest_Penduline_Tit [total: 14553.23 ha]
#>     Chinese Penduline-Tit [status: TRUE, current: 0.78, goal: 0.8]
#>     
  variable: .../sim_raster_spatial.tif#Chinese_Penduline_Tit [total: 5295 ha]
#> 
#> 
#> $weights
#> $weights[[1]]
#> Weight
#>   id:       7a1e915f-03dc-44f5-9fca-7eafbe727239
#>   name:     Landscape naturalness
#>   variable: .../sim_raster_spatial.tif#Landscape_naturalness [total: 146.73 ha]
#>   pane:  1d4873d4-f52d-4af1-9848-e0999bf80d1f-Landscape_naturalness
#>   current:  0.78
#>   visible:  TRUE
#>   invisible:  NA
#>   loaded:  TRUE
#>   hidden:  FALSE
#>   status:   FALSE
#>   factor:   0
#> 
#> $weights[[2]]
#> Weight
#>   id:       2d1a3a60-a07f-419b-8b79-109faaec69a8
#>   name:     Archaeological site
#>   variable: .../sim_raster_spatial.tif#Archaeological_site [total: 153.11 ha]
#>   pane:  65d6a740-ebfb-4901-b95a-934fa6ae4dc7-Archaeological_site
#>   current:  0.75
#>   visible:  TRUE
#>   invisible:  NA
#>   loaded:  TRUE
#>   hidden:  FALSE
#>   status:   FALSE
#>   factor:   0
#> 
#> $weights[[3]]
#> Weight
#>   id:       c98e3eb8-b9b3-4391-bf1f-dacf56a917cb
#>   name:     Engagement potential
#>   variable: .../sim_raster_spatial.tif#Engagement_potential [total: 145.9 ha]
#>   pane:  e816ef14-4ab3-4af9-89b4-0023ebc59ae6-Engagement_potential
#>   current:  0.78
#>   visible:  TRUE
#>   invisible:  NA
#>   loaded:  TRUE
#>   hidden:  FALSE
#>   status:   FALSE
#>   factor:   0
#> 
#> 
#> $includes
#> $includes[[1]]
#> Include
#>   id:       531e14ef-b9eb-452f-8d57-6ea7b9a43990
#>   name:     National protected areas
#>   variable: .../sim_raster_spatial.tif#National_protected_areas [total: 159 ]
#>   pane:  51b7cc24-4a12-402e-bb86-fc093aa5edc6-National_protected_areas
#>   visible:  TRUE
#>   invisible:  NA
#>   loaded:  TRUE
#>   hidden:  FALSE
#>   status:   TRUE
#>   overlap:   NA
#> 
#> $includes[[2]]
#> Include
#>   id:       55d15ad6-287f-4376-97b8-7e28cf2ea718
#>   name:     Key Biodiversity Areas
#>   variable: .../sim_raster_spatial.tif#Key_Biodiversity_Areas [total: 147 ]
#>   pane:  32cd9b41-7e03-4cbd-8799-f8d906387fd6-Key_Biodiversity_Areas
#>   visible:  TRUE
#>   invisible:  NA
#>   loaded:  TRUE
#>   hidden:  FALSE
#>   status:   TRUE
#>   overlap:   NA
#> 
#> 
#> $excludes
#> list()
#> 
#> $mode
#> [1] "advanced"
#>