Skip to content

PATTERNS

explain layer symbology

Methods for defining what colors in palettes mean on your map.

more forthcoming

define colors with legend

These methods take some or all of the following arguments.

ARGUMENT DESCRIPTION
“title” Label for the legend. Must be a string. Often a short description of image will do.
viz The viz dictionary that defines how to visualize (display) the data.
class_labels A list of names for each color in the palette that define the classes or categories of the data.
“position-on-map” Where to place the legend. Must be a string. Composed as “row - column”, where rows are “bottom”, “middle”, or “top” and columns are “left”, “center”, “right”. For example, “bottom-right”. There is no “middle-center”.

🌎 image with continuous data

If the image contains continuous or cyclical data, place a snapshot of the color gradient on the Map with labels that identify the minimum, maximum, and midpoint data value mapped to the color gradient.

// Make legend from image with continuous data. 

var legend_continuous = geo.iCart.legendContinuous(
  "title", 
  viz, 
  "position-on-map"
  )
;

// Add legend to Map.  

Map.add(legend_continuous);

🌎 from image with nominal data

If the image contains nominal (discrete) data, place a symbol dictionary that defines each swatch of the palette with a label, or name for the class.

// Make legend from image with nominal data.

var legend_nominal = geo.iCart.legendNominal(
  "title", 
  viz, 
  class_labels, 
  "position-on-map"
  )
;

// Add legend to Map.  

Map.add(legend_nominal);

This work is licensed under CC BY-NC-SA 4.0