2.0.0
This library provides tree recommendations for different climate change scenarios.
Data for tree type projections is provided as a CSV file and needs to be converted into JSON to be usable by the library.
yarn install
chmod 777 data/*.json
)sudo service postgresql stop
yarn run data:transform
NaiS data is provided as CSV files and imported into the PostgreSQL database for further processing. New data needs to be converted to UTF-8 encoding with the following command: iconv -f ISO-8859-1 -t UTF-8 [source].csv > [target].csv
Spatial data is downloaded from different sources and imported into the database. To add or update spatial data have a look into data/spatial
. For the app we generate one vector tileset using the following commands:
yarn run data:stop
, then yarn run data:start
yarn run data:spatial:export
yarn run data:spatial:tile
yarn run data:spatial:fonts
yarn run data:spatial:deploy:local
and change REACT_APP_VECTOR_TILES_ENDPOINT to localhost in .env
(reload new endppoint with yarn start
).vercel
folder in tiles. This folder is generated during the first deployemnt and prompts the definition of the vercel project. Depending on the current project ID and the target instance (tree-app
or tg.tree-app
), the folder needs to be deleted so the initial prompt is triggered again (e.g. if Thurgau tiles tiles-tg
need to be deployed but the last deployment was made for 'tiles-staging
', the folder needs to be recreated)yarn run data:spatial:deploy
followed by vercel alias set [deployment-url] [custom-domain]
(custom domain either tiles.tree-app.ch
, tiles-staging.tree-app.ch
, tiles-tg.tree-app.ch
). The geops vercel team needs to be active locally (use https://vercel.com/docs/cli/switch) for this step.Forest type data from any of the canton datasets can be excluded by commenting out the corresponding line in the import file and rebuilding the tiles.
New data (e.g. for a new canton) is provided in the Seafile-Sharepoint and may need to be adjusted in QGIS. Once ready the folder containing the the SHAPE files needs to be extracted into lib/sata/spatial folder (the import script does this automatically, but to avoid issues with read/write access we recommentd to extract and import manually). Then add the folder name in the .gitignore file.
Please use the GitHub issue tracker for all bugs and feature requests. Before creating a new issue, do a quick search to see if the problem has been reported already.
yarn run test:watch
to continuously test in development.Initial stable release.
This function returns meta information about a given type and code. If the code parameter is missing a list of all available codes is returned. This meta information includes translations and type specific data. See data/types.json for all available types and codes.
(string)
A valid type.
(string?)
A valid code for the given type.
(string?
= 'ch'
)
Profile code.
(any
= 'code'
)
object
:
Includes all meta information.
This function lists all recommended tree types for the forest type at a given location.
(object
= {}
)
Name | Description |
---|---|
location.forestType object
|
Required code for forest type at current location. |
location.transitionForestType object?
|
Optional code for transition forest type at current location. |
(boolean?
= false
)
Optional flag to merge level 4 into level 3.
array
:
Nested arrays of recommended tree type codes.
This function tries to locate the forest type for a given location.
object
:
Includes ecogram, forest types and options.
This function projects the forest type for a given location into the future.
(object
= {}
)
The current location.
(string)
Code for target altitudinal zone.
(object?)
Only for internal use.
object
:
Includes projections and options.
This function recommends tree types based on a location and list of projections. Call this function with the result of the project()
function.
(object
= {}
)
The current location.
(boolean?
= false
)
Optional flag to include tree types for the future.
array
:
Nested arrays of recommended tree type codes.
(string)
A type of mapping (see lib/src/mappings.index.mjs)
(string)
A valid tree-app profile with relief mapping
(array | object)
:
image path
(string)
A valid forest type code
(any)
(boolean
= false
)
Only uses the base code number when set to true (12a => 12)
(string)
A valid tree-app profile with relief mapping
string
:
image path
(string)
A valid path to an image
Promise
:
A promise, resolving in an
By default we fall back to the current (today) location in getProjectionResultLocation, which can result in different map TAZ and projectionResult AZ. Here we check for two conditions:
If the conditions are met we return null and surpress the scenario column creation
This function lists all vegetations for the forest type at a given location.
array
:
Nested arrays of vegetation codes.