Created
January 8, 2026 04:48
-
-
Save pmgreen/f33c9024ef856aedc3800864a23ff5b3 to your computer and use it in GitHub Desktop.
Google Earth Engine JavaScript to get USDA TreeMap data for a defined area
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // This is just a start. | |
| // See: https://developers.google.com/earth-engine/datasets/catalog/USFS_GTAC_TreeMap_v2022 | |
| // Get the USDA TreeMap dataset | |
| var dataset = ee.ImageCollection('USFS/GTAC/TreeMap/v2022'); | |
| // 'Official' TreeMap 2016 palettes | |
| var bamako = ['00404d', '134b42', '265737', '3a652a', '52741c', '71870b', '969206', 'c5ae32', 'e7cd68', 'ffe599']; | |
| var bamako_r = JSON.parse(JSON.stringify(bamako)).reverse(); | |
| var lajolla = ['ffffcc','fbec9a','f4cc68','eca855','e48751','d2624d','a54742','73382f','422818','1a1a01']; | |
| var lajolla_r = JSON.parse(JSON.stringify(lajolla)).reverse(); | |
| var imola = ['1a33b3','2446a9','2e599f','396b94','497b85','60927b','7bae74','98cb6d','c4ea67','ffff66']; | |
| var imola_r = JSON.parse(JSON.stringify(imola)).reverse(); | |
| // Get the 2022 TreeMap data for the conterminous US | |
| var TreeMap = dataset.filter('year == "2022"') | |
| .filter('study_area == "CONUS"') | |
| .first(); | |
| // Load US Grainger county dataset | |
| var graingerCounty = ee.FeatureCollection('TIGER/2018/Counties') | |
| .filter(ee.Filter.eq('GEOID', '47057')); | |
| // Clip the data to Grainger County, TN | |
| var tm_grainger = TreeMap.clip(graingerCounty); | |
| var carbon_l = tm_grainger.select('CARBON_L'); | |
| var balive = tm_grainger.select('BALIVE'); | |
| var tmVis = { | |
| bands: ['Map'], | |
| }; | |
| // Set basemap | |
| Map.setOptions('TERRAIN'); | |
| Map.setCenter(-83.6562908309219, 36.326523130233674, 13); | |
| // Add layers | |
| Map.addLayer(carbon_l, {'min': 2, 'max': 59, 'palette': lajolla_r}, 'CARBON_L: Carbon, Live Above Ground (tons/acre)', true); | |
| Map.addLayer(balive, {'min': 24, 'max': 217, 'palette': bamako_r}, 'BALIVE: Live Tree Basal Area (ft²)', false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment