Reusable Accessible Mapping Platform

API Docs for: 5.2.0
Show:

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:

LayerLoader
GlobalStorage
Map
Util

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

Parameters:

  • featureLayer Object

    a feature layer object generated by makeGeoJsonLayer

  • opts Object

    An object for supplying additional parameters

makeGeoJsonLayer

(
  • geoJson
  • opts
)
FeatureLayer

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:

  • geoJson Object

    An object following the GeoJSON specification, should be a FeatureCollection with Features of only one type

  • opts Object

    An object for supplying additional parameters

Returns:

FeatureLayer:

An ESRI FeatureLayer

Properties

featureTypeToRenderer

Object private

Maps GeoJSON geometry types to a set of default renders defined in GlobalStorage.DefaultRenders