From df0333ec58433a94ea76a750d20f5f8a4c124491 Mon Sep 17 00:00:00 2001 From: Dustin Carlino Date: Fri, 23 Feb 2024 17:13:27 +0000 Subject: [PATCH] Visualize steepness. #18 Adapted from https://github.com/acteng/atip/pull/475 --- viewer/assets/chevron.png | Bin 0 -> 212 bytes viewer/src/App.svelte | 3 + viewer/src/Layers.svelte | 45 ++++++++++++- viewer/src/Loader.svelte | 2 +- viewer/src/PropertiesTable.svelte | 2 +- viewer/src/SidebarControls.svelte | 102 +++++++++++++++++++----------- viewer/src/common.ts | 19 +++--- viewer/src/stores.ts | 1 + 8 files changed, 122 insertions(+), 52 deletions(-) create mode 100644 viewer/assets/chevron.png diff --git a/viewer/assets/chevron.png b/viewer/assets/chevron.png new file mode 100644 index 0000000000000000000000000000000000000000..c6087b94e0641cd646577a613fb30424382d40a3 GIT binary patch literal 212 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjvproLLp;3SPPxe2puppj$ZUR* z_X=-`(OnPs3BEE1U$@H(O^%yAA%p4U--EVQt;Yf?jvo5Akm*W`yf z=JjE8>l;6A|mk-==jlT_7=3$yYVJ>-3!1sQP{ z%-qbd-I9BUz0}mof0t)=ELo^+lF3^ut;}=4s!r~=wnOjx|AMhQtCS>nY~{NGbS8tR LtDnm{r-UW|?_N$7 literal 0 HcmV?d00001 diff --git a/viewer/src/App.svelte b/viewer/src/App.svelte index 493cac7..63e50ce 100644 --- a/viewer/src/App.svelte +++ b/viewer/src/App.svelte @@ -1,4 +1,5 @@ +", ["abs", ["get", "slope"]], 3], + ]} + minzoom={12} + layout={{ + "icon-image": "chevron", + "icon-size": 1.0, + "symbol-placement": "line", + "symbol-spacing": 50, + "icon-allow-overlap": true, + "icon-rotate": ["case", ["<", ["get", "slope"], 0], 180, 0], + visibility: $showSlope ? "visible" : "none", + }} +/> + { let header = await file.getHeader(); - let metadata = await file.getMetadata() as any; + let metadata = (await file.getMetadata()) as any; return { bounds: [header.minLon, header.minLat, header.maxLon, header.maxLat], diff --git a/viewer/src/PropertiesTable.svelte b/viewer/src/PropertiesTable.svelte index 79dc9dd..c7ba760 100644 --- a/viewer/src/PropertiesTable.svelte +++ b/viewer/src/PropertiesTable.svelte @@ -35,7 +35,7 @@ {/if} {#if properties.slope}
- Slope: [{properties.slope.toFixed(2)}, {-properties.slope.toFixed(2)}] + Slope: {properties.slope.toFixed(2)}%
{/if}
diff --git a/viewer/src/SidebarControls.svelte b/viewer/src/SidebarControls.svelte index e607358..5778037 100644 --- a/viewer/src/SidebarControls.svelte +++ b/viewer/src/SidebarControls.svelte @@ -1,8 +1,20 @@