Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions public/Zonal_Stats_Forest_App/README.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<!--fused:preview-->
<p align="center"><img src="https://fused-magic.s3.us-west-2.amazonaws.com/blog-assets/zstats_viewer_mx.png" width="600" alt="UDF preview image"></p>

<!--fused:readme-->
# View Forest Observation zonal stats

41 changes: 41 additions & 0 deletions public/Zonal_Stats_Forest_App/Zonal_Stats_Forest_App.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import micropip
await micropip.install(['pydeck'])

import streamlit as st
import pydeck as pdk

st.title("🌲 Zonal Stats of Forest observations by global municipalities")

st.markdown("""
This app shows the output of a workflow to quantify forest cover for municipal areas around the world. The workflow aggregates a raster of global forest cover across zones defined by a vector table of municipalities.

The final result, which you see here, is a table with records for every municipality and columns with summary metrics such as percent forest coverage. This type of analysis can help identify regions with significant forest loss to prioritize conservation efforts or support sustainable land-use planning.

""")

url="https://www.fused.io/server/v1/realtime-shared/UDF_Zonal_Stats_Forest_Obs_Viewer/run/tiles/{z}/{x}/{y}?dtype_out_vector=geojson"


lat, lng = 28.3949, 84.1240

st.pydeck_chart(
pdk.Deck(
map_style="mapbox://styles/mapbox/dark-v9",
initial_view_state=pdk.ViewState(latitude=lat, longitude=lng, zoom=5, pitch=0, bearing=-6),
tooltip={"html": "<b>Value:</b> {stats_mean}","style": {"backgroundColor": "steelblue", "color": "white"},},
layers=[
pdk.Layer(
"TileLayer",
data=url,
get_line_color=[255, 25, 2, 1000],
get_elevation="properties.stats_mean",
stroked=True,
get_line_width=2,
pickable=True,
extruded=True,
filled=True,
get_fill_color="[properties.stats_mean*25, properties.stats_mean*256, properties.stats_mean*25]",
)
],
)
)
90 changes: 90 additions & 0 deletions public/Zonal_Stats_Forest_App/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{
"version": "0.0.3",
"job_config": {
"version": "0.0.3",
"name": null,
"steps": [
{
"type": "udf",
"udf": {
"type": "geopandas_v2",
"name": "Zonal_Stats_Forest_App",
"entrypoint": "udf",
"parameters": {},
"metadata": {
"fused:name": "Zonal_Stats_Forest_App",
"fused:slug": "Zonal_Stats_Forest_App",
"fused:gitRepo": "fusedlabs/fusedudfs",
"fused:gitRef": "1658a5ac8c85e3240a1c1a01945ba4d090b0a853",
"fused:gitUrl": "https://github.com/fusedlabs/fusedudfs/tree/1658a5ac8c85e3240a1c1a01945ba4d090b0a853/Zonal_Stats_Forest_App/",
"fused:gitShortUrl": "https://github.com/fusedlabs/fusedudfs/tree/1658a5a/Zonal_Stats_Forest_App/",
"fused:gitPath": "Zonal_Stats_Forest_App",
"fused:gitLastModified": "2025-01-28T13:41:46+00:00",
"fused:gitPullRequestBranch": "plinio-patch-1ba1ae-Zonal-stats-forest-app",
"fused:gitPullRequestLink": "https://github.com/fusedlabs/fusedudfs/pull/527",
"fused:vizConfig": {
"tileLayer": {
"@@type": "TileLayer",
"minZoom": 0,
"maxZoom": 19,
"tileSize": 256
},
"rasterLayer": {
"@@type": "BitmapLayer",
"pickable": true
},
"vectorLayer": {
"@@type": "GeoJsonLayer",
"stroked": true,
"filled": false,
"pickable": true,
"lineWidthMinPixels": 1,
"pointRadiusMinPixels": 1,
"getLineColor": {
"@@function": "colorContinuous",
"attr": "value",
"domain": [
0,
10
],
"colors": "SunsetDark",
"nullColor": [
184,
184,
184
]
},
"getFillColor": [
208,
208,
208,
40
]
}
},
"fused:udfType": "app",
"fused:id": null,
"fused:description": "# View Forest Observation zonal stats \n\n",
"fused:gitAuthorNames": [
null
],
"fused:gitAuthorUsernames": [
"fused-io[bot]"
],
"fused:gitAuthorUrls": [
"https://github.com/apps/fused-io"
],
"fused:gitAuthorAvatarUrls": [
"https://avatars.githubusercontent.com/in/834700?v=4"
],
"fused:explorerTab": "team",
"fused:assetUrl": "https://fused-magic.s3.us-west-2.amazonaws.com/blog-assets/zstats_viewer_mx.png"
},
"source": "Zonal_Stats_Forest_App.py",
"headers": []
}
}
],
"metadata": null
}
}