/**** Start of imports. If edited, may not auto-convert in the playground. ****/
var forest_type = ee.ImageCollection("projects/sat-io/open-datasets/USFS/national-forest-type");
/***** End of imports. If edited, may not auto-convert in the playground. *****/
var image = forest_type.mosaic()
Map.setCenter(-102.22, 51.47,3)

image = image.remap([101,	102,	103,	104,	105,	121,	122,	123,	124,	125,	126,	127,	141,	142,	161,	162,	163,	164,	165,	166,	167,	168,	181,	182,	183,	184,	185,	201,	202,	221,	222,	223,	224,	241,	261,	262,	263,	264,	265,	266,	267,	268,	269,	270,	271,	281,	301,	304,	305,	321,	341,	342,	361,	362,	363,	364,	365,	366,	367,	368,	371,	381,	382,	383,	384,	385,	401,	402,	403,	404,	405,	406,	407,	409,	501,	502,	503,	504,	505,	506,	507,	508,	509,	510,	511,	512,	513,	514,	515,	519,	520,	601,	602,	605,	606,	607,	608,	701,	702,	703,	704,	705,	706,	707,	708,	709,	722,	801,	802,	803,	805,	807,	809,	901,	902,	904,	911,	912,	921,	922,	923,	924,	925,	926,	931,	932,	941,	942,	943,	951,	952,	953,	954,	955,	981,	982,	989,	991,	992,	993,	995,],
[1,	2,	3,	4,	5,	6,	7,	8,	9,	10,	11,	12,	13,	14,	15,	16,	17,	18,	19,	20,	21,	22,	23,	24,	25,	26,	27,	28,	29,	30,	31,	32,	33,	34,	35,	36,	37,	38,	39,	40,	41,	42,	43,	44,	45,	46,	47,	48,	49,	50,	51,	52,	53,	54,	55,	56,	57,	58,	59,	60,	61,	62,	63,	64,	65,	66,	67,	68,	69,	70,	71,	72,	73,	74,	75,	76,	77,	78,	79,	80,	81,	82,	83,	84,	85,	86,	87,	88,	89,	90,	91,	92,	93,	94,	95,	96,	97,	98,	99,	100,	101,	102,	103,	104,	105,	106,	107,	108,	109,	110,	111,	112,	113,	114,	115,	116,	117,	118,	119,	120,	121,	122,	123,	124,	125,	126,	127,	128,	129,	130,	131,	132,	133,	134,	135,	136,	137,	138,	139,	140,	141])

var dict = {
  "names": [
    "Jack pine",
    "Red pine",
    "Eastern white pine",
    "Eastern White pine / Eastern hemlock",
    "Eastern hemlock",
    "Balsam fir",
    "White spruce",
    "Red spruce",
    "Red spruce / balsam fir",
    "Black spruce",
    "Tamarack",
    "Northern white-cedar",
    "Longleaf pine",
    "Slash pine",
    "Loblolly pine",
    "Shortleaf pine",
    "Virginia pine",
    "Sand pine",
    "Table-mountain pine",
    "Pond pine",
    "Pitch pine",
    "Spruce pine",
    "Eastern redcedar",
    "Rocky Mountain juniper",
    "Western juniper",
    "Juniper woodland",
    "Pinyon juniper woodland",
    "Douglas-fir",
    "Port-Orford-cedar",
    "Ponderosa pine",
    "Incense cedar",
    "Jeffrey pine / Coulter pine / bigcone Douglas-fir",
    "Sugar pine",
    "Western white pine",
    "White fir",
    "Red fir",
    "Noble fir",
    "Pacific silver fir",
    "Engelmann spruce",
    "Engelmann spruce / subalpine fir",
    "Grand fir",
    "Subalpine fir",
    "Blue spruce",
    "Mountain hemlock",
    "Alaska-yellow-cedar",
    "Lodgepole pine",
    "Western hemlock",
    "Western redcedar",
    "Sitka spruce",
    "Western larch",
    "Redwood",
    "Giant sequoia",
    "Knobcone pine",
    "Southwest white pine",
    "Bishop pine",
    "Monterey pine",
    "Foxtail pine / bristlecone pine",
    "Limber pine",
    "Whitebark pine",
    "Misc. western softwoods",
    "California mixed conifer",
    "Scotch pine",
    "Australian pine",
    "Other exotic softwoods",
    "Norway Spruce",
    "Introduced larch",
    "Eastern white pine / N. red oak / white ash",
    "Eastern redcedar / hardwood",
    "Longleaf pine / oak",
    "Shortleaf pine / oak",
    "Virginia pine / southern red oak",
    "Loblolly pine / hardwood",
    "Slash pine / hardwood",
    "Other pine / hardwood",
    "Post oak / blackjack oak",
    "Chestnut oak",
    "White oak / red oak / hickory",
    "White oak",
    "Northern red oak",
    "Yellow-poplar / white oak / N. red oak",
    "Sassafras / persimmon",
    "Sweetgum / yellow-poplar",
    "Bur oak",
    "Scarlet oak",
    "Yellow-poplar",
    "Black walnut",
    "Black locust",
    "Southern scrub oak",
    "Chestnut oak / black oak / scarlet oak",
    "Red maple / oak",
    "Mixed upland hardwoods",
    "Swamp chestnut oak / cherrybark oak",
    "Sweetgum / Nuttall oak / willow oak",
    "Overcup oak / water hickory",
    "Atlantic white-cedar",
    "Baldcypress / water tupelo",
    "Sweetbay / swamp tupelo / red maple",
    "Black ash / American elm / red maple",
    "River birch / sycamore",
    "Cottonwood",
    "Willow",
    "Sycamore / pecan / American elm",
    "Sugarberry / hackberry / elm / green ash",
    "Silver maple / American elm",
    "Red maple / lowland",
    "Cottonwood / willow",
    "Oregon ash",
    "Sugar maple / beech / yellow birch",
    "Black cherry",
    "Cherry / ash / yellow-poplar",
    "Hard maple / basswood",
    "Elm / ash / locust",
    "Red maple / upland",
    "Aspen",
    "Paper birch",
    "Balsam poplar",
    "Red alder",
    "Bigleaf maple",
    "Gray pine",
    "California black oak",
    "Oregon white oak",
    "Blue oak",
    "Deciduous oak woodland",
    "Evergreen oak woodland",
    "Coast live oak",
    "Canyon live oak / interior live oak",
    "Tanoak",
    "Califonia laurel",
    "Giant chinkapin",
    "Pacific madrone",
    "Mesquite Woodland",
    "Cercocarpus woodland",
    "Intermountain maple woodland",
    "Misc. western hardwood woodlands",
    "Sabal palm",
    "Mangrove",
    "Other tropical",
    "Paulownia",
    "Melaluca",
    "Eucalyptus",
    "Other exotic hardwoods",


  ],
  "colors": [
    "#ccaf89",
    "#ccaa87",
    "#cca884",
    "#cca582",
    "#cca082",
    "#cc9b7f",
    "#cc987c",
    "#cc937c",
    "#cc8e7a",
    "#cc8977",
    "#cc8275",
    "#cc7c75",
    "#cc7772",
    "#cc7070",
    "#cc7075",
    "#cc6d77",
    "#cc6b7a",
    "#cc687c",
    "#cc6882",
    "#cc6684",
    "#cc6689",
    "#cc608c",
    "#cc6091",
    "#cc5e93",
    "#cc5b98",
    "#cc599b",
    "#cc59a0",
    "#cc56a3",
    "#cc54a8",
    "#cc51aa",
    "#333333",
    "#cc51af",
    "#cc4fb2",
    "#cc4cb7",
    "#cc49ba",
    "#cc49bc",
    "#cc44c1",
    "#cc44c1",
    "#cc42c6",
    "#cc3fc9",
    "#cc3dc9",
    "#cc3dcc",
    "#cc3acc",
    "#cc38cc",
    "#cc35cc",
    "#cc33cc",
    "#cc33cc",
    "#cc30cc",
    "#c92dcc",
    "#c92bce",
    "#c628ce",
    "#c128ce",
    "#bf28cc",
    "#545454",
    "#565656",
    "#565656",
    "#ba26cc",
    "#b726cc",
    "#b223cc",
    "#ad23c9",
    "#a823c6",
    "#a321c6",
    "#5b5b5b",
    "#9b21c4",
    "#9321c4",
    "#5b5b5b",
    "#8e21c1",
    "#8721c1",
    "#7f1ec1",
    "#771ec1",
    "#701cbf",
    "#661cbc",
    "#5b1cbc",
    "#511cba",
    "#4719ba",
    "#3d19ba",
    "#3019ba",
    "#2316b5",
    "#1616b5",
    "#1621b5",
    "#162db2",
    "#143ab2",
    "#1444af",
    "#144caf",
    "#1156ad",
    "#1160aa",
    "#1168aa",
    "#1170aa",
    "#1175aa",
    "#0f7ca8",
    "#0f82a5",
    "#0f87a5",
    "#0c8ca3",
    "#0c8ca3",
    "#0c91a3",
    "#0c93a0",
    "#0c939e",
    "#0c939e",
    "#0a969b",
    "#0a969b",
    "#0a9698",
    "#0a9698",
    "#0a9396",
    "#0a9393",
    "#079393",
    "#079193",
    "#079191",
    "#078e8e",
    "#058c8c",
    "#058c8c",
    "#058c8c",
    "#058989",
    "#058787",
    "#058784",
    "#058484",
    "#028282",
    "#028282",
    "#02827c",
    "#027c7c",
    "#027c77",
    "#007c77",
    "#007a75",
    "#007770",
    "#00756d",
    "#00756b",
    "#007266",
    "#007260",
    "#00705b",
    "#006d59",
    "#006d51",
    "#006b4c",
    "#006b44",
    "#00683d",
    "#006633",
    "#006626",
    "#00631c",
    "#f9f9d3",
    "#f9f9e0",
    "#f9f9e5",
    "#00600c",
    "#006000",

  ]};

//Map.setCenter(-97.61655457157725,55.6280720462063,4)

// Add image to the map
Map.addLayer(image, {min:1, max:141, palette:dict['colors']}, 'US Tree Species')
/////////////////////////////////////////////////////////////////////////
var legend = ui.Panel({
  style: {
    position: 'middle-right',
    padding: '8px 15px'
  }
});

// Create and add the legend title.
var legendTitle = ui.Label({
  value: 'US National Forest Types',
  style: {
    fontWeight: 'bold',
    fontSize: '18px',
    margin: '0 0 4px 0',
    padding: '0'
  }
});
legend.add(legendTitle);

var loading = ui.Label('Loading legend...', {margin: '2px 0 4px 0'});
legend.add(loading);

  // Creates and styles 1 row of the legend.
  var makeRow = function(color, name) {
    // Create the label that is actually the colored box.
    var colorBox = ui.Label({
      style: {
        backgroundColor: color,
        // Use padding to give the box height and width.
        padding: '8px',
        margin: '0 0 4px 0'
      }
    });

  // Create the label filled with the description text.
  var description = ui.Label({
    value: name,
    style: {margin: '0 0 4px 6px'}
  });

  return ui.Panel({
    widgets: [colorBox, description],
    layout: ui.Panel.Layout.Flow('horizontal')
  });
};
  var palette = dict['colors'];
  var names = dict['names'];
  loading.style().set('shown', false);

  for (var i = 0; i < names.length; i++) {
    legend.add(makeRow(palette[i], names[i]));
  }

// Print the panel containing the legend
print(legend);

var Dark
 = 
[
  {
    "featureType": "all",
    "elementType": "labels",
    "stylers": [
      {
        "visibility": "off"
      }
    ]
  },
  {
    "featureType": "all",
    "elementType": "labels.text",
    "stylers": [
      {
        "visibility": "off"
      }
    ]
  },
  {
    "featureType": "all",
    "elementType": "labels.text.fill",
    "stylers": [
      {
        "saturation": 36
      },
      {
        "color": "#000000"
      },
      {
        "lightness": 40
      }
    ]
  },
  {
    "featureType": "all",
    "elementType": "labels.text.stroke",
    "stylers": [
      {
        "visibility": "on"
      },
      {
        "color": "#000000"
      },
      {
        "lightness": 16
      }
    ]
  },
  {
    "featureType": "all",
    "elementType": "labels.icon",
    "stylers": [
      {
        "visibility": "off"
      }
    ]
  },
  {
    "featureType": "administrative",
    "elementType": "geometry",
    "stylers": [
      {
        "visibility": "on"
      }
    ]
  },
  {
    "featureType": "administrative",
    "elementType": "geometry.fill",
    "stylers": [
      {
        "color": "#000000"
      },
      {
        "lightness": 20
      }
    ]
  },
  {
    "featureType": "administrative",
    "elementType": "geometry.stroke",
    "stylers": [
      {
        "color": "#000000"
      },
      {
        "lightness": 17
      },
      {
        "weight": 1.2
      }
    ]
  },
  {
    "featureType": "administrative",
    "elementType": "labels",
    "stylers": [
      {
        "visibility": "off"
      }
    ]
  },
  {
    "featureType": "administrative",
    "elementType": "labels.text",
    "stylers": [
      {
        "visibility": "off"
      }
    ]
  },
  {
    "featureType": "landscape",
    "elementType": "geometry",
    "stylers": [
      {
        "color": "#000000"
      },
      {
        "lightness": 20
      }
    ]
  },
  {
    "featureType": "landscape",
    "elementType": "labels.text",
    "stylers": [
      {
        "visibility": "off"
      }
    ]
  },
  {
    "featureType": "poi",
    "elementType": "geometry",
    "stylers": [
      {
        "color": "#000000"
      },
      {
        "lightness": 21
      }
    ]
  },
  {
    "featureType": "poi",
    "elementType": "labels.text",
    "stylers": [
      {
        "visibility": "off"
      }
    ]
  },
  {
    "featureType": "road",
    "elementType": "geometry.fill",
    "stylers": [
      {
        "visibility": "simplified"
      },
      {
        "color": "#8a4040"
      }
    ]
  },
  {
    "featureType": "road",
    "elementType": "geometry.stroke",
    "stylers": [
      {
        "visibility": "on"
      },
      {
        "color": "#ffffff"
      }
    ]
  },
  {
    "featureType": "road",
    "elementType": "labels.text",
    "stylers": [
      {
        "visibility": "off"
      }
    ]
  },
  {
    "featureType": "road.highway",
    "elementType": "geometry.fill",
    "stylers": [
      {
        "color": "#000000"
      },
      {
        "lightness": 17
      }
    ]
  },
  {
    "featureType": "road.highway",
    "elementType": "geometry.stroke",
    "stylers": [
      {
        "color": "#000000"
      },
      {
        "lightness": 29
      },
      {
        "weight": 0.2
      }
    ]
  },
  {
    "featureType": "road.arterial",
    "elementType": "geometry",
    "stylers": [
      {
        "color": "#000000"
      },
      {
        "lightness": 18
      }
    ]
  },
  {
    "featureType": "road.arterial",
    "elementType": "geometry.fill",
    "stylers": [
      {
        "color": "#ffffff"
      },
      {
        "visibility": "on"
      }
    ]
  },
  {
    "featureType": "road.local",
    "elementType": "geometry",
    "stylers": [
      {
        "color": "#000000"
      },
      {
        "lightness": 16
      }
    ]
  },
  {
    "featureType": "road.local",
    "elementType": "geometry.fill",
    "stylers": [
      {
        "visibility": "on"
      },
      {
        "color": "#faf2f2"
      }
    ]
  },
  {
    "featureType": "transit",
    "elementType": "geometry",
    "stylers": [
      {
        "color": "#000000"
      },
      {
        "lightness": 19
      }
    ]
  },
  {
    "featureType": "transit",
    "elementType": "labels",
    "stylers": [
      {
        "visibility": "off"
      }
    ]
  },
  {
    "featureType": "transit",
    "elementType": "labels.text",
    "stylers": [
      {
        "visibility": "off"
      }
    ]
  },
  {
    "featureType": "water",
    "elementType": "geometry",
    "stylers": [
      {
        "color": "#b4bcc2"
      },
      {
        "lightness": 17
      }
    ]
  },
  {
    "featureType": "water",
    "elementType": "labels",
    "stylers": [
      {
        "visibility": "on"
      }
    ]
  },
  {
    "featureType": "water",
    "elementType": "labels.text",
    "stylers": [
      {
        "visibility": "off"
      }
    ]
  }
]
Map.setOptions('Dark', {Dark
: Dark
})