import VectorTileGraphicOrigin from "@arcgis/core/graphic/VectorTileGraphicOrigin.js";const VectorTileGraphicOrigin = await $arcgis.import("@arcgis/core/graphic/VectorTileGraphicOrigin.js");- Inheritance:
- VectorTileGraphicOrigin→
GraphicOrigin
- Since
- ArcGIS Maps SDK for JavaScript 4.34
Provides information about the VectorTileLayer from which a graphic originates. Origin information maybe available when a graphic is returned from methods such as MapView.hitTest() method. You can access the graphic's origin through the graphic's Graphic.origin property.
The origin information contains the style layer's id and layer index
within the vector tile style.
Spatial information about the actual feature represented in the style layer is returned only
if the style layer is a symbol layer. Otherwise, the graphic's geometry is null.
Example
// get screen point from view's click eventview.on("click", (event) => { // Search for all features only on included layers at the clicked location view.hitTest(event, {include: vectorTileLayer}).then((response) => { // if graphics are returned from vector tile layer, do something with results if (response.results.length){ response.results.forEach((result, i) => { const layerId = result.graphic?.origin?.layerId; const styleLayer = vectorTileLayer.getStyleLayer(layerId); // update vector tile layer's style }); } })Constructors
Properties
| Property | Type | Class |
|---|---|---|
layer readonly | | |
layerId readonly | | |
layerIndex readonly | | |
type readonly | VectorTileLayer["type"] | |
layerId
readonly Property
- Type
- string
The unique identifier of the style layer in the vector tile style.
layerIndex
readonly Property
- Type
- number
The layer index of the style layer in the vector tile style.
type
readonly Property
- Type
- VectorTileLayer["type"]
Indicates the type of layer the graphic originated from.
- Default value
- "vector-tile"