require(["esri/layers/support/csvUtils"], (csvUtils) => { /* code goes here */ });
import * as csvUtils from "@arcgis/core/layers/support/csvUtils.js";
esri/layers/support/csvUtils
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
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.
ParametersSpecificationurl StringThe URL of the CSV file.
options ObjectoptionalAn object specifying additional options. See the object specification table below for the properties of this object.
SpecificationcustomParameters ObjectoptionalA list of key-value pairs of parameters to append to the url.
signal AbortSignal|null|undefinedoptionalAn AbortSignal to abort the executions of the remote method. If canceled, the promise will be rejected with an error named
AbortError
. See also AbortController.ReturnsType Description Promise<CSVLayerInfo> A promise that resolves to the CSV layer information. Exampleconst 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
-
The layer info inferred from the CSV file.