Skip to content
import { getCSVLayerInfo } from "@arcgis/core/layers/support/csvUtils.js";
Since
ArcGIS Maps SDK for JavaScript 4.32

Provides utility functions for the CSVLayer.

See also

Type definitions

CSVLayerInfo

Type definition

The layer info inferred from the CSV file.

See also

url

Property
Type
string

The URL to the CSV file.

delimiter

Property
Type
string

The delimiter used in the CSV file.

fields

Property
Type
Field[]

The fields on the layer.

latitudeField

Property
Type
string | undefined

The field name containing the latitude values.

longitudeField

Property
Type
string | undefined

The field name containing the longitude values.

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

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
ParameterTypeDescriptionRequired
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 layer
const layer = new CSVLayer(info);