csvUtils

AMD: require(["esri/layers/support/csvUtils"], (csvUtils) => { /* code goes here */ });
ESM: import * as csvUtils from "@arcgis/core/layers/support/csvUtils.js";
Object: esri/layers/support/csvUtils
Since: ArcGIS Maps SDK for JavaScript 4.32

Provides utility functions for the CSVLayer.

See also

Method Overview

Name Return Type Summary Object
Promise<CSVLayerInfo>

Retrieves information about a CSV layer from a given URL.

csvUtils

Method Details

getCSVLayerInfo

Method
getCSVLayerInfo(url, options){Promise<CSVLayerInfo>}

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.

Parameters
Specification
url String

The URL of the CSV file.

options Object
optional

An object specifying additional options. See the object specification table below for the properties of this object.

Specification
customParameters Object
optional

A list of key-value pairs of parameters to append to the url.

optional

An AbortSignal to abort the executions of the remote method. If canceled, the promise will be rejected with an error named AbortError. See also AbortController.

Returns
Type Description
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);

Type Definitions

CSVLayerInfo

Type Definition
CSVLayerInfo

The layer info inferred from the CSV file.

Properties
url String

The URL to the CSV file.

fields Field[]

The fields on the layer.

delimiter String

The delimiter used in the CSV file.

latitudeField String|undefined
optional

The field name containing the latitude values.

longitudeField String|undefined
optional

The field name containing the longitude values.

customParameters Object|null|undefined
optional

The custom parameters applied to the layer.

See also

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.

You can no longer sign into this site. Go to your ArcGIS portal or the ArcGIS Location Platform dashboard to perform management tasks.

Your ArcGIS portal

Create, manage, and access API keys and OAuth 2.0 developer credentials, hosted layers, and data services.

Your ArcGIS Location Platform dashboard

Manage billing, monitor service usage, and access additional resources.

Learn more about these changes in the What's new in Esri Developers June 2024 blog post.

Close