UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

788 lines (786 loc) • 44.8 kB
import type PopupTemplate from "../../PopupTemplate.js"; import type FormTemplate from "../../form/FormTemplate.js"; import type Extent from "../../geometry/Extent.js"; import type KnowledgeGraphLayer from "../KnowledgeGraphLayer.js"; import type Layer from "../Layer.js"; import type LinkChartLayer from "../LinkChartLayer.js"; import type FeatureTemplate from "../support/FeatureTemplate.js"; import type Field from "../support/Field.js"; import type FieldsIndex from "../support/FieldsIndex.js"; import type LabelClass from "../support/LabelClass.js"; import type GraphObjectType from "../../rest/knowledgeGraph/GraphObjectType.js"; import type FeatureSet from "../../rest/support/FeatureSet.js"; import type Query from "../../rest/support/Query.js"; import type ElevationInfo from "../../symbols/support/ElevationInfo.js"; import type { MultiOriginJSONSupportMixin } from "../../core/MultiOriginJSONSupport.js"; import type { FeatureGeometryType } from "../../geometry/types.js"; import type { FeatureLayerCapabilities, FieldDomainOptions } from "../types.js"; import type { BlendLayer, BlendLayerProperties } from "../mixins/BlendLayer.js"; import type { DisplayFilteredLayer, DisplayFilteredLayerProperties } from "../mixins/DisplayFilteredLayer.js"; import type { FeatureEffectLayer, FeatureEffectLayerProperties } from "../mixins/FeatureEffectLayer.js"; import type { FeatureReductionLayer, FeatureReductionLayerProperties } from "../mixins/FeatureReductionLayer.js"; import type { OrderedLayer, OrderedLayerProperties } from "../mixins/OrderedLayer.js"; import type { RefreshableLayer, RefreshableLayerProperties } from "../mixins/RefreshableLayer.js"; import type { ScaleRangeLayer, ScaleRangeLayerProperties } from "../mixins/ScaleRangeLayer.js"; import type { TemporalLayer, TemporalLayerProperties } from "../mixins/TemporalLayer.js"; import type { DomainUnion } from "../support/types.js"; import type { RendererUnion } from "../../renderers/types.js"; import type { RequestOptions } from "../../request/types.js"; import type { QueryProperties } from "../../rest/support/Query.js"; import type { CreatePopupTemplateOptions } from "../../support/popupUtils.js"; import type { ObjectId } from "../../views/types.js"; import type { ElevationInfoProperties } from "../../symbols/support/ElevationInfo.js"; import type { FormTemplateProperties } from "../../form/FormTemplate.js"; import type { LabelClassProperties } from "../support/LabelClass.js"; import type { PopupTemplateProperties } from "../../PopupTemplate.js"; import type { HeatmapRendererProperties } from "../../renderers/HeatmapRenderer.js"; import type { PieChartRendererProperties } from "../../renderers/PieChartRenderer.js"; import type { DictionaryRendererProperties } from "../../renderers/DictionaryRenderer.js"; import type { DotDensityRendererProperties } from "../../renderers/DotDensityRenderer.js"; import type { UniqueValueRendererProperties } from "../../renderers/UniqueValueRenderer.js"; import type { ClassBreaksRendererProperties } from "../../renderers/ClassBreaksRenderer.js"; import type { SimpleRendererProperties } from "../../renderers/SimpleRenderer.js"; import type { FeatureTemplateProperties } from "../support/FeatureTemplate.js"; import type { LayerProperties } from "../Layer.js"; export interface KnowledgeGraphSublayerProperties extends LayerProperties, RefreshableLayerProperties, ScaleRangeLayerProperties, TemporalLayerProperties, OrderedLayerProperties, BlendLayerProperties, FeatureEffectLayerProperties, FeatureReductionLayerProperties, DisplayFilteredLayerProperties, Partial<Pick<KnowledgeGraphSublayer, "definitionExpression" | "graphType" | "labelsVisible" | "legendEnabled" | "objectIdField" | "objectType" | "parentCompositeLayer" | "popupEnabled">> { /** * Specifies how features are placed on the vertical axis (z). This property may only be used * in a [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/). See the [ElevationInfo sample](https://developers.arcgis.com/javascript/latest/sample-code/scene-elevationinfo/) * for an example of how this property may be used. * * > [!WARNING] * > * > **Known Limitations** * > * > KnowledgeGraphServices do not currently support Z-values. * > If the elevation info is not specified, the effective elevation depends on the context and could vary per graphic. */ elevationInfo?: ElevationInfoProperties | null; /** * The [template](https://developers.arcgis.com/javascript/latest/references/core/form/FormTemplate/) used in an associated layer's [FeatureForm](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureForm/). * All of the properties and field configurations set on the layer's [FeatureForm](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureForm/) are handled via * the [FormTemplate](https://developers.arcgis.com/javascript/latest/references/core/form/FormTemplate/). * * @since 4.34 * @example * // Create the Field Elements to pass into the template * const fieldElement1 = new FieldElement({ * fieldName: "firstname", * label: "First name", * description: "First name of emergency contact" * }); * * const fieldElement2 = new FieldElement({ * fieldName: "lastname", * label: "Last name", * description: "Last name of emergency contact" * }); * * // Create the form's template * const formTemplate = new FormTemplate({ * title: "Emergency information", * description: "In case of emergency, update any additional information needed", * elements: [fieldElement1, fieldElement2] // pass in array of field elements from above * }); * * // Pass the template to the layer * knowledgeGraphSublayer.formTemplate = formTemplate; * * // Pass the layer to the FeatureForm * const form = new FeatureForm({ * container: "form", // html div referencing the form * layer: knowledgeGraphSublayer * }) */ formTemplate?: FormTemplateProperties | null; /** * The label definition for this sublayer, specified as an array of * [label classes](https://developers.arcgis.com/javascript/latest/references/core/layers/support/LabelClass/). Use this property to specify * labeling properties for the sublayer such as label expression, placement, and size. * * Multiple Label classes with different `where` clauses can be used to define several * labels with varying styles on the same feature. Likewise, multiple label classes * may be used to label different types of features (for example blue labels * for lakes and green labels for parks). * * See the [Labeling guide page](https://developers.arcgis.com/javascript/latest/labeling/) for more information and known limitations. * * @see [Sample: Add multiple label classes to a layer](https://developers.arcgis.com/javascript/latest/sample-code/labels-multiple-classes/) * @see [Sample: Multi-line labels](https://developers.arcgis.com/javascript/latest/sample-code/labels-multiline/) * @see [Sample: Flat vs. volumetric 3D symbol layers](https://developers.arcgis.com/javascript/latest/sample-code/symbols-points-3d/) * @example * const statesLabelClass = new LabelClass({ * labelExpressionInfo: { expression: "$feature.NAME" }, * symbol: { * type: "text", // autocasts as new TextSymbol() * color: "black", * haloSize: 1, * haloColor: "white" * } * }); * * knowledgeGraphLayer.layers.items[0].labelingInfo = [ statesLabelClass ]; */ labelingInfo?: LabelClassProperties[] | null; /** * The maximum scale (most zoomed in) at which the layer is visible in the view. * If the map is zoomed in beyond this scale, the layer will not be visible. * A value of 0 means the layer does not have a maximum scale. * The maxScale value should always be smaller than the [minScale](https://developers.arcgis.com/javascript/latest/references/core/layers/knowledgeGraph/KnowledgeGraphSublayer/#minScale) value, and greater than or equal to the service specification. * * @default 0 * @example * // The layer will not be visible when the view is zoomed in beyond a scale of 1:1,000 * layer.maxScale = 1000; * @example * // The layer's visibility is not restricted to a maximum scale. * layer.maxScale = 0; */ maxScale?: number; /** * The minimum scale (most zoomed out) at which the layer is visible in the view. * If the map is zoomed out beyond this scale, the layer will not be visible. * A value of 0 means the layer does not have a minimum scale. * The minScale value should always be larger than the [maxScale](https://developers.arcgis.com/javascript/latest/references/core/layers/knowledgeGraph/KnowledgeGraphSublayer/#maxScale) value, and lesser than or equal to the service specification. * * @default 0 * @example * // The layer will not be visible when the view is zoomed out beyond a scale of 1:3,000,000 * layer.minScale = 3000000; * @example * // The layer's visibility is not restricted to a minimum scale. * layer.minScale = 0; */ minScale?: number; /** * The popup template for the sublayer. When set on the sublayer, the `popupTemplate` * allows users to access attributes and display their values in the * view's Popup when a feature is selected * using text and/or charts. . * * A default popup template is automatically used if no `popupTemplate` has been defined when * [Popup.defaultPopupTemplateEnabled](https://developers.arcgis.com/javascript/latest/references/core/widgets/Popup/#defaultPopupTemplateEnabled) * is set to `true`. * * @see [createPopupTemplate()](https://developers.arcgis.com/javascript/latest/references/core/layers/knowledgeGraph/KnowledgeGraphSublayer/#createPopupTemplate) * @see [SceneView.popup](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#popup) * @see [View2D.popup](https://developers.arcgis.com/javascript/latest/references/core/views/View2D/#popup) */ popupTemplate?: PopupTemplateProperties | null; /** * The renderer assigned to the sublayer. The renderer defines how to * visualize each feature in the sublayer. Depending on the renderer type, * features may be visualized with the same symbol, or with varying symbols * based on the values of provided attribute fields or functions. * * @see [Styles and data visualization](https://developers.arcgis.com/javascript/latest/visualization/) * @example * // all features in the sublayer will be visualized with * // a 6pt black marker symbol and a thin, white outline * * //Apply renderer to the first sublayer of the KnowledgeGraphLayer * const sublayer = knowledgeGraphLayer.layers.items[0]; * sublayer.renderer = { * type: "simple", // autocasts as new SimpleRenderer() * symbol: { * type: "simple-marker", // autocasts as new SimpleMarkerSymbol() * size: 6, * color: "black", * outline: { // autocasts as new SimpleLineSymbol() * width: 0.5, * color: "white" * } * } * }; */ renderer?: (((SimpleRendererProperties & { type: "simple" }) | (ClassBreaksRendererProperties & { type: "class-breaks" }) | (UniqueValueRendererProperties & { type: "unique-value" }) | (DotDensityRendererProperties & { type: "dot-density" }) | (DictionaryRendererProperties & { type: "dictionary" }) | (PieChartRendererProperties & { type: "pie-chart" })) | (HeatmapRendererProperties & { type: "heatmap" })) | null; /** * An array of feature templates defined in the knowledge graph sublayer. * * @since 4.34 */ templates?: FeatureTemplateProperties[] | null; } /** * A KnowledgeGraphSublayer is a sublayer of a [KnowledgeGraphLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/KnowledgeGraphLayer/) or [LinkChartLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/LinkChartLayer/) * that contains all instances of a named type. For example, lets say a [knowledge graph](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/KnowledgeGraph/) has `Supplier`, `Part`, and `Manufacturer` as * [entity types](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/EntityType/) and `buys_part` and `makes_part` as [relationship types](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/RelationshipType/). * * * When knowledge graph data is added to a map, each of the named types is a sublayer in the KnowledgeGraphLayer. * Each sublayer contains all of the [Entity](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/Entity/) * or [Relationship](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/Relationship/) instances for that named type. * Sublayers of spatial entity types contain features that will be added to the map or displayed in geographic layout on a link chart. * * @since 4.26 * @see [Sample - Working with KnowledgeGraphLayer](https://developers.arcgis.com/javascript/latest/sample-code/knowledgegraph-knowledgegraphlayer/) * @see [LinkChartLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/LinkChartLayer/) * @see [KnowledgeGraphLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/KnowledgeGraphLayer/) * @see [knowledgeGraphService](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraphService/) * @example * //to access individual sublayers in a KnowledgeGraphLayer * knowledgeGraphLayer.layers.items.forEach((sublayer)=>{ * sublayer.popupTemplate = new PopupTemplate({ * title: "{common_name}", * content: [{ * type: "text", * text: "Scientific Name: {name}" * }] * }); * }) */ export default class KnowledgeGraphSublayer extends KnowledgeGraphSublayerSuperclass { constructor(properties?: KnowledgeGraphSublayerProperties); /** * Describes the layer's supported capabilities. * * @example * // Print the maximum number of features that will be returned per server request. * layer.when(() => { * console.log(`Maximum number of records: ${layer.capabilities.query.maxRecordCount}`); * } */ get capabilities(): FeatureLayerCapabilities; /** The definition of the default popup template for the sublayer. */ get defaultPopupTemplate(): PopupTemplate | null | undefined; /** * The SQL where clause used to filter features on the client. Only the features that satisfy the definition * expression are displayed in the [View](https://developers.arcgis.com/javascript/latest/references/core/views/View/). A definition expression is different from an * [inclusion list](https://developers.arcgis.com/javascript/latest/references/core/layers/knowledgeGraph/types/#InclusionModeDefinition) because it is applied after * the [parent KnowledgeGraphLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/knowledgeGraph/KnowledgeGraphSublayer/#parentCompositeLayer) is returned. Setting a definition expression is useful * when the dataset is large and you don't want to bring all features to the client for analysis. * * @example * // Set the definition expression directly on sublayer instance to only suppliers with more than 50 employees. * knowledgeGraphLayer.layers.items[0].definitionExpression = "employee_count > 50"; */ accessor definitionExpression: string | null | undefined; /** * Specifies how features are placed on the vertical axis (z). This property may only be used * in a [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/). See the [ElevationInfo sample](https://developers.arcgis.com/javascript/latest/sample-code/scene-elevationinfo/) * for an example of how this property may be used. * * > [!WARNING] * > * > **Known Limitations** * > * > KnowledgeGraphServices do not currently support Z-values. * > If the elevation info is not specified, the effective elevation depends on the context and could vary per graphic. */ get elevationInfo(): ElevationInfo | null | undefined; set elevationInfo(value: ElevationInfoProperties | null | undefined); /** * An array of fields in the layer. Each field represents an attribute * that may contain a value for each feature in the layer. * * @example * // define each field's schema * const fields = [ * new Field({ * name: "ObjectID", * alias: "ObjectID", * type: "oid" * }), new Field({ * name: "description", * alias: "Description", * type: "string" * }), new Field ({ * name: "title", * alias: "Title", * type: "string" * }) * ]; */ get fields(): Field[]; /** * A convenient property that can be used to make case-insensitive lookups for a field by name. * It can also provide a list of the [date fields](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FieldsIndex/#dateFields) in a layer. * * @example * // lookup a field by name. name is case-insensitive * const field = layer.fieldsIndex.get("SoMeFiEld"); * * if (field) { * console.log(field.name); // SomeField * } */ readonly fieldsIndex: FieldsIndex<Field>; /** * The [template](https://developers.arcgis.com/javascript/latest/references/core/form/FormTemplate/) used in an associated layer's [FeatureForm](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureForm/). * All of the properties and field configurations set on the layer's [FeatureForm](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureForm/) are handled via * the [FormTemplate](https://developers.arcgis.com/javascript/latest/references/core/form/FormTemplate/). * * @since 4.34 * @example * // Create the Field Elements to pass into the template * const fieldElement1 = new FieldElement({ * fieldName: "firstname", * label: "First name", * description: "First name of emergency contact" * }); * * const fieldElement2 = new FieldElement({ * fieldName: "lastname", * label: "Last name", * description: "Last name of emergency contact" * }); * * // Create the form's template * const formTemplate = new FormTemplate({ * title: "Emergency information", * description: "In case of emergency, update any additional information needed", * elements: [fieldElement1, fieldElement2] // pass in array of field elements from above * }); * * // Pass the template to the layer * knowledgeGraphSublayer.formTemplate = formTemplate; * * // Pass the layer to the FeatureForm * const form = new FeatureForm({ * container: "form", // html div referencing the form * layer: knowledgeGraphSublayer * }) */ get formTemplate(): FormTemplate | null | undefined; set formTemplate(value: FormTemplateProperties | null | undefined); /** The name of the geometry field for the sublayer. */ get geometryFieldName(): string | null | undefined; /** The geometry type of features in the sublayer. */ get geometryType(): FeatureGeometryType | null | undefined; /** * Specifies whether the sublayer represents an [entity type](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/EntityType/) * or [relationship type](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/RelationshipType/). */ accessor graphType: "entity" | "relationship"; /** * Indicates whether the features in the sublayer have `M` (measurement) values. * Use the `supportsM` property in the KnowledgeGraphSublayer's [capabilities.data](https://developers.arcgis.com/javascript/latest/references/core/layers/knowledgeGraph/KnowledgeGraphSublayer/#capabilities) * object to verify if `M` values are supported. * * @default false */ get hasM(): boolean; /** * Indicates whether the features in the layer have `Z` (elevation) values. * Refer to [elevationInfo](https://developers.arcgis.com/javascript/latest/references/core/layers/knowledgeGraph/KnowledgeGraphSublayer/#elevationInfo) for details regarding placement and rendering * of features with z-values in 3D [SceneViews](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/). * Use the `supportsZ` property in the KnowledgeGraphSublayer's [capabilities.data](https://developers.arcgis.com/javascript/latest/references/core/layers/knowledgeGraph/KnowledgeGraphSublayer/#capabilities) * object to verify if `Z` values are supported. * > [!WARNING] * > * > **Known Limitations** * > * > KnowledgeGraphService's do not currently support Z-values. * * @default false */ get hasZ(): boolean; /** The unique ID assigned to the layer. */ get id(): string; /** * The label definition for this sublayer, specified as an array of * [label classes](https://developers.arcgis.com/javascript/latest/references/core/layers/support/LabelClass/). Use this property to specify * labeling properties for the sublayer such as label expression, placement, and size. * * Multiple Label classes with different `where` clauses can be used to define several * labels with varying styles on the same feature. Likewise, multiple label classes * may be used to label different types of features (for example blue labels * for lakes and green labels for parks). * * See the [Labeling guide page](https://developers.arcgis.com/javascript/latest/labeling/) for more information and known limitations. * * @see [Sample: Add multiple label classes to a layer](https://developers.arcgis.com/javascript/latest/sample-code/labels-multiple-classes/) * @see [Sample: Multi-line labels](https://developers.arcgis.com/javascript/latest/sample-code/labels-multiline/) * @see [Sample: Flat vs. volumetric 3D symbol layers](https://developers.arcgis.com/javascript/latest/sample-code/symbols-points-3d/) * @example * const statesLabelClass = new LabelClass({ * labelExpressionInfo: { expression: "$feature.NAME" }, * symbol: { * type: "text", // autocasts as new TextSymbol() * color: "black", * haloSize: 1, * haloColor: "white" * } * }); * * knowledgeGraphLayer.layers.items[0].labelingInfo = [ statesLabelClass ]; */ get labelingInfo(): LabelClass[] | null | undefined; set labelingInfo(value: LabelClassProperties[] | null | undefined); /** * Indicates whether to display labels for this sublayer. If `true`, labels will * appear as defined in the [labelingInfo](https://developers.arcgis.com/javascript/latest/references/core/layers/knowledgeGraph/KnowledgeGraphSublayer/#labelingInfo) property. * * > [!WARNING] * > * > **Known Limitations** * > * > 3D [SceneViews](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/) only support displaying one [LabelClass](https://developers.arcgis.com/javascript/latest/references/core/layers/support/LabelClass/) per feature. * * @default true */ accessor labelsVisible: boolean; /** * Indicates whether the layer will be included in the legend. When `false`, the layer will be excluded from the legend. * * @default true */ accessor legendEnabled: boolean; /** * The maximum scale (most zoomed in) at which the layer is visible in the view. * If the map is zoomed in beyond this scale, the layer will not be visible. * A value of 0 means the layer does not have a maximum scale. * The maxScale value should always be smaller than the [minScale](https://developers.arcgis.com/javascript/latest/references/core/layers/knowledgeGraph/KnowledgeGraphSublayer/#minScale) value, and greater than or equal to the service specification. * * @default 0 * @example * // The layer will not be visible when the view is zoomed in beyond a scale of 1:1,000 * layer.maxScale = 1000; * @example * // The layer's visibility is not restricted to a maximum scale. * layer.maxScale = 0; */ accessor maxScale: number; /** * The minimum scale (most zoomed out) at which the layer is visible in the view. * If the map is zoomed out beyond this scale, the layer will not be visible. * A value of 0 means the layer does not have a minimum scale. * The minScale value should always be larger than the [maxScale](https://developers.arcgis.com/javascript/latest/references/core/layers/knowledgeGraph/KnowledgeGraphSublayer/#maxScale) value, and lesser than or equal to the service specification. * * @default 0 * @example * // The layer will not be visible when the view is zoomed out beyond a scale of 1:3,000,000 * layer.minScale = 3000000; * @example * // The layer's visibility is not restricted to a minimum scale. * layer.minScale = 0; */ accessor minScale: number; /** * The name of an `oid` containing * a unique value or identifier for each feature in the sublayer. */ accessor objectIdField: string; /** Outlines the [type](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraph/GraphObjectType/) definition for the named type represented by the sublayer. */ accessor objectType: GraphObjectType; /** The [KnowledgeGraphLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/KnowledgeGraphLayer/) of which this is a sublayer for a specific entity or relationship type. */ accessor parentCompositeLayer: LinkChartLayer | KnowledgeGraphLayer; /** * Enable persistence of the layer in a [WebMap](https://developers.arcgis.com/javascript/latest/references/core/WebMap/) or [WebScene](https://developers.arcgis.com/javascript/latest/references/core/WebScene/). * * @default true * @since 4.28 */ get persistenceEnabled(): boolean; /** * Indicates whether to display popups when features in the layer are clicked. The layer needs to have a [popupTemplate](https://developers.arcgis.com/javascript/latest/references/core/layers/knowledgeGraph/KnowledgeGraphSublayer/#popupTemplate) to define what * information should be displayed in the popup. Alternatively, a default popup template may be automatically used if * [Popup.defaultPopupTemplateEnabled](https://developers.arcgis.com/javascript/latest/references/core/widgets/Popup/#defaultPopupTemplateEnabled) is set to `true`. * * @default true * @see [createPopupTemplate()](https://developers.arcgis.com/javascript/latest/references/core/layers/knowledgeGraph/KnowledgeGraphSublayer/#createPopupTemplate) * @see [SceneView.popup](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#popup) * @see [View2D.popup](https://developers.arcgis.com/javascript/latest/references/core/views/View2D/#popup) */ accessor popupEnabled: boolean; /** * The popup template for the sublayer. When set on the sublayer, the `popupTemplate` * allows users to access attributes and display their values in the * view's Popup when a feature is selected * using text and/or charts. . * * A default popup template is automatically used if no `popupTemplate` has been defined when * [Popup.defaultPopupTemplateEnabled](https://developers.arcgis.com/javascript/latest/references/core/widgets/Popup/#defaultPopupTemplateEnabled) * is set to `true`. * * @see [createPopupTemplate()](https://developers.arcgis.com/javascript/latest/references/core/layers/knowledgeGraph/KnowledgeGraphSublayer/#createPopupTemplate) * @see [SceneView.popup](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#popup) * @see [View2D.popup](https://developers.arcgis.com/javascript/latest/references/core/views/View2D/#popup) */ get popupTemplate(): PopupTemplate | null | undefined; set popupTemplate(value: PopupTemplateProperties | null | undefined); /** * The renderer assigned to the sublayer. The renderer defines how to * visualize each feature in the sublayer. Depending on the renderer type, * features may be visualized with the same symbol, or with varying symbols * based on the values of provided attribute fields or functions. * * @see [Styles and data visualization](https://developers.arcgis.com/javascript/latest/visualization/) * @example * // all features in the sublayer will be visualized with * // a 6pt black marker symbol and a thin, white outline * * //Apply renderer to the first sublayer of the KnowledgeGraphLayer * const sublayer = knowledgeGraphLayer.layers.items[0]; * sublayer.renderer = { * type: "simple", // autocasts as new SimpleRenderer() * symbol: { * type: "simple-marker", // autocasts as new SimpleMarkerSymbol() * size: 6, * color: "black", * outline: { // autocasts as new SimpleLineSymbol() * width: 0.5, * color: "white" * } * } * }; */ get renderer(): RendererUnion | null | undefined; set renderer(value: (((SimpleRendererProperties & { type: "simple" }) | (ClassBreaksRendererProperties & { type: "class-breaks" }) | (UniqueValueRendererProperties & { type: "unique-value" }) | (DotDensityRendererProperties & { type: "dot-density" }) | (DictionaryRendererProperties & { type: "dictionary" }) | (PieChartRendererProperties & { type: "pie-chart" })) | (HeatmapRendererProperties & { type: "heatmap" })) | null | undefined); /** * An array of feature templates defined in the knowledge graph sublayer. * * @since 4.34 */ get templates(): FeatureTemplate[] | null | undefined; set templates(value: FeatureTemplateProperties[] | null | undefined); /** The layer type provides a convenient way to check the type of the layer without the need to import specific layer modules. */ get type(): "knowledge-graph-sublayer"; /** * Creates a popup template for the layer, populated with all the fields of the layer. * * @param options - Options for creating the popup template. * @returns The popup template, or `null` if the layer does not * have any fields. */ createPopupTemplate(options?: CreatePopupTemplateOptions): PopupTemplate | null | undefined; /** * Creates query parameter object that can be used to fetch features that * satisfy the layer's configurations such as [definitionExpression](https://developers.arcgis.com/javascript/latest/references/core/layers/knowledgeGraph/KnowledgeGraphSublayer/#definitionExpression),. * It will return `Z` and `M` values based on the layer's [data capabilities](https://developers.arcgis.com/javascript/latest/references/core/layers/knowledgeGraph/KnowledgeGraphSublayer/#capabilities). * It sets the query parameter's [Query.outFields](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/#outFields) property to `["*"]`. * The results will include geometries of features and values for all * [available fields](https://developers.arcgis.com/javascript/latest/references/core/views/layers/FeatureLayerView/#availableFields) for * [client-side queries](https://developers.arcgis.com/javascript/latest/references/core/views/layers/FeatureLayerView/#queryFeatures) * or all fields in the layer for [server side queries](https://developers.arcgis.com/javascript/latest/references/core/layers/knowledgeGraph/KnowledgeGraphSublayer/#queryFeatures). * * @returns The query object representing the sublayer's definition expression * and other configurations. * @example * // Get a query object for the layer's current configuration * // queryParams.outFields will be set to ["*"] to get values * // for all available fields. * * //get the first sublayer from the parent KnowledgeGraphLayer * const sublayer = knowledgeGraphLayer.layers.items[0]; * const queryParams = sublayer.createQuery(); * // set a geometry for filtering features by a region of interest * queryParams.geometry = extentForRegionOfInterest; * // Add to the sublayer's current definitionExpression * queryParams.where = queryParams.where + " AND TYPE = 'Extreme'"; * * // query the sublayer with the modified params object * sublayer.queryFeatures(queryParams).then(function(results){ * // prints the array of result graphics to the console * console.log(results.features); * }); */ createQuery(): Query; /** * Returns the [Field](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Field/) instance for a field name (case-insensitive). * * @param fieldName - Name of the field. * @returns the matching field or `undefined` */ getField(fieldName: string): Field | null | undefined; /** * Returns the [Domain](https://developers.arcgis.com/javascript/latest/references/core/layers/support/Domain/) associated with the given field name. The domain can be either a * [CodedValueDomain](https://developers.arcgis.com/javascript/latest/references/core/layers/support/CodedValueDomain/) or [RangeDomain](https://developers.arcgis.com/javascript/latest/references/core/layers/support/RangeDomain/). * * @param fieldName - Name of the field. * @param options - An object specifying additional options. See the * object specification table below for the required properties of this object. * @returns The Domain object associated with the given field name for the given feature. * @example * // Get a range domain associated with the first feature * // returned from queryFeatures(). * //get the first sublayer from the parent KnowledgeGraphLayer * const sublayer = knowledgeGraphLayer.layers.items[0]; * sublayer.queryFeatures(query).then(function(results){ * const domain = sublayer.getFieldDomain("Height", {feature: results.features[0]}); * console.log("domain", domain) * }); */ getFieldDomain(fieldName: string, options?: FieldDomainOptions): DomainUnion | null | undefined; /** * Executes a [Query](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/) against the knowledge graph service and * returns the [Extent](https://developers.arcgis.com/javascript/latest/references/core/geometry/Extent/) of features that satisfy the query. If no * parameters are specified, then the extent and count of all features * satisfying the sublayer's configuration/filters are returned. * * @param query - Specifies the attributes and spatial * filter of the query. If no parameters are specified, then the extent and count of all features * satisfying the sublayer's configuration/filters are returned. * @param options - An object with the following properties. * @returns When resolved, returns the extent and count of the features * that satisfy the input query. See the object specification table below for details. * Property | Type | Description * ---------|------|------------- * count | Number | The number of features that satisfy the input query. * extent | [Extent](https://developers.arcgis.com/javascript/latest/references/core/geometry/Extent/) | The extent of the features that satisfy the query. * @example * // Queries for the extent of all features matching the layer's configurations * // e.g. definitionExpression * //get the first sublayer from the parent KnowledgeGraphLayer * const sublayer = knowledgeGraphLayer.layers.items[0]; * sublayer.queryExtent().then(function(results){ * // go to the extent of the results satisfying the query * view.goTo(results.extent); * }); * @example * //get the first sublayer from the parent KnowledgeGraphLayer * const sublayer = knowledgeGraphLayer.layers.items[0]; * * const query = new Query(); * query.where = "region = 'Southern California'"; * * sublayer.queryExtent(query).then(function(results){ * view.goTo(results.extent); // go to the extent of the results satisfying the query * }); */ queryExtent(query?: QueryProperties | null | undefined, options?: RequestOptions): Promise<{ count: number; extent: Extent | null; }>; /** * Executes a [Query](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/) against the [knowledge graph service](https://developers.arcgis.com/javascript/latest/references/core/rest/knowledgeGraphService/) and * returns the number of features that satisfy the query. If no parameters are specified, * the total number of features satisfying the sublayer's configuration/filters is returned. * * @param query - Specifies the attributes and * spatial filter of the query. If no parameters are specified, the total number of features * satisfying the layer's configuration/filters is returned. * @param options - An object with the following properties. * @returns When resolved, returns the number of features that satisfy the query. * @example * // Queries for the count of all features matching the layer's configurations * // e.g. definitionExpression * //get the first sublayer from the parent KnowledgeGraphLayer * const sublayer = knowledgeGraphLayer.layers.items[0]; * sublayer.queryFeatureCount().then(function(numFeatures){ * // prints the total count to the console * console.log(numFeatures); * }); * @example * //get the first sublayer from the parent KnowledgeGraphLayer * const sublayer = knowledgeGraphLayer.layers.items[0]; * * const query = new Query(); * query.where = "region = 'Southern California'"; * * sublayer.queryFeatureCount(query).then(function(numResults){ * console.log(numResults); // prints the number of results satisfying the query * }); */ queryFeatureCount(query?: QueryProperties | null | undefined, options?: RequestOptions): Promise<number>; /** * Executes a [Query](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/) against the feature service and returns a * [FeatureSet](https://developers.arcgis.com/javascript/latest/references/core/rest/support/FeatureSet/), once the promise resolves. * A [FeatureSet](https://developers.arcgis.com/javascript/latest/references/core/rest/support/FeatureSet/) contains an array of [Graphic](https://developers.arcgis.com/javascript/latest/references/core/Graphic/) * features. See the [querying](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#querying) * section for more information on how to query features from a layer. * > [!WARNING] * > * > To query features/graphics available to or visible in the * > [View](https://developers.arcgis.com/javascript/latest/references/core/views/View/) on the client rather than making a server-side query, you must * > use the * > [FeatureLayerView.queryFeatures()](https://developers.arcgis.com/javascript/latest/references/core/views/layers/FeatureLayerView/#queryFeatures) * > method. * > * > When querying a service with z-values and no [vertical coordinate system](https://pro.arcgis.com/en/pro-app/help/mapping/properties/vertical-coordinate-systems.htm) information, * > the z-values will automatically be converted to match the [Query.outSpatialReference](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/#outSpatialReference) units. * > Example: The service has a horizontal spatial reference using `feet` units and the query is made with `outSpatialReference` * > based on `meter` units, then [queryFeatures()](https://developers.arcgis.com/javascript/latest/references/core/layers/knowledgeGraph/KnowledgeGraphSublayer/#queryFeatures) automatically converts the values from `feet` to `meter` units. * * @param query - Specifies the attributes and spatial * filter of the query. If no parameters are specified, then all features satisfying the layer's * configuration/filters are returned. * @param options - An object with the following properties. * @returns When resolved, a [FeatureSet](https://developers.arcgis.com/javascript/latest/references/core/rest/support/FeatureSet/) containing * an array of graphic features is returned. * @example * // Queries for all the features matching the layer's configurations * // e.g. definitionExpression * //get the first sublayer from the parent KnowledgeGraphLayer * const sublayer = knowledgeGraphLayer.layers.items[0]; * sublayer.queryFeatures().then(function(results){ * // prints the array of result graphics to the console * console.log(results.features); * }); * @example * //get the first sublayer from the parent KnowledgeGraphLayer * const sublayer = knowledgeGraphLayer.layers.items[0]; * * const query = new Query(); * query.where = "STATE_NAME = 'Washington'"; * query.outSpatialReference = { wkid: 102100 }; * query.returnGeometry = true; * query.outFields = [ "CITY_NAME" ]; * * sublayer.queryFeatures(query).then(function(results){ * console.log(results.features); // prints the array of features to the console * }); * @example * // Get a query object for the sublayer's current configuration * const queryParams = sublayer.createQuery(); * // set a geometry for filtering features by a region of interest * queryParams.geometry = extentForRegionOfInterest; * // Add to the sublayer's current definitionExpression * queryParams.where = queryParams.where + " AND TYPE = 'Extreme'"; * * // query the sublayer with the modified params object * sublayer.queryFeatures(queryParams).then(function(results){ * // prints the array of result graphics to the console * console.log(results.features); * }); * @example * //get the first sublayer from the parent KnowledgeGraphLayer * const sublayer = knowledgeGraphLayer.layers.items[0]; * * // query all features from the layer and only return * // attributes specified in outFields. * const query = { // autocasts as Query * where: "1=1", // select all features * returnGeometry: false, * outFields: ["State_Name", "City_Name", "pop2010"] * }; * * sublayer.queryFeatures(query).then(function(results){ * console.log(results.features); // prints the array of features to the console * }); */ queryFeatures(query?: QueryProperties | null | undefined, options?: RequestOptions): Promise<FeatureSet>; /** * Executes a [Query](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/) against the knowledge graph service and returns an * array of Object IDs for features that satisfy the input query. If no parameters are specified, * then the Object IDs of all features satisfying the layer's configuration/filters are returned. * * @param query - Specifies the attributes and spatial * filter of the query. If no parameters are specified, then the Object IDs of all features * satisfying the sublayer's configuration/filters are returned. * @param options - An object with the following properties. * @returns When resolved, returns an array of numbers representing the object IDs of the features * satisfying the query. * @example * // Queries for all the Object IDs of features matching the layer's configurations * // e.g. definitionExpression * //get the first sublayer from the parent KnowledgeGraphLayer * const sublayer = knowledgeGraphLayer.layers.items[0]; * sublayer.queryObjectIds().then(function(results){ * // prints the array of Object IDs to the console * console.log(results); * }); * @example * //get the first sublayer from the parent KnowledgeGraphLayer * const sublayer = linkChartLayer.layers.items[0]; * * const query = new Query(); * query.where = "region = 'Southern California'"; * * sublayer.queryObjectIds(query).then(function(ids){ * console.log(ids); // an array of object IDs * }); */ queryObjectIds(query?: QueryProperties | null | undefined, options?: RequestOptions): Promise<ObjectId[]>; } declare const KnowledgeGraphSublayerSuperclass: typeof Layer & typeof MultiOriginJSONSupportMixin & typeof RefreshableLayer & typeof ScaleRangeLayer & typeof TemporalLayer & typeof OrderedLayer & typeof BlendLayer & typeof FeatureEffectLayer & typeof FeatureReductionLayer & typeof DisplayFilteredLayer