import { getCSVLayerInfo } from "@arcgis/core/layers/support/csvUtils.js";const { getCSVLayerInfo } = await $arcgis.import("@arcgis/core/layers/support/csvUtils.js");Type definitions
CSVLayerInfo
Type definition
The layer info inferred from the CSV file.
- See also
customParameters
Property
- Type
- CustomParameters | null | undefined
The custom parameters applied to the layer.
CSVLayerInfoOptions
Type definition
Options for the getCSVLayerInfo() function.
- Supertypes
- AbortOptions
customParameters
Property
- Type
- CustomParameters | null | undefined
A list of key-value pairs of parameters to append to the url.
Functions
| Name | Return Type | Object |
|---|---|---|
| | |
| | |
| |
getCSVLayerInfo
Function
Retrieves information about a CSV layer from a given URL. This function throws an error if the CSV is empty or if the delimiter cannot be detected.
- Signature
-
getCSVLayerInfo (url: string, options?: CSVLayerInfoOptions): Promise<CSVLayerInfo>
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| url | The URL of the CSV file. | | |
| options | An object specifying additional options. See CSVLayerInfoOptions for details. | |
- Returns
- Promise<CSVLayerInfo>
A promise that resolves to the CSV layer information.
Example
const url = "https://example.com/data.csv";const info = await getCSVLayerInfo(url);// present to the user the fields and the delimiter, then create the layerconst layer = new CSVLayer(info);