DataLoader Class
A module for loading from web services and local files. Fetches data via File API (IE9 is currently not supported) or via XmlHttpRequest. Handles GeoJSON, Shapefiles and CSV currently. Includes utilities for parsing files into GeoJSON (currently the selected intermediate format) and converting GeoJSON into FeatureLayers for consumption by the ESRI JS API.
Imports RAMP Modules:
Methods
enhanceFileFeatureLayer
-
featureLayer
-
opts
Will take a feature layer built from user supplied data, and apply extra user options (such as symbology, display field), and generate a config node for the layer. Accepts the following options:
- renderer: a string identifying one of the properties in defaultRenders
- color: color of the renderer
- icon: icon to display in grid and maptips
- nameField: descriptive name field for the layer
- datasetName: description of the name field
makeGeoJsonLayer
-
geoJson
-
opts
Converts a GeoJSON object into a FeatureLayer. Expects GeoJSON to be formed as a FeatureCollection containing a uniform feature type (FeatureLayer type will be set according to the type of the first feature entry). Accepts the following options:
- renderer: a string identifying one of the properties in defaultRenders
- sourceProjection: a string matching a proj4.defs projection to be used for the source data (overrides geoJson.crs)
- targetWkid: an integer for an ESRI wkid, defaults to map wkid if not specified
- fields: an array of fields to be appended to the FeatureLayer layerDefinition (OBJECTID is set by default)
Parameters:
Returns:
An ESRI FeatureLayer
Properties
featureTypeToRenderer
Object
private
Maps GeoJSON geometry types to a set of default renders defined in GlobalStorage.DefaultRenders