Skip to content

gi-nx


gi-nx / addTempLayer

ts
function addTempLayer(
   layerName: string, 
   style?: MapboxStyleLayer, 
   lens?: {
  aggregateBy?: string;
  columnDef?: Record<string, LensTypedProperty>;
  columnKeys?: string[];
  filter?: AdvancedFeatureFilter;
  filterMode?: FilterMode;
  promoteId?: string;
  sortBy?: SortBy[];
  sortDescending?: boolean;
  sourceLayer?: string;
} & {
  baseHeightKey?: string;
  circleRadius?: number;
  cluster?: boolean;
  clusterColor?: string;
  displayKeys?: string[];
  fillOpacity?: number;
  heightKey?: string;
  heightScale?: number;
  iconColor?: ColorPaletteOrFixed;
  iconHaloColor?: ColorPaletteOrFixed;
  iconImage?: string;
  iconSize?: number;
  lineColor?: ColorPaletteOrFixed;
  lineDimension?: "meters" | "pixels";
  lineWidth?: number;
  mainColor?: ColorPaletteOrFixed;
  mainLayer?: "fill" | "fill-extrusion" | "circle" | "icon" | "model" | "giraffe-baked";
  overrideCircle?: Pick<CircleLayerSpecification, "paint">;
  overrideFill?: Pick<FillLayerSpecification, "paint">;
  overrideFillExtrusion?: Pick<FillExtrusionLayerSpecification, "paint" | "layout">;
  overrideIcon?: Pick<SymbolLayerSpecification, "paint" | "layout">;
  overrideLabel?: Pick<SymbolLayerSpecification, "paint" | "layout">;
  overrideLine?: Pick<LineLayerSpecification, "paint" | "layout">;
  overrideModel?: Pick<ModelLayerSpecification, "paint" | "layout">;
  primaryLabelMaxChars?: number;
  props?: PropToProp[];
  showLabels?: boolean;
  showLines?: boolean;
  showPalette?: LensPaletteKey;
  showTable?: boolean;
  showValuesOnly?: boolean;
  tableColumnWidths?: Record<string, number>;
  textColor?: ColorPaletteOrFixed;
  textHaloColor?: ColorPaletteOrFixed;
}, 
   hideInTree?: boolean, 
   opacity?: number): string;

add (or update the style of) a temporary (exists only for the current session/client) layer with a tiled source NB the source cannot be updated once the layer has been added, but the style can. To update the source, remove the layer and re-add it.

Parameters

ParameterType
layerNamestring
style?MapboxStyleLayer
lens?{ aggregateBy?: string; columnDef?: Record<string, LensTypedProperty>; columnKeys?: string[]; filter?: AdvancedFeatureFilter; filterMode?: FilterMode; promoteId?: string; sortBy?: SortBy[]; sortDescending?: boolean; sourceLayer?: string; } & { baseHeightKey?: string; circleRadius?: number; cluster?: boolean; clusterColor?: string; displayKeys?: string[]; fillOpacity?: number; heightKey?: string; heightScale?: number; iconColor?: ColorPaletteOrFixed; iconHaloColor?: ColorPaletteOrFixed; iconImage?: string; iconSize?: number; lineColor?: ColorPaletteOrFixed; lineDimension?: "meters" | "pixels"; lineWidth?: number; mainColor?: ColorPaletteOrFixed; mainLayer?: "fill" | "fill-extrusion" | "circle" | "icon" | "model" | "giraffe-baked"; overrideCircle?: Pick<CircleLayerSpecification, "paint">; overrideFill?: Pick<FillLayerSpecification, "paint">; overrideFillExtrusion?: Pick<FillExtrusionLayerSpecification, "paint" | "layout">; overrideIcon?: Pick<SymbolLayerSpecification, "paint" | "layout">; overrideLabel?: Pick<SymbolLayerSpecification, "paint" | "layout">; overrideLine?: Pick<LineLayerSpecification, "paint" | "layout">; overrideModel?: Pick<ModelLayerSpecification, "paint" | "layout">; primaryLabelMaxChars?: number; props?: PropToProp[]; showLabels?: boolean; showLines?: boolean; showPalette?: LensPaletteKey; showTable?: boolean; showValuesOnly?: boolean; tableColumnWidths?: Record<string, number>; textColor?: ColorPaletteOrFixed; textHaloColor?: ColorPaletteOrFixed; }
hideInTree?boolean
opacity?number

Returns

string