Skip to content

Commit

Permalink
new colormaps for all LULC layers
Browse files Browse the repository at this point in the history
  • Loading branch information
davemfish committed Nov 9, 2023
1 parent d07fce4 commit 346e2bf
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 13 deletions.
18 changes: 18 additions & 0 deletions appdata/nlcd_colormap.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"11": "#3690eb",
"12": "#d1def8",
"21": "#EBC7E6",
"22": "#BFACE2",
"23": "#A084DC",
"24": "#645CBB",
"31": "#b3ac9f",
"41": "#A6BB8D",
"43": "#61876E",
"42": "#3C6255",
"52": "#EAE7B1",
"71": "#FFD95A",
"81": "#f7bb14",
"82": "#C07F00",
"90": "#89ccb2",
"95": "#4393ab"
}
27 changes: 27 additions & 0 deletions appdata/nlud_colormap.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"1": "#3690eb",
"2": "#4393ab",
"3": "#3690eb",
"11": "#645CBB",
"12": "#A084DC",
"13": "#BFACE2",
"14": "#EBC7E6",
"15": "#EBC7E6",
"20": "#df73ff",
"30": "#cccccc",
"40": "#df73ff",
"51": "#9c9c9c",
"52": "#9c9c9c",
"53": "#9c9c9c",
"60": "#df73ff",
"70": "#C07F00",
"80": "#f7bb14",
"90": "#cccccc",
"100": "#61876E",
"110": "#b3ac9f",
"120": "#4ce600",
"132": "#55ff00",
"134": "#4ce600",
"140": "#057548",
"152": "#267300"
}
6 changes: 6 additions & 0 deletions appdata/tree_colormap.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"0": "#ffffff",
"1": "#e5f5e0",
"2": "#a1d99b",
"3": "#31a354"
}
3 changes: 2 additions & 1 deletion frontend/src/edit/scenarioTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
} from '@blueprintjs/core';

import { toAcres } from '../utils';
import landuseCodes from '../../../appdata/lulc_crosswalk.json';

const LULC_TYPES = {
'nlcd': 'landcover',
Expand Down Expand Up @@ -91,7 +92,7 @@ export default function ScenarioTable(props) {
const cells = [];
cells.push(
<td key={category} className="row-name lulc-legend" style={{
// borderLeftColor: landuseCodes[code].color,
// borderLeftColor: landuseCodes[code][lulcType].color,
}}
>
{category}
Expand Down
1 change: 0 additions & 1 deletion frontend/src/map/lulcLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ export function lulcTileLayer(url, title, type, sourceOptions) {
sources: [{
url: publicUrl(url),
projection: 'EPSG:3857',
// nodata: -1,
}],
interpolate: false,
normalize: false,
Expand Down
22 changes: 11 additions & 11 deletions scripts/lulc_crosswalk.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,40 @@

df = pandas.read_csv('../appdata/lulc_crosswalk.csv')


def construct_nlud_names(row):
name = ''
if row.nlud_simple_class:
name += row.nlud_simple_class
if row.nlud_simple_subclass:
name += f' ({row.nlud_simple_subclass})'
# if row.nlcd_lulc:
# name += f' | {row.nlcd_lulc}'
return name


df = df.fillna('')
df['nlud_name'] = df.apply(construct_nlud_names, axis=1)
# df['name'] = \
# df['nlud_simple_class'] + ' | ' + \
# df['nlud_simple_subclass'] + ' | ' + \
# df['nlcd_lulc']

# data = dict(zip(df['lucode'], df['name']))
# data = {lucode: {'name': name} for lucode, name in zip(df['lucode'], df['name'])}
with open('../appdata/nlcd_colormap.json') as file:
nlcd_map = json.load(file)
with open('../appdata/nlud_colormap.json') as file:
nlud_map = json.load(file)
with open('../appdata/tree_colormap.json') as file:
tree_map = json.load(file)

data = {}
for idx, row in df.iterrows():
data[row.lucode] = {
'nlcd': {
'name': row.nlcd_lulc,
'color': row.nlcd_colors
'color': nlcd_map[str(row.nlcd)]
},
'nlud': {
'name': row.nlud_name,
'color': '#000000'
'color': nlud_map[str(row.nlud_simple)]
},
'tree': {
'name': row.tree_canopy_cover,
'color': row.tree_colors
'color': tree_map[str(row.tree)]
}
}

Expand Down

0 comments on commit 346e2bf

Please sign in to comment.