nismod / infra-risk-vis Goto Github PK
View Code? Open in Web Editor NEWRisk analysis visualisation tool
Home Page: https://global.infrastructureresilience.org
License: MIT License
Risk analysis visualisation tool
Home Page: https://global.infrastructureresilience.org
License: MIT License
General priorities
Implement unit and integration tests across the backend API
Linked to #113
Plot sum EAD for an asset over all hazards, for a given RCP/epoch.
Limit to sufficiently common RCP/epoch combinations
Include fluvial/pluvial flooding under future scenarios once processed (WIP).
There's a variety of attributes on different assets in different sectors.
Can we handle things generically? Current map over keys gives just-about readable labels. Ordering is data-dependent, and there's no way to break attributes into logical groups, or skip or combine them in the FeatureSidebar > List
.
Remove tech-debt with duplicate workflows and move ETL/pipelines to best pract Snakemake repository structure
Separate road classes into layers
Check vector density of tertiary/unclassified roads - especially roads around Kingston in zoomed-out view. Can tippecanoe show more data here?
or submit a PR for Terracotta upgrade to do this?
Along with #19, click a region to display a summary sidebar
Seem to come up as darker areas, perhaps around tile joins?
Possibly related - do we already have (or can we test) adding terracotta optimize-rasters
to the raster process pipeline?
Update when Terracotta Master (which has Postgres ingegration for backend DB) is released.
This also means we could drop MySQL DB
Implement a mechanism for supporting spatial data with a very large number of attributes, without increasing the size of vector tiles unnecessarily.
Current options:
Noting an idea for hazard plotting: there may be a particular hazard intensity (depth/wind-speed) threshold which is particularly relevant, so the map could plot the least return period (or interpolated return period) above which that threshold would be exceeded. The intensity threshold could be controlled by a slider or numeric input.
baseline
(not 4x5
) in 2010
timestep.Split layers by "asset type" column in input data:
Notes on efficient style updates, seems to be a problem for some updates via react-map-gl
Following the how the code handles style updates:
setFilter
is in the list of supported diff operations at mapbox-gl-js/src/style/style.js#L74Could be worth injecting some debugging if the full map repaints when we think it shouldn't need to. What precisely are we doing that forces a full style rebuild?
Triggers validation error, shows up as internal server error in adaptation options table.
...
File "pydantic/main.py", line 511, in pydantic.main.BaseModel.parse_obj
File "pydantic/main.py", line 331, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 1 validation error for AdaptationCostBenefitRatioParameters
eael_days
ensure this value is greater than or equal to 1 (type=value_error.number.not_ge; limit_value=1)
Split out from #26
Add administrative boundaries layer to map.
Enable toggling boundaries on/off.
Plot aggregate risk at admin boundary level: national/parish/district
Choose RCP/epoch, single hazard/combined
When hiding a layer from view, if the selected feature comes from that layer, the selection should be cleared.
Currently, the highlighted selection is still displayed, even though all other features of that layer aren't visible.
Steps to reproduce:
infra-risk-vis/backend/backend/app/schemas.py
Line 129 in c5ee7f2
There have been a series of versions and releases, project-driven:
v0.1-argentina
v0.2-seasia
v0.3.0
feature/caribbean-prototype
feature/hvt-vis
Requirements:
Suggest:
release
branches for tools as deployedMapbox GL is no longer open source as of v2.
Consider pricing and tiers for low usage.
Likely open alternative is the fork of v1 at https://github.com/maplibre/maplibre-gl-js/
Tileserver-gl (which we use to serve vector tiles) is looking at similar migration needs: https://github.com/maptiler/tileserver-gl/ issue 542
The goal is to display the mapped damage value of the hovered feature in the hover tooltip.
Currently, the direct damages values which are shown as colours on the infrastructure map, are not shown anywhere in text.
While the Expected Annual Damage values are shown in bulk in the selected feature sidebar, the data for the current parameters is not displayed in the hover tooltip, and the total damage figures are not displayed anywhere in the app.
After separating out UI into new repo
Plot line chart in asset sidebar, EAD against epoch, different colours for RCPs, separate plot per hazard.
Example vega-lite spec - to be constructed from asset attributes:
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"width": 300,
"height": 200,
"data": {"values": [
{"rcp": "2.6", "epoch": "2050", "ead": 5210000},
{"rcp": "2.6", "epoch": "2100", "ead": 7520000},
{"rcp": "baseline", "epoch": "2010", "ead": 4250000},
{"rcp": "4.5", "epoch": "2030", "ead": 4800000},
{"rcp": "4.5", "epoch": "2050", "ead": 5250000},
{"rcp": "4.5", "epoch": "2100", "ead": 8100000},
{"rcp": "8.5", "epoch": "2030", "ead": 4850000},
{"rcp": "8.5", "epoch": "2050", "ead": 5610000},
{"rcp": "8.5", "epoch": "2100", "ead": 10500000}
]},
"mark": {
"type": "line",
"point": {
"filled": true
}
},
"encoding": {
"x": {"field": "epoch", "timeUnit": "year", "title": "Year"},
"y": {"field": "ead", "type": "quantitative", "title": "Expected Annual Damages"},
"color": {"field": "rcp", "type": "nominal", "title": "RCP"}
}
}
For a given location - which may be a current or future infrastructure asset location - I would like to know all the hazards which may affect it.
Implementation notes - may be an API call rather than pushing all data client side:
GET /exposure/rp?lat=0.00&lng=0.00
[
{
"hazard": "coastal",
"exposure": [0,0,0,1,2],
"return_period": [5,10,50,100,250]
}
]
^ exposure and return period entries correspond
GET /exposure/events?lat=0.00&lng=0.00
[
{
"hazard": "coastal",
"events": [2.3,7,2.3]
}
]
^ events is list of non-zero depths from event set
The current highlight mechanism seems to be affected by the splitting of individual features into potentially multiple vector tiles.
How to replicate:
This seems to be because the current selection highlight mechanism doesn't work well with tiled data. Needs investigation to identify fix.
Colour transport assets / buidlings by economics (total/sector):
Vector Tileserver
Backend API
Organise layer selection sidebar in the following manner:
For example: when viewing the Risk tab, assets, regions and hazards are primary layers, while elevation is a context layer. When it comes to the regions layer, aggregate damages is a primary style option, while population and GDP are context style options.
Search box to filter on place names, select to zoom to location.
The aim here is to display raster data (e.g. flood return period maps showing depth of flooding) directly, coloured to show data values (depth of flooding), still visible when zoomed out, and clearly pixelated at the resolution of the data when zoomed in.
The key map interaction is to pick out the depth values and show on hover in a tooltip (Flooding: 3.2m).
Otherwise we want to show and hide layers - change climate scenario, model, return period; potentially show multiple hazards overlaid.
Notes from @mz8i :
Notes on related approaches:
map.project
and accessing the canvas element map.getCanvas
, which might allow picking pixel values - if the map is created with options.preserveDrawingBuffer: true
using webglContext.readPixels
. Seems a bit involved, not sure if there's a neat way.leaflet.tilelayer.glcolorscale
- see blog post.Infra-Risk-Vis repository can be split into seperate repos for Backend API, UI and ETL. This could have the following benefits amoungst others:
This relates to work on AssessmentPage.tsx
for the east-africa
project.
Consider dependencies and requirements for the various services:
Separately, snakemake workflow processes tiffs for terracotta and vector data into database then into vector tiles. Current way to run snakemake is to change to backend
directory, run pipenv shell
to pick up dependencies and database connection environment variables, then change over to etl
and run snakemake
commands.
Goal: improve ease and reproducibility of initial setup and everyday spinning up for development. See initial sketch with docker-compose for backend API and database. Current state is to open four terminals/tmux screens and run:
npm start
npm run raster
npm run vector
pipenv run uvicorn backend.app.main:app --host localhost --port 8888
(with database connection details in .env
)A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.