import type PopupTemplate from "../PopupTemplate.js"; import type Extent from "../geometry/Extent.js"; import type SpatialReference from "../geometry/SpatialReference.js"; import type Layer from "./Layer.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 TimeInfo from "./support/TimeInfo.js"; import type PortalItem from "../portal/PortalItem.js"; import type AttributeBinsFeatureSet from "../rest/support/AttributeBinsFeatureSet.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 AttributeTableTemplate from "../tables/AttributeTableTemplate.js"; import type TimeExtent from "../time/TimeExtent.js"; import type TimeInterval from "../time/TimeInterval.js"; import type { MultiOriginJSONSupportMixin } from "../core/MultiOriginJSONSupport.js"; import type { Edits, EditsResult } from "../editing/types.js"; import type { LayerEvents, LayerProperties } from "./Layer.js"; import type { FeatureLayerCapabilities, FieldDomainOptions } from "./types.js"; import type { BlendLayer, BlendLayerProperties } from "./mixins/BlendLayer.js"; import type { CustomParameters, CustomParametersMixin, CustomParametersMixinProperties } from "./mixins/CustomParametersMixin.js"; import type { DisplayFilteredLayer, DisplayFilteredLayerProperties } from "./mixins/DisplayFilteredLayer.js"; import type { EditBusLayerEvents } from "./mixins/EditBusLayer.js"; import type { FeatureEffectLayer, FeatureEffectLayerProperties } from "./mixins/FeatureEffectLayer.js"; import type { FeatureReductionLayer, FeatureReductionLayerProperties } from "./mixins/FeatureReductionLayer.js"; import type { OperationalLayer, OperationalLayerProperties } from "./mixins/OperationalLayer.js"; import type { OrderedLayer, OrderedLayerProperties } from "./mixins/OrderedLayer.js"; import type { PortalLayer, PortalLayerProperties } from "./mixins/PortalLayer.js"; import type { RefreshableLayerEvents, RefreshableLayer, RefreshableLayerProperties } from "./mixins/RefreshableLayer.js"; import type { ScaleRangeLayer, ScaleRangeLayerProperties } from "./mixins/ScaleRangeLayer.js"; import type { TemporalLayer, TemporalLayerProperties } from "./mixins/TemporalLayer.js"; import type { TrackableLayer, TrackableLayerProperties } from "./mixins/TrackableLayer.js"; import type { TimeInfoProperties } from "./support/TimeInfo.js"; import type { DomainUnion } from "./support/types.js"; import type { PortalItemProperties } from "../portal/PortalItem.js"; import type { RendererUnion } from "../renderers/types.js"; import type { RequestOptions } from "../request/types.js"; import type { AttributeBinsQueryProperties } from "../rest/support/AttributeBinsQuery.js"; import type { QueryProperties } from "../rest/support/Query.js"; import type { CreatePopupTemplateOptions } from "../support/popupUtils.js"; import type { TimeZone } from "../time/types.js"; import type { ObjectId } from "../views/types.js"; import type { TimeExtentProperties } from "../time/TimeExtent.js"; import type { TimeIntervalProperties } from "../time/TimeInterval.js"; import type { AttributeTableTemplateProperties } from "../tables/AttributeTableTemplate.js"; import type { ElevationInfoProperties } from "../symbols/support/ElevationInfo.js"; import type { FieldProperties } from "./support/Field.js"; import type { ExtentProperties } from "../geometry/Extent.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 { SpatialReferenceProperties } from "../geometry/SpatialReference.js"; import type { FeatureTemplateProperties } from "./support/FeatureTemplate.js"; export interface GeoJSONLayerProperties extends LayerProperties, PortalLayerProperties, OperationalLayerProperties, RefreshableLayerProperties, ScaleRangeLayerProperties, TrackableLayerProperties, TemporalLayerProperties, BlendLayerProperties, FeatureEffectLayerProperties, FeatureReductionLayerProperties, CustomParametersMixinProperties, DisplayFilteredLayerProperties, OrderedLayerProperties, Partial> { /** * This property is used to configure the associated layer's [FeatureTable](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/). It is meant to configure how the columns display within the table in regard to visibility, column order, and sorting. * * > [!WARNING] * > * > This property differs from the [FeatureTable's tableTemplate](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/support/TableTemplate/) property. The `TableTemplate` provides more fine-grained control over how the table is rendered within the application by offering more advanced configurations such as custom cell rendering, column formatting, and more. `TableTemplate` is useful for application-level development that remains within an application. Use the `attributeTableTemplate` property to access the table's settings across different applications. By using this property, the settings can be saved within a webmap or layer. Please refer to the [AttributeTableTemplate](https://developers.arcgis.com/javascript/latest/references/core/tables/AttributeTableTemplate/) and [TableTemplate](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/support/TableTemplate/) documentation for more information. * * @since 4.31 */ attributeTableTemplate?: AttributeTableTemplateProperties | null; /** * A list of custom parameters appended to the URL of all resources fetched by the layer. * It's an object with key-value pairs where value is a string. * The layer's `refresh()` method needs to be called if the customParameters are updated at runtime. * * @since 4.22 * @see [Sample - GeoJSONLayer with dynamic URL](https://developers.arcgis.com/javascript/latest/sample-code/layers-geojson-refresh/) * @example * // set customParameters to request the top 3 earthquakes since 1900. * // The USGS earthquakes catalog returns earthquakes with specified query parameters. * const geojsonLayer = new GeoJSONLayer({ * url: "https://earthquake.usgs.gov/fdsnws/event/1/query", * customParameters: { * format: "geojson", * starttime: "1900-01-01", * endtime: "2021-01-01", * minmagnitude: "8", * orderby:"magnitude", * limit: "3" * } * }); * @example * // send a custom parameter to your special service * let layer = new MapImageLayer({ * url: serviceUrl, * customParameters: { * "key": "my-special-key" * } * }); */ customParameters?: CustomParameters | null; /** * 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] * > * > If the elevation info is not specified, the effective elevation depends on the context and could vary per graphic. */ elevationInfo?: ElevationInfoProperties | null; /** * An array of fields in the layer. * * @example * // define each field's schema * let 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" * }) * ]; */ fields?: FieldProperties[]; /** * The full extent of the layer. * * @example * // Once the layer loads, set the view's extent to the layer's full extent * layer.when(function(){ * view.extent = layer.fullExtent; * }); */ fullExtent?: ExtentProperties | null; /** * The label definition for this layer, specified as an array of * [LabelClass](https://developers.arcgis.com/javascript/latest/references/core/layers/support/LabelClass/). Use this property to specify * labeling properties for the layer 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). * * > [!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. * * @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" * } * }); * geoJSONLayer.labelingInfo = [ statesLabelClass ]; */ labelingInfo?: LabelClassProperties[] | null; /** * The popup template for the layer. When set on the layer, 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. See the [PopupTemplate sample](https://developers.arcgis.com/javascript/latest/sample-code/intro-popuptemplate/) * for an example of how [PopupTemplate](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/) interacts with a * [FeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/). * * 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/GeoJSONLayer/#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 portal item referencing the geojson file from which the GeoJSONLayer is loaded. * * @since 4.25 * @example * // Initialize GeoJSONLayer by referencing a portalItem id pointing to geojson file. * const layer = new GeoJSONLayer({ * portalItem: { // autocasts as new PortalItem() * id: "81e769cd7031482797e1b0768f23c7e1" * } * }); * @example * // Initialize GeoJSONLayer by referencing a portalItem id pointing to geojson file. * const layer = new GeoJSONLayer({ * portalItem: new PortalItem({ * id: "81e769cd7031482797e1b0768f23c7e1", * // optionally define the portal, of the item. * // if not specified, the default portal defined is used. * // see https://developers.arcgis.com/javascript/latest/references/core/config/#portalUrl * portal: new Portal({ * url: "https://jsapi.maps.arcgis.com/" * }) * } * }); * @example * // While this example uses FeatureLayer, this same pattern can be * // used for other layers that may be loaded from portalItem ids. * const layer = new FeatureLayer({ * portalItem: { // autocasts as new PortalItem() * id: "caa9bd9da1f4487cb4989824053bb847" * } // the first layer in the service is returned * }); * @example * // Set hostname when using an on-premise portal (default is ArcGIS Online) * // esriConfig.portalUrl = "http://myHostName.esri.com/arcgis"; * * // While this example uses FeatureLayer, this same pattern can be * // used for SceneLayers. * const layer = new FeatureLayer({ * portalItem: { // autocasts as new PortalItem() * id: "8d26f04f31f642b6828b7023b84c2188" * }, * // loads the third item in the given feature service * layerId: 2 * }); * @example * // Initialize GeoJSONLayer by referencing a portalItem id pointing to geojson file. * const layer = new GeoJSONLayer({ * portalItem: new PortalItem({ * id: "81e769cd7031482797e1b0768f23c7e1", * // optionally define the portal, of the item. * // if not specified, the default portal defined is used. * // see https://developers.arcgis.com/javascript/latest/references/core/config/#portalUrl * portal: new Portal({ * url: "https://jsapi.maps.arcgis.com/" * }) * } * }); * @example * // This snippet loads a table hosted in ArcGIS Online. * const table = new FeatureLayer({ * portalItem: { // autocasts as esri/portal/PortalItem * id: "123f4410054b43d7a0bacc1533ceb8dc" * } * }); * * // Before adding the table to the map, it must first be loaded and confirm it is the right type. * table.load().then(() => { * if (table.isTable) { * map.tables.add(table); * } * }); * @example * // While this example uses FeatureLayer, this same pattern can be * // used for other layers that may be loaded from portalItem ids. * const layer = new FeatureLayer({ * portalItem: { // autocasts as esri/portal/PortalItem * id: "caa9bd9da1f4487cb4989824053bb847", * // Set an API key to access a secure portal item configured with API key authentication. * apiKey: "APIKEY" * } * }); */ portalItem?: PortalItemProperties | null; /** * Refresh interval of the layer in minutes. Value of `0` indicates no refresh. * * @default 0 * @since 4.22 * @see [refresh()](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/#refresh) * @see [refresh event](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/#event-refresh) * @see [Sample - GeoJSONLayer with dynamic URL](https://developers.arcgis.com/javascript/latest/sample-code/layers-geojson-refresh/) * @example * // the layer will be refreshed every 1 minute. * layer.refreshInterval = 1; * @see [RefreshableLayer.refresh()](https://developers.arcgis.com/javascript/latest/references/core/layers/mixins/RefreshableLayer/#refresh) * @see [refresh event](https://developers.arcgis.com/javascript/latest/references/core/layers/mixins/RefreshableLayer/#event-refresh) * @example * // the layer will be refreshed every minute. * layer.refreshInterval = 1; */ refreshInterval?: number; /** * The renderer assigned to the layer. The renderer defines how to * visualize each feature in the layer. 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. If not specified, * a default renderer will be generated based on the geometry type. * * @see [Styles and data visualization](https://developers.arcgis.com/javascript/latest/visualization/) */ 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; /** * The spatial reference of the layer. The default value is WGS84. * This property can be set explicitly to project the longitude and latitude * coordinates when the layer parses the GeoJSON file. While not required, explicitly setting * the spatial reference of the layer will improve the performance * when projecting to a spatial reference other than the one used by the * coordinates in the raw data. * * @default SpatialReference.WGS84 * @see [SpatialReference.WGS84](https://developers.arcgis.com/javascript/latest/references/core/geometry/SpatialReference/#WGS84) * @example * const geoJSONLayer = new GeoJSONLayer({ * url: "example.geojson", * spatialReference: { * wkid: 5936 * } * }); */ spatialReference?: SpatialReferenceProperties; /** * An array of feature templates defined in the layer. * See [ArcGIS Pro subtypes document](https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/an-overview-of-subtypes.htm). */ templates?: FeatureTemplateProperties[] | null; /** * The layer's time extent. When the layer's [useViewTime](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/#useViewTime) is `false`, the layer * instructs the view to show data from the layer based on this time extent. * If the `useViewTime` is `true`, and both layer and view time extents are set, then features that fall within * the intersection of the view and layer time extents will be displayed. * For example, if the layer's time extent is set to display features between 1970 and 1975 and * the view has a time extent set to 1972-1980, the effective time on the feature layer will be 1972-1975. * * @since 4.14 * @example * if (!layer.useViewTime) { * if (layer.timeExtent) { * console.log("Current timeExtent:", layer.timeExtent.start, " - ", layer.timeExtent.end} * } else { * console.log("The layer will display data within the view's timeExtent."); * console.log("Current view.timeExtent:", view.timeExtent.start, " - ", view.timeExtent.end} * } * } * @example * // set the timeExtent on the layer and useViewTime false * // In this case, the layer will honor its timeExtent and ignore * // the view's timeExtent * const layer = new ImageryLayer({ * url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/ScientificData/SeaTemperature/ImageServer", * timeExtent: { * start: new Date(2014, 4, 18), * end: new Date(2014, 4, 19) * }, * useViewTime: false * }); * @example * // timeExtent is set on the layer and the view * // In this case, the layer will display features that fall * // within the intersection of view and layer time extents * // features within Jan 1, 1976 - Jan 1, 1981 will be displayed * const view = new MapView({ * timeExtent: { * start: new Date(1976, 0, 1), * end: new Date(2002, 0, 1) * } * }); * const layer = new FeatureLayer({ * url: myUrl, * timeExtent: { * start: new Date(1974, 0, 1), * end: new Date(1981, 0, 1) * } * }); * @example * if (!layer.useViewTime) { * if (layer.timeExtent) { * console.log("Current timeExtent:", layer.timeExtent.start, " - ", layer.timeExtent.end} * } else { * console.log("The layer will display data within the view's timeExtent."); * console.log("Current view.timeExtent:", view.timeExtent.start, " - ", view.timeExtent.end} * } * } * @example * // set the timeExtent on the layer and useViewTime false * // In this case, the layer will honor its timeExtent and ignore * // the view's timeExtent * const layer = new ImageryLayer({ * url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/ScientificData/SeaTemperature/ImageServer", * timeExtent: { * start: new Date(2014, 4, 18), * end: new Date(2014, 4, 19) * }, * useViewTime: false * }); * @example * // timeExtent is set on the layer and the view * // In this case, the layer will display features that fall * // within the intersection of view and layer time extents * // features within Jan 1, 1976 - Jan 1, 1981 will be displayed * const view = new MapView({ * timeExtent: { * start: new Date(1976, 0, 1), * end: new Date(2002, 0, 1) * } * }); * const layer = new FeatureLayer({ * url: myUrl, * timeExtent: { * start: new Date(1974, 0, 1), * end: new Date(1981, 0, 1) * } * }); */ timeExtent?: TimeExtentProperties | null; /** * TimeInfo provides information such as date fields that store [start](https://developers.arcgis.com/javascript/latest/references/core/layers/support/TimeInfo/#startField) * and [end](https://developers.arcgis.com/javascript/latest/references/core/layers/support/TimeInfo/#endField) time * for each feature and the [TimeInfo.fullTimeExtent](https://developers.arcgis.com/javascript/latest/references/core/layers/support/TimeInfo/#fullTimeExtent) * for the layer. The `timeInfo` property, along with its `startField` and `endField` properties, must be set at the * time of layer initialization if it is being set for a [GeoJSONLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/). * The timeInfo parameters cannot be changed after the layer is [loaded](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/#loaded). * The [TimeInfo.fullTimeExtent](https://developers.arcgis.com/javascript/latest/references/core/layers/support/TimeInfo/#fullTimeExtent) for `timeInfo` is * automatically calculated based on its `startField` and `endField` properties. * * @since 4.11 * @example * // create geojson layer from usgs earthquakes geojson feed * const geojsonLayer = new GeoJSONLayer({ * url: "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.geojson", * copyright: "USGS Earthquakes", * fields: [ * { "name": "mag", "type": "double" }, * { "name": "place", "type": "string" }, * { "name": "time", "type": "date" }, // date field * { "name": "depth", "type": "double" } * ], * // timeInfo can be used to do temporal queries * // set the startField. * // timeExtent is automatically calculated from the start and end date fields * // The date values must be in milliseconds number from the UNIX epoch specified in UTC. * timeInfo: { * startField: "time" * } * }); * @example * // create geojson layer from usgs earthquakes geojson feed * const geojsonLayer = new GeoJSONLayer({ * url: "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.geojson", * copyright: "USGS Earthquakes", * fields: [ * { "name": "mag", "type": "double" }, * { "name": "place", "type": "string" }, * { "name": "time", "type": "date" }, // date field * { "name": "depth", "type": "double" } * ], * // timeInfo can be used to do temporal queries * // set the startField and endField. * // timeExtent is automatically calculated from the * // the start and end date fields * // The date values must be in milliseconds number from the UNIX epoch specified in UTC. * timeInfo: { * startField: "time" * } * }); */ timeInfo?: TimeInfoProperties | null; /** * A temporary offset of the time data based on a certain [TimeInterval](https://developers.arcgis.com/javascript/latest/references/core/time/TimeInterval/). This allows * users to overlay features from two or more time-aware layers with different time extents. * For example, if a layer has data recorded for the year 1970, an offset value of 2 years would temporarily shift the data to * 1972. You can then overlay this data with data recorded in 1972. * A time offset can be used for display purposes only. The query and selection are not affected by the offset. * * @since 4.14 * @example * // Offset a geojson Layer containing hurricanes from 2015 so that they appear in 2019 (+4 years). * let layer = new GeoJSONLayer({ * url: `hurricanes-and-storms-2015.geojson`, * timeOffset: { * value: 4, * unit: "years" * }, * timeInfo: { * startField: "ISO_time" * }, * renderer: { * type: "simple", * symbol: { * type: "simple-marker", * size: 6, * color: "red", * outline: { * width: 0.5, * color: "black" * } * } * } * }); * @example * // Offset a CSV Layer containing hurricanes from 2015 so that they appear in 2019 (+4 years). * let layer = new CSVLayer({ * url: `hurricanes-and-storms-2015.csv`, * timeOffset: { * value: 4, * unit: "years" * }, * timeInfo: { * startField: "ISO_time" * }, * renderer: { * type: "simple", * symbol: { * type: "simple-marker", * size: 6, * color: "red", * outline: { * width: 0.5, * color: "black" * } * } * } * }); */ timeOffset?: TimeIntervalProperties | null; /** * The title of the layer used to identify it in places such as the [Legend](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-legend/) * and [LayerList](https://developers.arcgis.com/javascript/latest/references/core/widgets/LayerList/). * * @default "GeoJSON" */ title?: string | null; /** * Determines if the layer will update its temporal data based on the view's * [View.timeExtent](https://developers.arcgis.com/javascript/latest/references/core/views/View/#timeExtent). When `false`, the layer will display its temporal * data based on the layer's [timeExtent](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/#timeExtent), regardless of changes to the view. * If both view and layer time extents are set while this property is `true`, then the features that fall within * the intersection of the view and layer time extents will be displayed. * For example, if a layer's time extent is set to display features between 1970 and 1975 and * the view has a time extent set to 1972-1980, the effective time on the feature layer will be 1972-1975. * * @default true * @since 4.14 * @example * if (featureLayer.useViewTime) { * console.log("Displaying data between:", view.timeExtent.start, " - ", view.timeExtent.end); * } * @example * if (featureLayer.useViewTime) { * console.log("Displaying data between:", view.timeExtent.start, " - ", view.timeExtent.end); * } */ useViewTime?: boolean; } export interface GeoJSONLayerEvents extends EditBusLayerEvents, RefreshableLayerEvents, LayerEvents {} /** * * [Overview](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/#overview) * * [Creating a GeoJSONLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/#creating-a-geojsonlayer) * * [Notes](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/#limits) * * * ## Overview * The GeoJSONLayer class is used to create a layer based on [GeoJSON](https://geojson.org/). * GeoJSON is a format for encoding a variety of geographic data structures. * The GeoJSON data must comply with the [RFC 7946 specification](https://tools.ietf.org/html/rfc7946) which states * that the coordinates are in [SpatialReference.WGS84](https://developers.arcgis.com/javascript/latest/references/core/geometry/SpatialReference/#WGS84). * Refer to FeatureLayer's [querying your data](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#querying) section to learn more about how to query your geojson data, and * the [data visualization](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#data-visualization) section to learn how to change the GeoJSONLayer's visualization. * * Please see the table below for supported geometry objects from GeoJSON and their corresponding geometry types: * GeoJSON Geometry Object | API Geometry Type | * ------------------------|-------------------| * Point | [Point](https://developers.arcgis.com/javascript/latest/references/core/geometry/Point/) | * MultiPoint | [Multipoint](https://developers.arcgis.com/javascript/latest/references/core/geometry/Multipoint/) | * LineString/MultiLineString | [Polyline](https://developers.arcgis.com/javascript/latest/references/core/geometry/Polyline/) | * Polygon/MultiPolygon | [Polygon](https://developers.arcgis.com/javascript/latest/references/core/geometry/Polygon/) | * * * ## Creating a GeoJSONLayer * * GeoJSONLayer is created by setting its [url](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/#url) property to point to geojson feed or to a blob url for in memory geojson data. * * ### Reference a geojson feed URL * * To create a GeoJSONLayer instance from a geojson feed, you must set the [url](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/#url) property * to the url of the geojson feed. * * ```js * const GeoJSONLayer = await $arcgis.import("@arcgis/core/layers/GeoJSONLayer.js"); * // points to the states layer in a service storing U.S. census data * const geojsonlayer = new GeoJSONLayer({ * url: "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.geojson", * copyright: "USGS Earthquakes" * }); * map.add(geojsonlayer); // adds the layer to the map * ``` * * ### Reference in memory geojson data by a blob url * * You can also create a GeoJSONLayer from in memory geojson data by passing a [blob url](https://developer.mozilla.org/docs/Web/API/URL/createObjectURL) to the * [url](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/#url) property of the layer. The following snippet shows how to create a new GeoJSONLayer from a blob url. * ```js * // create a geojson layer from geojson feature collection * const geojson = { * type: "FeatureCollection", * features: [ * { * type: "Feature", * id: 1, * geometry: { * type: "Polygon", * coordinates: [ * [ * [100.0, 0.0], * [101.0, 0.0], * [101.0, 1.0], * [100.0, 1.0], * [100.0, 0.0] * ] * ] * }, * properties: { * type: "single", * recordedDate: "2018-02-07T22:45:00-08:00" * } * } * ] * }; * * // create a new blob from geojson featurecollection * const blob = new Blob([JSON.stringify(geojson)], { * type: "application/json" * }); * * // URL reference to the blob * const url = URL.createObjectURL(blob); * // create new geojson layer using the blob url * const layer = new GeoJSONLayer({ * url * }); * ``` * * > [!WARNING] * > * > * > **Notes** * > * > Each GeoJSONLayer will only accept one geometry type. If there are multiple types of geometries, * > only the type specified in [geometryType](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/#geometryType) will be loaded. If [geometryType](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/#geometryType) * > is not specified, it will default to the geometry type of the first geometry. * > Each GeoJSONLayer will only accept one schema of the properties. The [fields](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/#fields) property * > can be used to specify the desired fields for the layer. If [fields](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/#fields) is not defined, the schema used by * > the first feature will be used to deduce the fields schema for the layer. * > [GeometryCollection](https://tools.ietf.org/html/rfc7946#section-3.1.8) is not supported. * > Using Object as attribute value for GeoJSON features is not supported. * > Geometries that cross the Antimeridian line are not currently supported. * > Date [fields](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/#fields) will be created implicitly when GeoJSONLayer is loaded, if the geojson [feature](https://datatracker.ietf.org/doc/html/rfc7946#section-3.2) objects * > have properties containing date and time values such as ISO8601 date strings. * * @since 4.11 * @see [Sample - Add GeoJSONLayer to your Map](https://developers.arcgis.com/javascript/latest/sample-code/layers-geojson/) * @see [Sample - Filter features with TimeSlider](https://developers.arcgis.com/javascript/latest/sample-code/timeslider-component-filter/) * @see [Sample - GeoJSONLayer with dynamic URL](https://developers.arcgis.com/javascript/latest/sample-code/layers-geojson-refresh/) * @see [Query and filter guide](https://developers.arcgis.com/javascript/latest/query-filter/) * @see [GeoJSONLayerView](https://developers.arcgis.com/javascript/latest/references/core/views/layers/GeoJSONLayerView/) * @see [Querying your data](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#querying) * @see [Data Visualization](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#data-visualization) */ export default class GeoJSONLayer extends GeoJSONLayerSuperclass { /** * @deprecated * Do not directly reference this property. * Use EventNames and EventTypes helpers from \@arcgis/core/Evented */ "@eventTypes": GeoJSONLayerEvents; /** * @example * const geoJSONLayer = new GeoJSONLayer({ * url: "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.geojson", * copyright: "USGS Earthquakes", * }); * map.add(geoJSONLayer); // adds the layer to the map */ constructor(properties?: GeoJSONLayerProperties); /** * This property is used to configure the associated layer's [FeatureTable](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/). It is meant to configure how the columns display within the table in regard to visibility, column order, and sorting. * * > [!WARNING] * > * > This property differs from the [FeatureTable's tableTemplate](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/support/TableTemplate/) property. The `TableTemplate` provides more fine-grained control over how the table is rendered within the application by offering more advanced configurations such as custom cell rendering, column formatting, and more. `TableTemplate` is useful for application-level development that remains within an application. Use the `attributeTableTemplate` property to access the table's settings across different applications. By using this property, the settings can be saved within a webmap or layer. Please refer to the [AttributeTableTemplate](https://developers.arcgis.com/javascript/latest/references/core/tables/AttributeTableTemplate/) and [TableTemplate](https://developers.arcgis.com/javascript/latest/references/core/widgets/FeatureTable/support/TableTemplate/) documentation for more information. * * @since 4.31 */ get attributeTableTemplate(): AttributeTableTemplate | null | undefined; set attributeTableTemplate(value: AttributeTableTemplateProperties | null | undefined); /** * Describes the layer's supported capabilities. * * @example * // Once the layer loads, check if the supportsStatistics operations is enabled on the layer * await layer.load(); * if (layer.capabilities.query.supportsStatistics) { * // query for the sum of the population in all features * let sumPopulation = { * onStatisticField: "POP_2015", // service field for 2015 population * outStatisticFieldName: "Pop_2015_sum", * statisticType: "sum" * } * let query = layer.createQuery(); * query.outStatistics = [ sumPopulation ]; * const result = await layer.queryFeatures(query); * // process the stats query result * } */ get capabilities(): FeatureLayerCapabilities; /** Copyright information for the layer. */ accessor copyright: string | null | undefined; /** * A list of custom parameters appended to the URL of all resources fetched by the layer. * It's an object with key-value pairs where value is a string. * The layer's `refresh()` method needs to be called if the customParameters are updated at runtime. * * @since 4.22 * @see [Sample - GeoJSONLayer with dynamic URL](https://developers.arcgis.com/javascript/latest/sample-code/layers-geojson-refresh/) * @example * // set customParameters to request the top 3 earthquakes since 1900. * // The USGS earthquakes catalog returns earthquakes with specified query parameters. * const geojsonLayer = new GeoJSONLayer({ * url: "https://earthquake.usgs.gov/fdsnws/event/1/query", * customParameters: { * format: "geojson", * starttime: "1900-01-01", * endtime: "2021-01-01", * minmagnitude: "8", * orderby:"magnitude", * limit: "3" * } * }); * @example * // send a custom parameter to your special service * let layer = new MapImageLayer({ * url: serviceUrl, * customParameters: { * "key": "my-special-key" * } * }); */ accessor customParameters: CustomParameters | null | undefined; /** * The time zone that dates are stored in. Time zone is always `UTC` for GeoJSONLayer. * This property may be useful when constructing date or time [where clauses](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/#date-query). * * @since 4.28 */ get dateFieldsTimeZone(): TimeZone | 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/). * Definition expressions may be set when a layer is constructed prior to it loading in the view or * after it has been added to the map. If the definition expression is set after the layer has been added to the map, the view will * automatically refresh itself to display the features that satisfy the new definition expression. * * @example * // Set definition expression in constructor to only display earthquakes magnitude 5.0 and greater * const layer = new GeoJSONLayer({ * url: "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.geojson", * definitionExpression: "mag >= 5" * }); * @example * // Set the definition expression directly on layer instance after it has loaded * layer.definitionExpression = "mag >= 5"; */ accessor definitionExpression: string | null | undefined; /** The name of the layer's primary display field. The value of this property matches the name of one of the fields of the layer. */ accessor displayField: string | null | undefined; /** * Indicates if the layer is editable. The GeoJSONLayer features are only editable in memory. The source geojson file is not modified when editing features. * Therefore `editingEnabled` is `false` by default. If set to `true`, the source geojson file needs to be updated manually. * * @default false * @since 4.22 * @see [applyEdits()](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/#applyEdits) */ accessor editingEnabled: boolean; /** * 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] * > * > 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. * * @example * // define each field's schema * let 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[]; set fields(value: FieldProperties[]); /** * 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. * * @since 4.12 * @example * // lookup a field by name. name is case-insensitive * const field = layer.fieldsIndex.get("SoMeFiEld"); * * if (field) { * console.log(field.name); // SomeField * } */ get fieldsIndex(): FieldsIndex; /** * The full extent of the layer. * * @example * // Once the layer loads, set the view's extent to the layer's full extent * layer.when(function(){ * view.extent = layer.fullExtent; * }); */ get fullExtent(): Extent | null | undefined; set fullExtent(value: ExtentProperties | null | undefined); /** * The geometry type of features in the layer. All features must be of the same type. * The GeoJSONLayer can consume GeoJSON feature collections with mixed geometries * and will only read the features with the specified geometry type if `geometryType` is set, otherwise the geometry type * is determined from the first feature with a geometry. The geometry type is `null` if [isTable](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/#isTable) is `true`. */ accessor geometryType: "point" | "polygon" | "polyline" | "multipoint" | null | undefined; /** * Indicates whether the GeoJSONLayer contains Z-values (elevation). * * - When `true`: Features include Z-values as part of their geometry. Per the [GeoJSON spec](https://datatracker.ietf.org/doc/html/rfc7946#section-4), * these values are always in meters. * - When `false`: Features do not contain Z-values. */ accessor hasZ: boolean; /** * Returns `true` if the layer is loaded from a non-spatial table in a service. Non-spatial geojson tables do not have * geometry object that represent geographic features. The [geometryType](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/#geometryType) of the layer will be `null` if the `isTable` is true. * * Non-spatial table instance can be created from the [url](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/#url) and the table must be loaded by calling [load()](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/#load) method. * * @default false * @since 4.24 * @see [Map.tables](https://developers.arcgis.com/javascript/latest/references/core/Map/#tables) * @see [WebMap.tables](https://developers.arcgis.com/javascript/latest/references/core/WebMap/#tables) * @see [Map.allTables](https://developers.arcgis.com/javascript/latest/references/core/Map/#allTables) * @see [WebMap.allTables](https://developers.arcgis.com/javascript/latest/references/core/WebMap/#allTables) */ get isTable(): boolean; /** * The label definition for this layer, specified as an array of * [LabelClass](https://developers.arcgis.com/javascript/latest/references/core/layers/support/LabelClass/). Use this property to specify * labeling properties for the layer 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). * * > [!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. * * @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" * } * }); * geoJSONLayer.labelingInfo = [ statesLabelClass ]; */ get labelingInfo(): LabelClass[] | null | undefined; set labelingInfo(value: LabelClassProperties[] | null | undefined); /** * Indicates whether to display labels for this layer. If `true`, labels will * appear as defined in the [labelingInfo](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/#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. * * @default true */ accessor legendEnabled: boolean; /** * The name of a [field](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/#fields) containing a unique value or identifier for each feature in the layer. * if the feature `id` is present in the GeoJSON, it will be used as the `oid` field. Starting at version 4.22, this field will be a type of an `oid` field * if the feature `id` is an integer, or will be a `string` field if the feature `id` is a string. * If the feature `id` property is not present and `objectIDField` is not specified, `__ObjectID` field will be generated for each feature * starting from 1. * * @since 4.15 * @see [fields](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/#fields) */ accessor objectIdField: string; /** * An array of field names from the geoJSON file to include with each feature. * To fetch the values from all fields in the layer, use `["*"]`. * The required fields used for layer [rendering](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/#renderer), [labeling](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/#labelingInfo), and * setting the [elevation info](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/#elevationInfo), along with the fields specified in `outFields` are used to populate * [FeatureLikeLayerView.availableFields](https://developers.arcgis.com/javascript/latest/references/core/views/layers/FeatureLikeLayerView/#availableFields). * Set this property to include the fields that will be used for client-side * [queries](https://developers.arcgis.com/javascript/latest/references/core/views/layers/FeatureLikeLayerView/#queryFeatures) * if the fields are not part of required fields. * * @since 4.15 * @see [FeatureLikeLayerView.availableFields](https://developers.arcgis.com/javascript/latest/references/core/views/layers/FeatureLikeLayerView/#availableFields) * @see [fieldUtils](https://developers.arcgis.com/javascript/latest/references/core/layers/support/fieldUtils/) * @example * // Includes all fields from the service in the layer * layer.outFields = ["*"]; * @example * // Get the specified fields from the service in the layer * // These fields will be added to FeatureLayerView.availableFields * // along with rendering and labeling fields. Use these fields * // for client-side filtering and querying. * layer.outFields = ["NAME", "POP_2010", "FIPS", "AREA"]; */ accessor outFields: string[] | null | undefined; /** * 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/GeoJSONLayer/#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/GeoJSONLayer/#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 layer. When set on the layer, 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. See the [PopupTemplate sample](https://developers.arcgis.com/javascript/latest/sample-code/intro-popuptemplate/) * for an example of how [PopupTemplate](https://developers.arcgis.com/javascript/latest/references/core/PopupTemplate/) interacts with a * [FeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/). * * 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/GeoJSONLayer/#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 portal item referencing the geojson file from which the GeoJSONLayer is loaded. * * @since 4.25 * @example * // Initialize GeoJSONLayer by referencing a portalItem id pointing to geojson file. * const layer = new GeoJSONLayer({ * portalItem: { // autocasts as new PortalItem() * id: "81e769cd7031482797e1b0768f23c7e1" * } * }); * @example * // Initialize GeoJSONLayer by referencing a portalItem id pointing to geojson file. * const layer = new GeoJSONLayer({ * portalItem: new PortalItem({ * id: "81e769cd7031482797e1b0768f23c7e1", * // optionally define the portal, of the item. * // if not specified, the default portal defined is used. * // see https://developers.arcgis.com/javascript/latest/references/core/config/#portalUrl * portal: new Portal({ * url: "https://jsapi.maps.arcgis.com/" * }) * } * }); * @example * // While this example uses FeatureLayer, this same pattern can be * // used for other layers that may be loaded from portalItem ids. * const layer = new FeatureLayer({ * portalItem: { // autocasts as new PortalItem() * id: "caa9bd9da1f4487cb4989824053bb847" * } // the first layer in the service is returned * }); * @example * // Set hostname when using an on-premise portal (default is ArcGIS Online) * // esriConfig.portalUrl = "http://myHostName.esri.com/arcgis"; * * // While this example uses FeatureLayer, this same pattern can be * // used for SceneLayers. * const layer = new FeatureLayer({ * portalItem: { // autocasts as new PortalItem() * id: "8d26f04f31f642b6828b7023b84c2188" * }, * // loads the third item in the given feature service * layerId: 2 * }); * @example * // Initialize GeoJSONLayer by referencing a portalItem id pointing to geojson file. * const layer = new GeoJSONLayer({ * portalItem: new PortalItem({ * id: "81e769cd7031482797e1b0768f23c7e1", * // optionally define the portal, of the item. * // if not specified, the default portal defined is used. * // see https://developers.arcgis.com/javascript/latest/references/core/config/#portalUrl * portal: new Portal({ * url: "https://jsapi.maps.arcgis.com/" * }) * } * }); * @example * // This snippet loads a table hosted in ArcGIS Online. * const table = new FeatureLayer({ * portalItem: { // autocasts as esri/portal/PortalItem * id: "123f4410054b43d7a0bacc1533ceb8dc" * } * }); * * // Before adding the table to the map, it must first be loaded and confirm it is the right type. * table.load().then(() => { * if (table.isTable) { * map.tables.add(table); * } * }); * @example * // While this example uses FeatureLayer, this same pattern can be * // used for other layers that may be loaded from portalItem ids. * const layer = new FeatureLayer({ * portalItem: { // autocasts as esri/portal/PortalItem * id: "caa9bd9da1f4487cb4989824053bb847", * // Set an API key to access a secure portal item configured with API key authentication. * apiKey: "APIKEY" * } * }); */ get portalItem(): PortalItem | null | undefined; set portalItem(value: PortalItemProperties | null | undefined); /** * Refresh interval of the layer in minutes. Value of `0` indicates no refresh. * * @default 0 * @since 4.22 * @see [refresh()](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/#refresh) * @see [refresh event](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/#event-refresh) * @see [Sample - GeoJSONLayer with dynamic URL](https://developers.arcgis.com/javascript/latest/sample-code/layers-geojson-refresh/) * @example * // the layer will be refreshed every 1 minute. * layer.refreshInterval = 1; * @see [RefreshableLayer.refresh()](https://developers.arcgis.com/javascript/latest/references/core/layers/mixins/RefreshableLayer/#refresh) * @see [refresh event](https://developers.arcgis.com/javascript/latest/references/core/layers/mixins/RefreshableLayer/#event-refresh) * @example * // the layer will be refreshed every minute. * layer.refreshInterval = 1; */ accessor refreshInterval: number; /** * The renderer assigned to the layer. The renderer defines how to * visualize each feature in the layer. 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. If not specified, * a default renderer will be generated based on the geometry type. * * @see [Styles and data visualization](https://developers.arcgis.com/javascript/latest/visualization/) */ 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); /** * Apply perspective scaling to screen-size symbols in a [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/). * When `true`, screen sized objects such as [icons](https://developers.arcgis.com/javascript/latest/references/core/symbols/IconSymbol3DLayer/), * [labels](https://developers.arcgis.com/javascript/latest/references/core/symbols/LabelSymbol3D/) or [callouts](https://developers.arcgis.com/javascript/latest/references/core/symbols/callouts/Callout3D/) integrate * better in the 3D scene by applying a certain perspective projection to the * sizing of features. This only applies when using a [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/). * * `layer.screenSizePerspectiveEnabled = true` * * ![screen-size-perspective](https://developers.arcgis.com/javascript/latest/assets/references/core/symbols/symbols-screenSize-perspective.avif) * * `layer.screenSizePerspectiveEnabled = false` * * ![no-screen-size-perspective](https://developers.arcgis.com/javascript/latest/assets/references/core/symbols/symbols-no-screenSize-perspective.avif) * * > [!WARNING] * > * > **Known Limitations** * > * > Screen size perspective is currently not optimized for situations where the camera is very near the ground, or for scenes * > with visual elements located far from the ground surface. In these cases it may be better to turn off screen size perspective. * > As screen size perspective changes the size based on distance to the camera, it should be set to false when using * > [size visual variables](https://developers.arcgis.com/javascript/latest/references/core/renderers/visualVariables/SizeVariable/). * * @default true */ accessor screenSizePerspectiveEnabled: boolean; /** * The spatial reference of the layer. The default value is WGS84. * This property can be set explicitly to project the longitude and latitude * coordinates when the layer parses the GeoJSON file. While not required, explicitly setting * the spatial reference of the layer will improve the performance * when projecting to a spatial reference other than the one used by the * coordinates in the raw data. * * @default SpatialReference.WGS84 * @see [SpatialReference.WGS84](https://developers.arcgis.com/javascript/latest/references/core/geometry/SpatialReference/#WGS84) * @example * const geoJSONLayer = new GeoJSONLayer({ * url: "example.geojson", * spatialReference: { * wkid: 5936 * } * }); */ get spatialReference(): SpatialReference; set spatialReference(value: SpatialReferenceProperties); /** * An array of feature templates defined in the layer. * See [ArcGIS Pro subtypes document](https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/an-overview-of-subtypes.htm). */ get templates(): FeatureTemplate[] | null | undefined; set templates(value: FeatureTemplateProperties[] | null | undefined); /** * The layer's time extent. When the layer's [useViewTime](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/#useViewTime) is `false`, the layer * instructs the view to show data from the layer based on this time extent. * If the `useViewTime` is `true`, and both layer and view time extents are set, then features that fall within * the intersection of the view and layer time extents will be displayed. * For example, if the layer's time extent is set to display features between 1970 and 1975 and * the view has a time extent set to 1972-1980, the effective time on the feature layer will be 1972-1975. * * @since 4.14 * @example * if (!layer.useViewTime) { * if (layer.timeExtent) { * console.log("Current timeExtent:", layer.timeExtent.start, " - ", layer.timeExtent.end} * } else { * console.log("The layer will display data within the view's timeExtent."); * console.log("Current view.timeExtent:", view.timeExtent.start, " - ", view.timeExtent.end} * } * } * @example * // set the timeExtent on the layer and useViewTime false * // In this case, the layer will honor its timeExtent and ignore * // the view's timeExtent * const layer = new ImageryLayer({ * url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/ScientificData/SeaTemperature/ImageServer", * timeExtent: { * start: new Date(2014, 4, 18), * end: new Date(2014, 4, 19) * }, * useViewTime: false * }); * @example * // timeExtent is set on the layer and the view * // In this case, the layer will display features that fall * // within the intersection of view and layer time extents * // features within Jan 1, 1976 - Jan 1, 1981 will be displayed * const view = new MapView({ * timeExtent: { * start: new Date(1976, 0, 1), * end: new Date(2002, 0, 1) * } * }); * const layer = new FeatureLayer({ * url: myUrl, * timeExtent: { * start: new Date(1974, 0, 1), * end: new Date(1981, 0, 1) * } * }); * @example * if (!layer.useViewTime) { * if (layer.timeExtent) { * console.log("Current timeExtent:", layer.timeExtent.start, " - ", layer.timeExtent.end} * } else { * console.log("The layer will display data within the view's timeExtent."); * console.log("Current view.timeExtent:", view.timeExtent.start, " - ", view.timeExtent.end} * } * } * @example * // set the timeExtent on the layer and useViewTime false * // In this case, the layer will honor its timeExtent and ignore * // the view's timeExtent * const layer = new ImageryLayer({ * url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/ScientificData/SeaTemperature/ImageServer", * timeExtent: { * start: new Date(2014, 4, 18), * end: new Date(2014, 4, 19) * }, * useViewTime: false * }); * @example * // timeExtent is set on the layer and the view * // In this case, the layer will display features that fall * // within the intersection of view and layer time extents * // features within Jan 1, 1976 - Jan 1, 1981 will be displayed * const view = new MapView({ * timeExtent: { * start: new Date(1976, 0, 1), * end: new Date(2002, 0, 1) * } * }); * const layer = new FeatureLayer({ * url: myUrl, * timeExtent: { * start: new Date(1974, 0, 1), * end: new Date(1981, 0, 1) * } * }); */ get timeExtent(): TimeExtent | null | undefined; set timeExtent(value: TimeExtentProperties | null | undefined); /** * TimeInfo provides information such as date fields that store [start](https://developers.arcgis.com/javascript/latest/references/core/layers/support/TimeInfo/#startField) * and [end](https://developers.arcgis.com/javascript/latest/references/core/layers/support/TimeInfo/#endField) time * for each feature and the [TimeInfo.fullTimeExtent](https://developers.arcgis.com/javascript/latest/references/core/layers/support/TimeInfo/#fullTimeExtent) * for the layer. The `timeInfo` property, along with its `startField` and `endField` properties, must be set at the * time of layer initialization if it is being set for a [GeoJSONLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/). * The timeInfo parameters cannot be changed after the layer is [loaded](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/#loaded). * The [TimeInfo.fullTimeExtent](https://developers.arcgis.com/javascript/latest/references/core/layers/support/TimeInfo/#fullTimeExtent) for `timeInfo` is * automatically calculated based on its `startField` and `endField` properties. * * @since 4.11 * @example * // create geojson layer from usgs earthquakes geojson feed * const geojsonLayer = new GeoJSONLayer({ * url: "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.geojson", * copyright: "USGS Earthquakes", * fields: [ * { "name": "mag", "type": "double" }, * { "name": "place", "type": "string" }, * { "name": "time", "type": "date" }, // date field * { "name": "depth", "type": "double" } * ], * // timeInfo can be used to do temporal queries * // set the startField. * // timeExtent is automatically calculated from the start and end date fields * // The date values must be in milliseconds number from the UNIX epoch specified in UTC. * timeInfo: { * startField: "time" * } * }); * @example * // create geojson layer from usgs earthquakes geojson feed * const geojsonLayer = new GeoJSONLayer({ * url: "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.geojson", * copyright: "USGS Earthquakes", * fields: [ * { "name": "mag", "type": "double" }, * { "name": "place", "type": "string" }, * { "name": "time", "type": "date" }, // date field * { "name": "depth", "type": "double" } * ], * // timeInfo can be used to do temporal queries * // set the startField and endField. * // timeExtent is automatically calculated from the * // the start and end date fields * // The date values must be in milliseconds number from the UNIX epoch specified in UTC. * timeInfo: { * startField: "time" * } * }); */ get timeInfo(): TimeInfo | null | undefined; set timeInfo(value: TimeInfoProperties | null | undefined); /** * A temporary offset of the time data based on a certain [TimeInterval](https://developers.arcgis.com/javascript/latest/references/core/time/TimeInterval/). This allows * users to overlay features from two or more time-aware layers with different time extents. * For example, if a layer has data recorded for the year 1970, an offset value of 2 years would temporarily shift the data to * 1972. You can then overlay this data with data recorded in 1972. * A time offset can be used for display purposes only. The query and selection are not affected by the offset. * * @since 4.14 * @example * // Offset a geojson Layer containing hurricanes from 2015 so that they appear in 2019 (+4 years). * let layer = new GeoJSONLayer({ * url: `hurricanes-and-storms-2015.geojson`, * timeOffset: { * value: 4, * unit: "years" * }, * timeInfo: { * startField: "ISO_time" * }, * renderer: { * type: "simple", * symbol: { * type: "simple-marker", * size: 6, * color: "red", * outline: { * width: 0.5, * color: "black" * } * } * } * }); * @example * // Offset a CSV Layer containing hurricanes from 2015 so that they appear in 2019 (+4 years). * let layer = new CSVLayer({ * url: `hurricanes-and-storms-2015.csv`, * timeOffset: { * value: 4, * unit: "years" * }, * timeInfo: { * startField: "ISO_time" * }, * renderer: { * type: "simple", * symbol: { * type: "simple-marker", * size: 6, * color: "red", * outline: { * width: 0.5, * color: "black" * } * } * } * }); */ get timeOffset(): TimeInterval | null | undefined; set timeOffset(value: TimeIntervalProperties | null | undefined); /** * The title of the layer used to identify it in places such as the [Legend](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-legend/) * and [LayerList](https://developers.arcgis.com/javascript/latest/references/core/widgets/LayerList/). * * @default "GeoJSON" */ accessor title: string | 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(): "geojson"; /** * The URL of the GeoJSON file. * * @example * // create geojson layer from USGS earthquakes data * const layer = new GeoJSONLayer({ * url: "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.geojson" * }); * @example * // create a geojson layer from geojson feature collection * const geojson = { * type: "FeatureCollection", * features: [ * { * type: "Feature", * id: 1, * geometry: { * type: "Polygon", * coordinates: [ * [ * [100.0, 0.0], * [101.0, 0.0], * [101.0, 1.0], * [100.0, 1.0], * [100.0, 0.0] * ] * ] * }, * properties: { * prop0: "value0", * } * } * ] * }; * * // create a new blob from geojson featurecollection * const blob = new Blob([JSON.stringify(geojson)], { * type: "application/json" * }); * * // URL reference to the blob * const url = URL.createObjectURL(blob); * // create new geojson layer using the blob url * const layer = new GeoJSONLayer({ * url * }); */ accessor url: string | null | undefined; /** * Determines if the layer will update its temporal data based on the view's * [View.timeExtent](https://developers.arcgis.com/javascript/latest/references/core/views/View/#timeExtent). When `false`, the layer will display its temporal * data based on the layer's [timeExtent](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/#timeExtent), regardless of changes to the view. * If both view and layer time extents are set while this property is `true`, then the features that fall within * the intersection of the view and layer time extents will be displayed. * For example, if a layer's time extent is set to display features between 1970 and 1975 and * the view has a time extent set to 1972-1980, the effective time on the feature layer will be 1972-1975. * * @default true * @since 4.14 * @example * if (featureLayer.useViewTime) { * console.log("Displaying data between:", view.timeExtent.start, " - ", view.timeExtent.end); * } * @example * if (featureLayer.useViewTime) { * console.log("Displaying data between:", view.timeExtent.start, " - ", view.timeExtent.end); * } */ accessor useViewTime: boolean; /** * Applies edits to features in a layer. New features can be created and existing * features can be updated or deleted on the client side. Feature geometries and/or attributes may be modified. * * If client-side features are added, removed or updated at runtime using [applyEdits()](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/#applyEdits) * then use [queryFeatures()](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/#queryFeatures) to return updated features. * * @param edits - Object containing features to be added, updated or deleted. * @returns Resolves to an object containing edit results. * See the object specification table below for details. * * Property | Type | Description * ---------|------|------------- * addFeatureResults | [FeatureEditResult[]](https://developers.arcgis.com/javascript/latest/references/core/editing/types/#FeatureEditResult) | Result of adding features. * deleteFeatureResults | [FeatureEditResult[]](https://developers.arcgis.com/javascript/latest/references/core/editing/types/#FeatureEditResult) | Result of deleting features. * updateFeatureResults | [FeatureEditResult[]](https://developers.arcgis.com/javascript/latest/references/core/editing/types/#FeatureEditResult) | Result of updating features. * @see [Sample - Edit features](https://developers.arcgis.com/javascript/latest/sample-code/editing-applyedits/) * @example * function addFeature(geometry) { * const attributes = {}; * attributes["Description"] = "This is the description"; * attributes["Address"] = "380 New York St"; * * // Date.now() returns number of milliseconds elapsed * // since 1 January 1970 00:00:00 UTC. * attributes["Report_Date"] = Date.now(); * * const addFeature = new Graphic({ * geometry: geometry, * attributes: attributes * }); * * const deleteFeature = { * objectId: [467] * }; * * const promise = geoJSONLayer.applyEdits({ * addFeatures: [addFeature], * deleteFeatures: [deleteFeature] * }); * } */ applyEdits(edits: Edits): Promise; /** * 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 from feature-based layers or * image footprints from ImageryLayer that satisfy the layer's configurations such as [definitionExpression](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/#definitionExpression). * It will return `Z` and `M` values based on the layer's [data capabilities](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/#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 feature geometries and values for all [available fields](https://developers.arcgis.com/javascript/latest/references/core/views/layers/FeatureLayerView/#availableFields) in * [queries](https://developers.arcgis.com/javascript/latest/references/core/views/layers/FeatureLayerView/#queryFeatures) against the layer views of feature-based layers, or all fields in the layer for * [queries against the layer](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#queryFeatures). * * @returns The query object representing the layer's definition expression and other configurations. * @see [Sample - Query features from a FeatureLayer](https://developers.arcgis.com/javascript/latest/sample-code/featurelayer-query/) * @example * ```js * // Get a query object for the layer's current configuration * queryParams.outFields will be set to ["*"] to get values for all available fields. * const queryParams = layer.createQuery(); * // set a geometry for filtering features by a region of interest * queryParams.geometry = extentForRegionOfInterest; * // Add to the layer's current definitionExpression * queryParams.where = queryParams.where + " AND TYPE = 'Extreme'"; * * // query the layer with the modified params object * layer.queryFeatures(queryParams).then(function(results){ * // prints the array of result graphics to the console * console.log(results.features); * }); * ``` * @example * ```js * // this snippet shows the query parameter object that is returned * // from FeatureLayer.createQuery(). * const queryParams = new Query(); * const dataCapabilities = layer.get("capabilities.data"); * * queryParams.gdbVersion = layer.gdbVersion; * queryParams.historicMoment = layer.historicMoment; * queryParams.returnGeometry = true; * * if (dataCapabilities) { * if (dataCapabilities.supportsZ && layer.returnZ != null) { * queryParams.returnZ = layer.returnZ; * } * * if (dataCapabilities.supportsM && layer.returnM != null) { * queryParams.returnM = layer.returnM; * } * } * * queryParams.outFields = ["*"]; * queryParams.where = layer.definitionExpression || "1=1"; * queryParams.multipatchOption = layer.geometryType === "multipatch" ? "xyFootprint" : null; * ``` * @example * ```js * // this snippet shows query image footprints from imagery layer * // that honors the layer's definitionExpression and other configurations. * if (imageryLayer.capabilities.operations.supportsQuery) { * const query = imageryLayer.createQuery(); * const rasters = await imageryLayer.queryRasters(query); * ``` */ 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` * @see [fields](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/#fields) */ getField(fieldName: string): Field | null | undefined; /** * Returns the Domain associated with the given field name. The domain can be either a CodedValueDomain or 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. */ getFieldDomain(fieldName: string, options?: FieldDomainOptions): DomainUnion | null | undefined; /** * Executes a [AttributeBinsQuery](https://developers.arcgis.com/javascript/latest/references/core/rest/support/AttributeBinsQuery/) against a [GeoJSONLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/), which groups features into bins based on ranges in numeric or date fields, and returns a * [AttributeBinsFeatureSet](https://developers.arcgis.com/javascript/latest/references/core/rest/support/AttributeBinsFeatureSet/) containing the series of bins. Please refer to the [AttributeBinsQuery](https://developers.arcgis.com/javascript/latest/references/core/rest/support/AttributeBinsQuery/) document for more detailed information * on how to configure the bin parameters. * * Binned data can condense complex information into meaningful insight. This query allows you to classify data into meaningful categories and summarize the data * within each bin with summary statistics. * * > [!WARNING] * > * > **Notes** * > * > The `queryAttributeBins()` method is unrelated to querying bins in [FeatureReductionBinning](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FeatureReductionBinning/). * * @param binsQuery - Specifies the parameters of the `queryAttributeBins()` operation. The [AttributeBinsQuery.binParameters](https://developers.arcgis.com/javascript/latest/references/core/rest/support/AttributeBinsQuery/#binParameters) property must be set. * @param options - Abort options that can be passed into an asynchronous method to allow termination. * @returns When resolved, returns a [AttributeBinsFeatureSet](https://developers.arcgis.com/javascript/latest/references/core/rest/support/AttributeBinsFeatureSet/) containing a series of bins. Each feature in the AttributeBinsFeatureSet * represents a bin. The attributes of each feature contain statistics summarizing the data in the bin, including count, average, standard deviation, etc. * @since 4.33 * @see [AttributeBinsQuery](https://developers.arcgis.com/javascript/latest/references/core/rest/support/AttributeBinsQuery/) * @see [Sample - Attribute Bins Query](https://developers.arcgis.com/javascript/latest/sample-code/query-attribute-bins/) */ queryAttributeBins(binsQuery: AttributeBinsQueryProperties, options?: RequestOptions): Promise; /** * Executes a [Query](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/) against the feature 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 layer's configuration/filters are returned. * * * > [!WARNING] * > - To query for the extent of features/graphics visible in the view on the client-side rather than making a server-side query, you must use the * > [GeoJSONLayerView.queryExtent()](https://developers.arcgis.com/javascript/latest/references/core/views/layers/GeoJSONLayerView/#queryExtent). * > - Spatial queries have the same limitations as those listed in the [projectOperator](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/projectOperator/) documentation. * > - Spatial queries are currently not supported if the layer view has any of the following [SpatialReferences](https://developers.arcgis.com/javascript/latest/references/core/geometry/SpatialReference/): * > - GDM 2000 (4742) - Malaysia * > - Gusterberg (Ferro) (8042) - Austria/Czech Republic * > - ISN2016 (8086) - Iceland * > - SVY21 (4757) - Singapore * * @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 layer's configuration/filters are returned. * @param options - Additional request options. See [RequestOptions](https://developers.arcgis.com/javascript/latest/references/core/request/types/#RequestOptions). * @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. * @see [Sample - Zoom to extent of all features](https://developers.arcgis.com/javascript/latest/sample-code/featurelayer-queryextent/) * @example * ```js * // Queries for the extent of all features matching the layer's configurations * // e.g. definitionExpression * layer.queryExtent().then((result) =>{ * // go to the extent of the result satisfying the query * viewElement.goTo(result.extent); * }); * ``` * @example * ```js * const query = new Query(); * query.where = "region = 'Southern California'"; * * const result = await layer.queryExtent(query); * viewElement.goTo(result.extent); // go to the extent of the result 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 feature service or layer data and * returns the number of features that satisfy the query. If no parameters are specified, * the total number of features satisfying the layer's configuration/filters is returned. * * * > [!WARNING] * > - To query the count of features available in the view on the client-side rather than making a server-side query, use * > [GeoJSONLayerView.queryFeatureCount()](https://developers.arcgis.com/javascript/latest/references/core/views/layers/GeoJSONLayerView/#queryFeatureCount). * > - Spatial queries have the same limitations as those listed in the [projectOperator](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/projectOperator/) documentation. * > - Spatial queries are currently not supported if the layer view has any of the following [SpatialReferences](https://developers.arcgis.com/javascript/latest/references/core/geometry/SpatialReference/): * > - GDM 2000 (4742) - Malaysia * > - Gusterberg (Ferro) (8042) - Austria/Czech Republic * > - ISN2016 (8086) - Iceland * > - SVY21 (4757) - Singapore * * @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 - Additional request options. See [RequestOptions](https://developers.arcgis.com/javascript/latest/references/core/request/types/#RequestOptions). * @returns When resolved, returns the number of features that satisfy the query. * @see [Sample - Query features from a FeatureLayer](https://developers.arcgis.com/javascript/latest/sample-code/featurelayer-query/) * @example * ```js * // Queries for the count of all features matching the layer's configurations * // e.g. definitionExpression * layer.queryFeatureCount().then((numFeatures) => { * // prints the total count to the console * console.log(numFeatures); * }); * ``` * @example * ```js * const query = new Query(); * query.where = "region = 'Southern California'"; * * const featureCount = await layer.queryFeatureCount(query); * console.log(featureCount); // prints the number of results satisfying the query * ``` */ queryFeatureCount(query?: QueryProperties | null | undefined, options?: RequestOptions): Promise; /** * Executes a [Query](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/) against a feature service or layer data and returns a * [FeatureSet](https://developers.arcgis.com/javascript/latest/references/core/rest/support/FeatureSet/) once the promise resolves. A FeatureSet contains an array of [features](https://developers.arcgis.com/javascript/latest/references/core/Graphic/). * * > [!WARNING] * > * > **Notes** * > - To query features visible in the view on the client-side rather than making a server-side query, use * > [GeoJSONLayerView.queryFeatures()](https://developers.arcgis.com/javascript/latest/references/core/views/layers/GeoJSONLayerView/#queryFeatures). * > - Attribute values used in attribute queries executed against these layers are case sensitive. * > - Spatial queries have the same limitations as those listed in the [projectOperator](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/projectOperator/) documentation. * > - Spatial queries are currently not supported if the layer view has any of the following [SpatialReferences](https://developers.arcgis.com/javascript/latest/references/core/geometry/SpatialReference/): * > - GDM 2000 (4742) - Malaysia * > - Gusterberg (Ferro) (8042) - Austria/Czech Republic * > - ISN2016 (8086) - Iceland * > - SVY21 (4757) - Singapore * * @param query - Specifies the attributes and spatial filter of the query. If no parameters are specified, all features satisfying the layer's configuration/filters are returned. * @param options - Additional request options. See [RequestOptions](https://developers.arcgis.com/javascript/latest/references/core/request/types/#RequestOptions). * @returns When resolved, returns a [FeatureSet](https://developers.arcgis.com/javascript/latest/references/core/rest/support/FeatureSet/) containing an array of graphic features. * @since 4.34 * @see [Samples using queryFeatures() method](https://developers.arcgis.com/javascript/latest/sample-code/?tagged=queryfeatures) * @see [Query and filter guide](https://developers.arcgis.com/javascript/latest/query-filter/) * @example * ```js * // Queries for all the features matching the layer's configurations * // e.g. definitionExpression * const results = await layer.queryFeatures(); * // prints the array of result graphics to the console * console.log(results.features); * ``` * @example * ```js * // create a query object to filter features by setting desired properties * const query = new Query(); * query.where = "STATE_NAME = 'Washington'"; * query.outSpatialReference = { wkid: 102100 }; * query.returnGeometry = true; * query.outFields = [ "CITY_NAME" ]; * * const results = await layer.queryFeatures(query); * console.log(results.features); // prints the array of features to the console * ``` * @example * ```js * // Get a query object for the layer's current configuration * const queryParams = layer.createQuery(); * // set a geometry for filtering features by a region of interest * queryParams.geometry = extentForRegionOfInterest; * // Add to the layer's current definitionExpression * queryParams.where = queryParams.where + " AND TYPE = 'Extreme'"; * * // query the layer with the modified params object * const results = await layer.queryFeatures(queryParams); * // prints the array of result graphics to the console * console.log(results.features); * ``` * @example * ```js * // 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"] * }; * * const results = await layer.queryFeatures(query); * console.log(results.features); // prints the array of features to the console * ``` */ queryFeatures(query?: QueryProperties | null | undefined, options?: RequestOptions): Promise; /** * Executes a [Query](https://developers.arcgis.com/javascript/latest/references/core/rest/support/Query/) against the feature 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. * * * > [!WARNING] * > - To query the ObjectIDs of features visible in the view on the client-side rather than making a server-side query, use * > [GeoJSONLayerView.queryObjectIds()](https://developers.arcgis.com/javascript/latest/references/core/views/layers/GeoJSONLayerView/#queryObjectIds). * > - Spatial queries have the same limitations as those listed in the [projectOperator](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/projectOperator/) documentation. * > - Spatial queries are currently not supported if the layer view has any of the following [SpatialReferences](https://developers.arcgis.com/javascript/latest/references/core/geometry/SpatialReference/): * > - GDM 2000 (4742) - Malaysia * > - Gusterberg (Ferro) (8042) - Austria/Czech Republic * > - ISN2016 (8086) - Iceland * > - SVY21 (4757) - Singapore * * @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 layer's configuration/filters are returned. * @param options - Additional request options. See [RequestOptions](https://developers.arcgis.com/javascript/latest/references/core/request/types/#RequestOptions). * @returns When resolved, returns an array of numbers representing the object IDs of the features satisfying the query. * @see [Sample - Query Related Features](https://developers.arcgis.com/javascript/latest/sample-code/query-related-features/) * @example * ```js * // Queries for all the Object IDs of features matching the layer's configurations * // e.g. definitionExpression * layer.queryObjectIds().then((results) => { * // prints the array of Object IDs to the console * console.log(results); * }); * ``` * @example * ```js * const query = new Query({ * where: "SUB_REGION = 'Pacific'" * }); * * const ids = await layer.queryObjectIds(query); * console.log(ids); // an array of object IDs * ``` */ queryObjectIds(query?: QueryProperties | null | undefined, options?: RequestOptions): Promise; /** * Fetches all the data for the layer. * * @since 4.22 * @see [refreshInterval](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/#refreshInterval) * @see [refresh event](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/#event-refresh) * @see [Sample - GeoJSONLayer with dynamic URL](https://developers.arcgis.com/javascript/latest/sample-code/layers-geojson-refresh/) * @example * // update the customParameters for the query then call * // refresh method to fetch new features from the geojson * geojsonLayer.customParameters.limit = 10; * geojsonLayer.refresh(); * @see [RefreshableLayer.refreshInterval](https://developers.arcgis.com/javascript/latest/references/core/layers/mixins/RefreshableLayer/#refreshInterval) * @see [refresh event](https://developers.arcgis.com/javascript/latest/references/core/layers/mixins/RefreshableLayer/#event-refresh) */ refresh(): void; } declare const GeoJSONLayerSuperclass: typeof Layer & typeof MultiOriginJSONSupportMixin & typeof PortalLayer & typeof OperationalLayer & typeof RefreshableLayer & typeof ScaleRangeLayer & typeof TrackableLayer & typeof TemporalLayer & typeof BlendLayer & typeof FeatureEffectLayer & typeof FeatureReductionLayer & typeof CustomParametersMixin & typeof DisplayFilteredLayer & typeof OrderedLayer