Skip to content

gi-nx


gi-nx / createGeoJSONLayer

ts
function createGeoJSONLayer(
   layerName: string, 
   fc: FeatureCollection, 
   layerMeta?: {
  boundary?: {
     geojson: string;
     wkid: number;
  };
  credentials?: {
     password?: string;
     token?: string;
     username?: string;
  };
  data_date?: string;
  default_group: string;
  description: string;
  meta: Record<any, any>;
  name: string;
  org_id: string;
  protected?: boolean;
  public?: boolean;
  public_url: boolean;
  tags?: string[];
}, 
   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;
}): Promise<void>;

Create a new GeoJSON layer from the provided data.

Parameters

ParameterType
layerNamestring
fcFeatureCollection
layerMeta.boundary?{ geojson: string; wkid: number; }
layerMeta.boundary.geojson?string
layerMeta.boundary.wkid?number
layerMeta.credentials?{ password?: string; token?: string; username?: string; }
layerMeta.credentials.password?string
layerMeta.credentials.token?string
layerMeta.credentials.username?string
layerMeta.data_date?string
layerMeta.default_group?string
layerMeta.description?string
layerMeta.meta?Record<any, any>
layerMeta.name?string
layerMeta.org_id?string
layerMeta.protected?boolean
layerMeta.public?boolean
layerMeta.public_url?boolean
layerMeta.tags?string[]
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; }

Returns

Promise<void>

Needs Permission

Example

typescript
// Basic usage
rpc.invoke("createGeoJSONLayer", ["Points of Interest", poiFeatureCollection]);

// With layer metadata and custom lens style
rpc.invoke("createGeoJSONLayer", [
  "Points of Interest",
  poiFeatureCollection,
  { tags: ["poi"] },
  { mainColor: { fixedValue: "red" } }
]);