diff --git a/appdata/nlcd_colormap.json b/appdata/nlcd_colormap.json new file mode 100644 index 0000000..486b031 --- /dev/null +++ b/appdata/nlcd_colormap.json @@ -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" +} diff --git a/appdata/nlud_colormap.json b/appdata/nlud_colormap.json new file mode 100644 index 0000000..c719d94 --- /dev/null +++ b/appdata/nlud_colormap.json @@ -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" +} \ No newline at end of file diff --git a/appdata/tree_colormap.json b/appdata/tree_colormap.json new file mode 100644 index 0000000..e743ecb --- /dev/null +++ b/appdata/tree_colormap.json @@ -0,0 +1,6 @@ +{ + "0": "#ffffff", + "1": "#e5f5e0", + "2": "#a1d99b", + "3": "#31a354" +} \ No newline at end of file diff --git a/frontend/src/edit/scenarioTable.jsx b/frontend/src/edit/scenarioTable.jsx index 968e940..b530d6c 100644 --- a/frontend/src/edit/scenarioTable.jsx +++ b/frontend/src/edit/scenarioTable.jsx @@ -7,6 +7,7 @@ import { } from '@blueprintjs/core'; import { toAcres } from '../utils'; +import landuseCodes from '../../../appdata/lulc_crosswalk.json'; const LULC_TYPES = { 'nlcd': 'landcover', @@ -91,7 +92,7 @@ export default function ScenarioTable(props) { const cells = []; cells.push( {category} diff --git a/frontend/src/map/lulcLayer.js b/frontend/src/map/lulcLayer.js index 84b6e12..3663a0d 100644 --- a/frontend/src/map/lulcLayer.js +++ b/frontend/src/map/lulcLayer.js @@ -51,7 +51,6 @@ export function lulcTileLayer(url, title, type, sourceOptions) { sources: [{ url: publicUrl(url), projection: 'EPSG:3857', - // nodata: -1, }], interpolate: false, normalize: false, diff --git a/scripts/lulc_crosswalk.py b/scripts/lulc_crosswalk.py index 27841af..ad2346b 100644 --- a/scripts/lulc_crosswalk.py +++ b/scripts/lulc_crosswalk.py @@ -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)] } }