Global

Members

(private, constant) featureTypeToRenderer

Source:
Properties:
Name Type Description
featureTypeToRenderer Object

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

(constant) serviceType

Source:
Properties:
Name Type Description
serviceType Object

Different types of services that a URL could point to

Methods

(private) _addLine(path, spatialReference, id, opts)

Source:

Add a line where specified using the path of longitutes and latitutes.

Parameters:
Name Type Description
path Array

an array of long and lat to use as the path for the line

spatialReference Object

the projection the graphics should be in

id String

id of api geometry being added to map

opts Object

options to apply to line

(private) _addMultiLine(paths, spatialReference, id, opts)

Source:

Add multiple lines where specified using the path of longitutes and latitutes.

Parameters:
Name Type Description
paths Array

a 3D array of long and lat to use as the paths for the lines

spatialReference Object

the projection the graphics should be in

id String

id of api geometry being added to map

opts Object

options to apply to lines

(private) _addMultiPoint(coords, spatialReference, icon, id, opts)

Source:

Add multiple points where specified using the longitutes and latitutes.

Parameters:
Name Type Description
coords Array

a 3D array of long and lat to use as the graphic location for each point

spatialReference Object

the projection the graphics should be in

icon String

data / image url or svg path for layer icon. defaults to a green point

id String

id of api geometry being added to map

opts Object

options to apply to points

(private) _addPoint(coords, spatialReference, icon, id, opts)

Source:

Add a point where specified using longitute and latitute.

Parameters:
Name Type Description
coords Object

the long and lat to use as the graphic location

spatialReference Object

the projection the graphics should be in

icon String

data / image url or svg path for layer icon. defaults to a red point

id String

id of api geometry being added to map

opts Object

options to apply to point

(private) _addPolygon(rings, spatialReference, id, opts)

Source:

Add a polygon where specified using the rings provided.

Parameters:
Name Type Description
rings Array

an array of rings containing an array of coordinates

spatialReference Object

the projection the graphics should be in

id String

id of api geometry being added to map

opts Object

settings such as color and opacity for the polygon

(private) _attribsAdded(idx, attribs)

Source:

Reacts to a layer downloading attributes.

Parameters:
Name Type Description
idx String

the index of the layer whose attributes were downloaded

attribs Object

the layer attributes downloaded

(private) _fireEvent(handlerArray, …eventParams)

Source:

Utility for triggering an event and giving it to the listeners

Parameters:
Name Type Attributes Description
handlerArray Array

array of event handler functions

eventParams Object <repeatable>

arbitrary set of parameters to pass to the event handler functions

(private) _isUrl(text) → {Boolean}

Source:

Check to see if text provided is a valid image / data URL based on extension type or format.

Parameters:
Name Type Description
text String

string to be matched against valid image types / data url format

Returns:

true if valid image extension

Type
Boolean

(private) _listToSymbology(conversionFunction, list) → {Array}

Source:

Converts a config-supplied list of symbology to the format used by layer records.

Parameters:
Name Type Description
conversionFunction function

a conversion function to wrap the supplied image into an image or an icon style symbology container

list Array

a list of config-supplied symbology items in the form of [ { text: , image: }, ... ] wher image can be dataURL or an actual url

Returns:

an array of converted symbology symbols in the form of [ { name: , image: , svgcode: }, ... ]; items will be populated async as conversions are done

Type
Array

(private) _stateChange(newState)

Source:

Reacts to a layer-level state change.

Parameters:
Name Type Description
newState String

the state the layer has now become

(private) _zoomToScaleSet(map, lods, zoomIn, scaleSet, positionOverLayer) → {Promise}

Source:

Figure out visibility scale and zoom to it. Will use layer minScale/maxScale and map levels of detail to determine scale boundaries.

Parameters:
Name Type Description
map Object

the map object

lods Array

level of details array for basemap

zoomIn Boolean

the zoom to scale direction; true need to zoom in; false need to zoom out

scaleSet Object

contains min and max scales for the layer

positionOverLayer Boolean

ensures the map is over the layer's extent after zooming. only applied if zoomIn is true. defaults to true

Returns:

promise that resolves after map finishes moving about

Type
Promise

abortAttribLoad()

Source:

Attempts to abort an attribute load in progress. Harmless to call before or after an attribute load.

abortAttribLoad()

Source:

Attempts to abort an attribute load in progress. Harmless to call before or after an attribute load.

addAttribListener(listenerCallback)

Source:

Wire up attrib added listener.

Parameters:
Name Type Description
listenerCallback function

function to call when attributes download event happens

addGeometry(geo, spatialReference)

Source:

Identify the type of geometry being added and add it to the map.

Parameters:
Name Type Description
geo Object | Array

api geometry class to be added

spatialReference Object

the projection the graphics should be in

addHilight(graphic, clearLayer)

Source:

Add a graphic or array of graphics to the highlight layer. Remove any previous graphics.

Parameters:
Name Type Description
graphic Graphic | Array

an ESRI graphic, or array of ESRI graphics. Should be in map spatialReference, and not bound to a layer

clearLayer Boolean

indicates any previous graphics in the hilight layer should be removed. defaults to false

addHoverListener(listenerCallback)

Source:

Wire up mouse hover listener.

Parameters:
Name Type Description
listenerCallback function

function to call when a hover event happens

addHoverListener(listenerCallback)

Source:

Wire up mouse hover listener.

Parameters:
Name Type Description
listenerCallback function

function to call when a hover event happens

addPin(point, clearLayer)

Source:

Add a graphic to indicate where user clicked.

Parameters:
Name Type Description
point Point

an ESRI point object to use as the graphic location

clearLayer Boolean

indicates any previous graphics in the hilight layer should be removed. defaults to false

addStateListener(listenerCallback)

Source:

Wire up state change listener.

Parameters:
Name Type Description
listenerCallback function

function to call when a state change event happens

aliasedFieldName(attribName, childIndex) → {Promise}

Source:

Get the best user-friendly name of a field. Uses alias if alias is defined, else uses the system attribute name.

Parameters:
Name Type Description
attribName String

the attribute name we want a nice name for

childIndex String

index of the child layer whos attributes we are looking at

Returns:

resolves to the best available user friendly attribute name

Type
Promise

allComb(M, N)

Source:

Generate all permutations of length M, with exactly N true values.

Parameters:
Name Type Description
M int

the size of the array (must be greater than 0)

N int

the number of entries which should be true (must not be greater than M)

Returns:

an array containing all possible size M arrays of boolean values with N true entries

(private) allocateLayersToSections(layers, sectionsAvailable, mapHeight)

Source:
Parameters:
Name Type Description
layers Array

a list of layers to be updated (modified in place)

sectionsAvailable int

the maximum number of sections to use

mapHeight int

the rendered height of the map image

Returns:

the same layers array as passed in

(private) arrayBufferToString(buffer) → {String}

Source:

Converts an array buffer to a string

Parameters:
Name Type Description
buffer Arraybuffer

an array buffer containing stuff (ideally string-friendly)

Returns:

array buffer in string form

Type
String

assignIds()

Source:

Performs in place assignment of integer ids for a GeoJSON FeatureCollection. If at least one feature has an existing id outside the geoJson properties section, the original id value is copied in a newly created property ID_FILE of the properties object and the existing id value is replaced by an autogenerated number. Features without existing id from that same dataset will get a new properties ID_FILE with an empty string as value.


If at least one feature has an existing OBJECTID inside the geoJson properties section, the original OBJECTID value is copied in a newly created property OBJECTID_FILE of the properties object and the existing OBJECTID value is replaced by an autogenerated number. Features without existing OBJECTID from that same dataset will get a new properties OBJECTID_FILE with an empty string as value.

(private) assignLayerSplits(layers, splitPoints)

Source:

Convenience function for assigning the splitBefore property on layers at specified points. NOTE: this function modifies data in place

Parameters:
Name Type Description
layers Array

a list of layers to be updated (modified in place)

splitPoints Array

an array of boolean values indicating if the layer list should be split at that point (must be layers.length-1 in size)

Returns:

layers the same array as passed in

attribsLoaded() → {Boolean}

Source:

Indicates if attributes have been downloaded for this FC.

Returns:

true if attributes are downloaded.

Type
Boolean

bindEvents(layer)

Source:

Attach record event handlers to common layer events

Parameters:
Name Type Description
layer Object

the api layer object

bindEvents(layer)

Source:

Attach record event handlers to common layer events

Parameters:
Name Type Description
layer Object

the api layer object

checkDateType(attribName, childIndex) → {Promise}

Source:

Check to see if the attribute in question is an esriFieldTypeDate type.

Parameters:
Name Type Description
attribName String

the attribute name we want to check if it's a date or not

childIndex String

index of the child layer whos attributes we are looking at

Returns:

resolves to true or false based on the attribName type being esriFieldTypeDate

Type
Promise

checkProj(spatialReference, epsgLookup) → {Object}

Source:

Check whether or not a spatialReference is supported by proj4 library.

Parameters:
Name Type Description
spatialReference Object

to be checked to see if it's supported by proj4. Can be ESRI SR object or a EPSG string.

epsgLookup function

an optional lookup function for EPSG codes which are not loaded in the proj4 definitions, the function should take a numeric EPSG code and return a Promise resolving with a proj4 style definition string

Returns:

with the structure { foundProj: (bool) indicates if the projection was found without a web lookup, message: (string) provides a reason why the projection was not found, lookupPromise: (Promise) an promise resolving after any web lookups. Resolves with true or false overall success. }

Type
Object

(private) cleanRenderer(renderer, fields) → {Object}

Source:

Will inspect the field names in a renderer and adjust any mis-matched casing to align with the layer field definitions

Parameters:
Name Type Description
renderer Object

a layer renderer in json format

fields Array

list of field objects for the layer

Returns:

the renderer with any fields adjusted with proper case

Type
Object

cleanUpAttribs()

Source:

Deletes any pre-loaded attributes when the layer automatically refreshes to ensure up-to-date attributes are loaded next time

cleanUpFields(geoJson, layerDefinition)

Source:

Rename any fields with invalid names. Both parameters are modified in place.

Parameters:
Name Type Description
geoJson Object

layer data in geoJson format

layerDefinition Object

layer definition of feature layer not yet created

clearHilight()

Source:

Remove hilight from map

(private) clipExtentCoords(mid, max, min, mapMax, mapMin, len) → {Array}

Source:

Compares to sets of co-ordinates for extents (valid for both x and y). If center of input co-ordinates falls outside map co-ordiantes, function will adjust them so the center is inside the map co-ordinates.

Parameters:
Name Type Description
mid Numeric

middle of the the range to test

max Numeric

maximum value of the range to test

min Numeric

minimum value of the range to test

mapMax Numeric

maximum value of the map range

mapMin Numeric

minimum value of the map range

len Numeric

length of the adjusted range, if adjusted

Returns:

two element array of Numeric, containing result max and min values

Type
Array

constructLayer() → {Object}

Source:

Generates a new api layer object.

Returns:

the new api layer object.

Type
Object

convertImageToCanvas(url, canvas, crossOrigin) → {Promise}

Source:

Convert an image to a canvas element

Parameters:
Name Type Default Description
url String

image url to convert (result from the esri print task)

canvas Object null

[optional = null] canvas to draw the image upon; if not supplied, a new canvas will be made

crossOrigin Boolean true

[optional = true] when set, tries to fetch an image with crossOrigin = anonymous

Returns:

conversion promise resolving into a canvas of the image

Type
Promise

convertImagetoDataURL(imageUri, imageType) → {Promise}

Source:

Loads an image (as crossing) and converts it to dataURL. If a supplied imageUri is already a dataURL, just return it. If an image fails to load with the crossing attribute, return the original imageUri

Parameters:
Name Type Description
imageUri String

url of the image to load and convert

imageType String

[optional = 'image/png'] format of the image representation

Returns:

promise resolving with the dataURL of the image

Type
Promise

(private) crawlLayerInfos(layerInfos, urlMap)

Source:

Recursively crawl a wms layer info structure. Store any legends in the provided map object.

Parameters:
Name Type Description
layerInfos Array

array of ESRI WMSLayerInfo objects

urlMap Map

a Map of sublayer names to legend urls

(private) createAttribSet(oidField, featureData) → {Object}

Source:

Will generate attribute package with object id indexes

Parameters:
Name Type Description
oidField String

field containing object id

featureData Array

feature objects to index and return

Returns:

object containing features and an index by object id

Type
Object

createBasemap(esriBundle, basemapConfig) → {Object}

Source:

Create a basemap object using the config settings provided.

Parameters:
Name Type Description
esriBundle Object

ESRI modules from the initial startup

basemapConfig Object

basemap settings in the form { id: string, layers: [string], title: string, thumbnailUrl: string, wkid: integer }

Returns:

a basemap object:

Type
Object

csvPeek(csvData, delimiter) → {Array}

Source:

Peek at the CSV output (useful for checking headers)

Parameters:
Name Type Description
csvData string

the CSV data to be processed

delimiter string

the delimiter used by the data

Returns:

an array of arrays containing the parsed CSV

Type
Array

dataSource() → {String}

Source:

Indicates if the layer is file based, WFS, or esri based.

Returns:

'file' if file layer, 'wfs' if WFS, else 'esri'

Type
String

dataSource() → {String}

Source:

Indicates the layer is WMS based.

Returns:

'wms' since WMS based layer

Type
String

dataSource()

Source:

Indicates if layer is file based, WMS, WFS, or esri based.

enforceBoundary(extent, maxExtent) → {Object}

Source:

Checks if the center of the given extent is outside of the maximum extent. If it is, will determine an adjusted extent with a center inside the maximum extent. Returns both an indicator flag if an adjustment happened, and the adjusted extent.

Parameters:
Name Type Description
extent Object

an ESRI extent to test

maxExtent Object

an ESRI extent indicating the boundary of the map

Returns:

an object with two properties. adjusted - boolean, true if extent was adjusted. newExtent - object, adjusted ESRI extent

Type
Object

enhanceRenderer(renderer, legend) → {Promise}

Source:

Will add extra properties to a renderer to support images. New properties .svgcode and .defaultsvgcode contains image source for app on each renderer item.

Parameters:
Name Type Description
renderer Object

an ESRI renderer object in server JSON form. Param is modified in place

legend Object

object for the layer that maps legend label to data url of legend image

Returns:

resolving when the renderer has been enhanced

Type
Promise

extractFields()

Source:

Extracts fields from the first feature in the feature collection, does no guesswork on property types and calls everything a string.

fetchGraphic(childIndex, objId, opts) → {Promise}

Source:

Fetches a graphic from the given child layer. Will attempt local copy (unless overridden), will hit the server if not available.

Parameters:
Name Type Description
childIndex String

index of the child layer to target

objId Integer

ID of object being searched for

opts Object

object containing option parametrs

            - map           map wrapper object of current map. only required if requesting geometry
            - geom          boolean. indicates if return value should have geometry included. default to false
            - attribs       boolean. indicates if return value should have attributes included. default to false
Returns:

resolves with a bundle of information. .graphic is the graphic; .layerFC for convenience

Type
Promise

fetchGraphic(objId, opts) → {Promise}

Source:

Fetches a graphic for the given object id. Will attempt local copy (unless overridden), will hit the server if not available.

Parameters:
Name Type Description
objId Integer

ID of object being searched for

opts Object

object containing option parametrs

            - map           map wrapper object of current map. only required if requesting geometry
            - geom          boolean. indicates if return value should have geometry included. default to false
            - attribs       boolean. indicates if return value should have attributes included. default to false
Returns:

resolves with a bundle of information. .graphic is the graphic; .layerFC for convenience

Type
Promise

fetchGraphic(objectId, opts) → {Promise}

Source:

Fetches a graphic from the given layer. Will attempt local copy (unless overridden), will hit the server if not available.

Parameters:
Name Type Description
objectId Integer

ID of object being searched for

opts Object

object containing option parametrs

            - map           map wrapper object of current map. only required if requesting geometry
            - geom          boolean. indicates if return value should have geometry included. default to false
            - attribs       boolean. indicates if return value should have attributes included. default to false
Returns:

resolves with a bundle of information. .graphic is the graphic; .layerFC for convenience

Type
Promise

filterifyRenderer(renderer, fields)

Source:

Will add extra properties to a renderer to support filtering by symbol. New property .definitionClause contains sql where fragment valid for symbol for app on each renderer item.

Parameters:
Name Type Description
renderer Object

an ESRI renderer object in server JSON form. Param is modified in place

fields Array

Optional. Array of field definitions for the layer the renderer belongs to. If missing, all fields are assumed as String

(private) findCandidates(rows, regular, range) → {Array}

Source:

Find the suitable candidate fields that passes the regular expressions specified

Parameters:
Name Type Description
rows Array

csv data

regular RegExp

expression for the value of the field

range Array

the range of the candidate cell values should be within. range[0] is the lower limit and range[1] is the upper limit.

Returns:

a list of suitable candidate fields

Type
Array

findClosestLOD(lods, scale) → {Object}

Source:

Finds the level of detail closest to the provided scale.

Parameters:
Name Type Description
lods Array

list of levels of detail objects

scale Number

scale value to search for in the levels of detail

Returns:

the level of detail object closest to the scale

Type
Object

(private) findOptimalSplit(layer, splitCount)

Source:

Find the optimal split points for the given layer.

Parameters:
Name Type Description
layer Object

a layer object to be split into splitCount parts

splitCount int

the number of pieces which the layer should be broken into

Returns:

a reference to the layer passed in

findZoomScale(lods, scaleSet, zoomIn) → {Object}

Source:

Figure out visibility scale. Will use layer minScale/maxScale and map levels of detail to determine scale boundaries.

Parameters:
Name Type Description
lods Array

array of valid levels of detail for the map

scaleSet Object

contains .minScale and .maxScale for valid viewing scales

zoomIn Boolean

the zoom to scale direction; true need to zoom in; false need to zoom out

Returns:

a level of detail (lod) object for the appropriate scale to zoom to

Type
Object

fitInto(element, CONTAINER_SIZE)

Source:

Fits svg element in the size specified

Parameters:
Name Type Description
element Ojbect

svg element to fit

CONTAINER_SIZE Number

width/height of a container to fit the element into

generateLocalCanvas(map, options, canvas) → {Promise}

Source:

Create a canvas from the user added layers (svg tag)

Parameters:
Name Type Default Description
map Object

esri map object

options Object null

[optional = null] { width, height } values; needed to get canvas of a size different from default width {Number} height {Number}

canvas Object null

[optional = null] canvas to draw the image upon; if not supplied, a new canvas will be made

Returns:

resolving when the canvas have been created resolve with a canvas element with user added layer on it

Type
Promise

(private) generatePlaceholderSymbology(name, colour) → {Object}

Source:

Generates a placeholder symbology graphic. Returns a promise for consistency

Parameters:
Name Type Description
name String

label symbology label

colour String

colour to use in the graphic

Returns:

symbology svg code and its label

Type
Object

generateServerImage(esriBundle, map, options) → {Promise}

Source:

Generate the image from the esri print task

Parameters:
Name Type Description
esriBundle Object

bundle of API classes

map Object

esri map object

options Object

options for the print task url - for the esri geometry server format - output format width - target image height if different from default height - target image width if different from default

Returns:

resolving when the print task created the image resolve with a "response: { url: value }" where url is the path for the print task export image

Type
Promise

generateUUID() → {String}

Source:

Get a 'good enough' uuid. For backup purposes if client does not supply its own unique layer id

Returns:

a uuid

Type
String

generateWMSSymbology(name, imageUri) → {Promise}

Source:

Generates svg symbology for WMS layers.

Parameters:
Name Type Description
name String

label for the symbology item (it's not used right now, but is required to be consistent with other symbology generating functions)

imageUri String

url or dataUrl of the legend image

Returns:

a promise resolving with symbology svg code and its label

Type
Promise

geomToGraphic(geometry, symbol) → {Object}

Source:

Generating a graphic from server geometry.

Parameters:
Name Type Description
geometry Object

feature geometry conforming to ESRI Geometry standard

symbol Object

esri symbol in server format

Returns:

an ESRI GraphicsLayer

Type
Object

getAttribs() → {Promise}

Source:

Returns attribute data for this FC.

Returns:

resolves with a layer attribute data object

Type
Promise

getAttribs() → {Promise}

Source:

Returns attribute data for this layer.

Returns:

resolves with a layer attribute data object

Type
Promise

getAttribs(childIndex) → {Promise}

Source:

Returns attribute data for a child layer.

Parameters:
Name Type Description
childIndex String

the index of the child layer

Returns:

resolves with a layer attribute data object

Type
Promise

getChildName(childIndex) → {String}

Source:

Retrieves a child layer name from the server.

Parameters:
Name Type Description
childIndex String

index of the child layer to get attributes for

Returns:

server name of the child layer

Type
String

getChildTree() → {Object}

Source:

Get a structured representation of the heirarchy of child layers in this Record. We omit parts of the tree that were not specified to load / be used in the config.

Returns:

structured representation of child layers

Type
Object

getExtentFromJson(extentJson) → {Object}

Source:

Create an ESRI Extent object from extent setting JSON object.

Parameters:
Name Type Description
extentJson Object

that follows config spec

Returns:

an ESRI Extent object

Type
Object

getFeatureCount(url) → {Promise}

Source:

Get feature count of a feature layer.

Parameters:
Name Type Description
url String

server url of the feature layer. empty string for file based layers

Returns:

resolves with an integer indicating the feature count. -1 if error occured.

Type
Promise

getFeatureCount(featureIdx) → {Promise}

Source:

Get feature count of a child layer.

Parameters:
Name Type Description
featureIdx String

index of the child

Returns:

resolves with an integer indicating the feature count.

Type
Promise

getFeatureCount() → {Promise}

Source:

Returns the feature count

Returns:

resolves feature count

Type
Promise

getFeatureCount() → {Promise}

Source:

Get feature count of this layer.

Returns:

resolves with an integer indicating the feature count.

Type
Promise

getFeatureName(objId, attribs) → {String}

Source:

Extract the feature name from a feature as best we can.

Parameters:
Name Type Description
objId String

the object id of the attribute

attribs Object

the dictionary of attributes for the feature.

Returns:

the name of the feature

Type
String

getFeatureName(objId, attribs) → {String}

Source:

Extract the feature name from a feature as best we can.

Parameters:
Name Type Description
objId String

the object id of the attribute

attribs Object

the dictionary of attributes for the feature.

Returns:

the name of the feature

Type
String

getFeatureName(childIndex, objId, attribs) → {String}

Source:

Extract the feature name from a feature as best we can.

Parameters:
Name Type Description
childIndex String

the index of the child layer

objId String

the object id of the attribute

attribs Object

the dictionary of attributes for the feature.

Returns:

the name of the feature

Type
String

getFormattedAttributes(childIndex) → {Promise}

Source:

Retrieves attributes from a layer for a specified feature index

Parameters:
Name Type Description
childIndex String

index of the child layer to get attributes for

Returns:

promise resolving with formatted attributes to be consumed by the datagrid and esri feature identify

Type
Promise

getGeomType() → {String}

Source:

Indicates the geometry type of the layer.

Returns:

the geometry type of the layer

Type
String

getGeomType() → {String}

Source:

Indicates the geometry type of the layer.

Returns:

the geometry type of the layer

Type
String

getGraphicIcon(attributes, renderer) → {String}

Source:

Given feature attributes, return the image URL for that feature/graphic object.

Parameters:
Name Type Description
attributes Object

object of feature attribute key value pairs

renderer Object

an enhanced renderer (see function enhanceRenderer)

Returns:

svgcode Url to the features symbology image

Type
String

getGraphicsBoundingBox(graphics) → {Object}

Source:

Return the extent of an array of graphics.

Parameters:
Name Type Description
graphics Array.<Graphic>

the graphics whose bounding box we want to calculate

Returns:

the extent of an array of graphics

Type
Object

getGraphicSymbol(attributes, renderer) → {Object}

Source:

Given feature attributes, return the symbol for that feature/graphic object.

Parameters:
Name Type Description
attributes Object

object of feature attribute key value pairs

renderer Object

an enhanced renderer (see function enhanceRenderer)

Returns:

an ESRI Symbol object in server format

Type
Object

getLayerData() → {Promise}

Source:

Returns layer-specific data for this Record

Returns:

resolves with a layer data object

Type
Promise

getLayerData() → {Promise}

Source:

Returns layer-specific data for this FC.

Returns:

resolves with a layer data object

Type
Promise

getLayerData(childIndex) → {Promise}

Source:

Returns layer-specific data for a child layer

Parameters:
Name Type Description
childIndex String

the index of the child layer

Returns:

resolves with a layer data object

Type
Promise

getLayerType(layer) → {String}

Source:

Will return a string indicating the type of layer a layer object is.

Parameters:
Name Type Description
layer Object

an ESRI API layer object

Returns:

layer type

Type
String

getLegendUrls(wmsLayer, layerList) → {Array}

Source:

Finds the appropriate legend URLs for WMS layers.

Parameters:
Name Type Description
wmsLayer WMSLayer

an ESRI WMSLayer object to be queried

layerList Array

a list of objects identifying the WMS layers to be queried

Returns:

a list of strings containing URLs for specified layers (order is preserved)

Type
Array

(private) getMapServerLegend(layerUrl, esriBundle) → {Promise}

Source:

Returns the legend information of an ESRI map service.

Parameters:
Name Type Description
layerUrl String

service url (root service, not indexed endpoint)

esriBundle Object

collection of ESRI API objects

Returns:

resolves in an array of legend data

Type
Promise

getNorthArrowAngle(opts) → {Number}

Source:

Calculate north arrow bearing. Angle returned is to to rotate north arrow image. http://www.movable-type.co.uk/scripts/latlong.html

Parameters:
Name Type Description
opts Object

options to apply to north arrow calculation

Returns:

map rotation angle (in degree)

Type
Number

getOidField() → {String}

Source:

Indicates the oid field of the layer.

Returns:

the oid field of the layer

Type
String

getOidField() → {String}

Source:

Indicates the oid field of the layer.

Returns:

the oid field of the layer

Type
String

getProxy() → {Object}

Source:

Provides the proxy interface object to the layer.

Returns:

the proxy interface for the layer

Type
Object

getProxy() → {Object}

Source:

Provides the proxy interface object to the layer.

Returns:

the proxy interface for the layer

Type
Object

getProxy() → {Object}

Source:

Provides the proxy interface object to the layer.

Returns:

the proxy interface for the layer

Type
Object

getScaleRatio(mapWidth) → {Object}

Source:

Calculate distance between min and max extent to know the pixel ratio between screen size and earth distance. http://www.movable-type.co.uk/scripts/latlong.html

Parameters:
Name Type Description
mapWidth Number

optional the map width to use to calculate ratio

Returns:

contain information about the scale

                          - distance: distance between min and max extentId
                          - ratio: measure for 1 pixel in earth distance
                          - units: array of units [metric, imperial]
Type
Object

getScaleSet() → {Object}

Source:

Returns an object with minScale and maxScale values for the feature class.

Returns:

scale set for the feature class

Type
Object

getScaleSet() → {Object}

Source:

Returns an object with minScale and maxScale values for the feature class.

Returns:

scale set for the feature class

Type
Object

getSymbology(childIndex) → {Object}

Source:

Return symbology for a child layer.

Parameters:
Name Type Description
childIndex String

the index of the child layer

Returns:

the symbology object

Type
Object

getUnboundGraphics(graphicBundles, spatialReference) → {Array}

Source:

Generating a graphic from server geometry.

Parameters:
Name Type Description
graphicBundles Array

set of graphic bundles with properties .graphic, .layerFC

spatialReference Object

the projection the unbound graphics should be in

Returns:

a set of promises that resolve with an unbound graphic, one for each graphic bundle provided

Type
Array

getVisibility() → {Boolean}

Source:

Returns the visibility of the feature class.

Returns:

visibility of the feature class

Type
Boolean

getVisibility() → {Boolean}

Source:

Returns the visibility of the feature class.

Returns:

visibility of the feature class

Type
Boolean

getVisibility() → {Boolean}

Source:

Indicates visibility of the FC.

Returns:

the visibility of the FC

Type
Boolean

getVisibleScales() → {Object}

Source:

Returns the visible scale values of the layer

Returns:

has properties .minScale and .maxScale

Type
Object

(private) getWMSLayerTitle(wmsLayer, wmsLayerId) → {String}

Source:

Searches for a layer title defined by a wms.

Parameters:
Name Type Description
wmsLayer Object

esri layer object for the wms

wmsLayerId String

layers id as defined in the wms (i.e. not wmsLayer.id)

Returns:

layer title as defined on the service, '' if no title defined

Type
String

(private) guessCSVfields(rows, latCandidates, longCandidates) → {Object}

Source:

From provided CSV data, guesses which columns are long and lat with in the canadidates. If guessing is no successful, returns null for one or both fields.

Parameters:
Name Type Description
rows Array

csv data

latCandidates Array

list of all the valid latitude fields

longCandidates Array

list of all the valid longitude fields

Returns:

an object with lat and long string properties indicating corresponding field names

Type
Object

hideLayers(map) → {Array}

Source:

Set svg-based layer visibility to false to avoid CORS error

Parameters:
Name Type Description
map Object

esri map object

Returns:

layer array of layers where visibility is true

Type
Array

identify(opts) → {Object}

Source:

Run a query on a feature layer, return the result as a promise. Options:

  • clickEvent {Object} an event object from the mouse click event, where the user wants to identify.
  • map {Object} map object. A geoApi wrapper, such as esriMap, not an actual esri api map
  • geometry {Object} geometry (in map coordinates) to identify against
  • tolerance {Integer} an optional click tolerance for the identify
Parameters:
Name Type Description
opts Object

additional arguemets, see above.

Returns:

an object with identify results array and identify promise resolving when identify is complete; if an empty object is returned, it will be skipped

Type
Object

identify(opts) → {Object}

Source:

Run a query on a dynamic layer, return the result as a promise. Options:

  • map {Object} map object. A geoApi wrapper, such as esriMap, not an actual esri api map
  • geometry {Object} geometry (in map coordinates) to identify against
  • mapExtent {Object} extent object of the current map view
  • height {Integer} height of the map view in pixels
  • width {Integer} width of the map view in pixels
  • tolerance {Integer} an optional click tolerance for the identify. Defaults to 5
  • returnGeometry {Boolean} if result geometery should be returned with results. Defaults to false
Parameters:
Name Type Description
opts Object

additional arguemets, see above.

Returns:

an object with identify results array and identify promise resolving when identify is complete; if an empty object is returned, it will be skipped

Type
Object

initBasemaps(esriBundle, basemapsConfig, map) → {Object}

Source:

Make basemap gallery based on the settings of basemap metadata.

Parameters:
Name Type Description
esriBundle Object

ESRI modules from the initial startup

basemapsConfig Array

array of basemap settings in the form { id: string, layers: [string], title: string, thumbnailUrl: string, wkid: integer }

map esriMap

ESRI map object

Returns:

an object with the following properties:

  • setBasemap {function} set current basemap with a basemap uid
  • basemapGallery {object} basemapGallery object
Type
Object

isOffScale(mapScale) → {Object}

Source:

Indicates if the feature class is not visible at the given scale, and if so, if we need to zoom in to see it or zoom out

Parameters:
Name Type Description
mapScale Integer

the scale to test against

Returns:

has boolean properties offScale and zoomIn

Type
Object

isOffScale(mapScale) → {Object}

Source:

Indicates if the feature class is not visible at the given scale, and if so, if we need to zoom in to see it or zoom out

Parameters:
Name Type Description
mapScale Integer

the scale to test against

Returns:

has boolean properties offScale and zoomIn

Type
Object

isOffScale(childIndex, mapScale) → {Object}

Source:

Indicates if the feature class is not visible at the given scale, and if so, if we need to zoom in to see it or zoom out

Parameters:
Name Type Description
childIndex String

index of the child layer to target

mapScale Integer

the scale to test against

Returns:

has boolean properties offScale and zoomIn

Type
Object

isOffScale(mapScale) → {Object}

Source:

Indicates if the feature class is not visible at the given scale, and if so, if we need to zoom in to see it or zoom out. Placeholder is always in scale

Parameters:
Name Type Description
mapScale Integer

the scale to test against

Returns:

has boolean properties offScale and zoomIn

Type
Object

isQueryable() → {Boolean}

Source:

Indicates the layer is queryable.

Returns:

the queryability of the layer

Type
Boolean

isQueryable(childIndex) → {Boolean}

Source:

Indicates the layer is queryable.

Parameters:
Name Type Description
childIndex String

index of the child layer to target

Returns:

the queryability of the layer

Type
Boolean

(static) isSpatialRefEqual(sr1, sr2) → {Boolean}

Source:

Checks if two spatial reference objects are equivalent. Handles both wkid and wkt definitions.

Parameters:
Name Type Description
sr1 type

Esri Spatial Reference First to compare

sr2 type

Esri Spatial Reference Second to compare

Returns:

true if the two spatial references are equivalent. False otherwise.

Type
Boolean

layerLoaded(state) → {Boolean}

Source:

Takes a specific layer state and determines if the layer can be considered loaded or not.

Parameters:
Name Type Description
state String

a layer state

Returns:

if the layer is loaded or not

Type
Boolean

(private) loadDataBatch(opts, callerDef)

Source:

Recursive function to load a full set of attributes, regardless of the maximum output size of the service. Passes result back on the provided Deferred object.

Parameters:
Name Type Description
opts Object

options object that consists of these properties

    - maxId: integer, largest object id that has already been downloaded.
    - supportsLimit: boolean, indicates if server result will notify us if our request surpassed the record limit.
    - batchSize: integer, maximum number of results the service will return. if -1, means currently unknown. only required if supportsLimit is false.
    - layerUrl: string, URL to feature layer endpoint.
    - oidField: string, name of attribute containing the object id for the layer.
    - attribs: string, a comma separated list of attributes to download. '*' will download all.
    - esriBundle: object, standard set of ESRI API objects.
    - layerPackage: reference to the object that manages the loaded attributes
callerDef Object

deferred object that resolves when current data has been downloaded

loadSymbology() → {Promise}

Source:

Download or refresh the internal symbology for the FC.

Returns:

resolves when symbology has been downloaded

Type
Promise

loadSymbology(mergeAllLayers) → {Promise}

Source:

Download or refresh the internal symbology for the FC. mergeAllLayers indicates we should collate entire parent legend into one block. E.g. for basemap tile. the FC index would be 0, but we want all indexes

Parameters:
Name Type Description
mergeAllLayers Boolean

take entire service legend, no just legend for this FC. Defaults to false.

Returns:

resolves when symbology has been downloaded

Type
Promise

loadSymbology() → {Promise}

Source:

Download or refresh the internal symbology for the FC.

Returns:

resolves when symbology has been downloaded

Type
Promise

localProjectExtent(extent, sr) → {Object}

Source:

Reproject an EsriExtent object on the client. Does not require network traffic, but may not handle conversion between projection types as well. Internally it tests 8 points along each edge and takes the max extent of the result.

Parameters:
Name Type Description
extent EsriExtent

to reproject

sr Object

is the target spatial reference (if a number it will be treated as a WKID)

Returns:

an extent as an unstructured object

Type
Object

localProjectGeometry(destProj, geometry) → {Object}

Source:

Project a single point.

Parameters:
Name Type Description
destProj Object | Integer | String

the spatial reference of the result (as ESRI SpatialReference, integer WKID or an EPSG string)

geometry Object

an object conforming to ESRI Geometry object standards containing the coordinates to Reproject

Returns:

an object conforming to ESRI Geomtery object standards containing the input geometry in the destination projection

Type
Object

localProjectPoint(srcProj, destProj, point) → {Array|Object}

Source:

Project a single point.

Parameters:
Name Type Description
srcProj Object | Integer | String

the spatial reference of the point (as ESRI SpatialReference, integer WKID or an EPSG string)

destProj Object | Integer | String

the spatial reference of the result (as ESRI SpatialReference, integer WKID or an EPSG string)

point Array | Object

a 2d array or object with {x,y} props containing the coordinates to Reproject

Returns:

a 2d array or object containing the projected point

Type
Array | Object

makeBoundingBox(id, extent, targetSr) → {GraphicsLayer}

Source:

Makes a bounding box layer (a graphics layer with one rectangle graphic matching the supplied extent).

Parameters:
Name Type Description
id String

the id of the bounding box to be created

extent EsriExtent

an ESRI extent object to be used for the graphics boundaries

targetSr SpatialReference

an ESRI spatial reference which is used for projecting the result

Returns:

an ESRI GraphicsLayer

Type
GraphicsLayer

makeClickBuffer(point, map, tolerance) → {Object}

Source:

Create an extent centered around a point, that is appropriate for the current map scale.

Parameters:
Name Type Description
point Object

point on the map for extent center

map Object

map object the extent is relevant for

tolerance Integer

optional. distance in pixels from mouse point that qualifies as a hit. default is 5

Returns:

an extent of desired size and location

Type
Object

makeGeoJsonLayer(geoJson, opts) → {Promise}

Source:

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:

  • targetWkid: Required. an integer for an ESRI wkid to project geometries to
  • 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)
  • epsgLookup: a function that takes an EPSG code (string or number) and returns a promise of a proj4 style definition or null if not found
  • layerId: a string to use as the layerId
  • colour: a hex string to define the symbol colour. e.g. '#33DD6A'
Parameters:
Name Type Description
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:

a promise resolving with a {FeatureLayer}

Type
Promise

makeHilightLayer(options) → {Object}

Source:

Generate a graphic layer to handle feature hilighting.

Parameters:
Name Type Description
options Object

optional settings for the hilight layer layerId - id to use for the hilight layer. defaults to rv_hilight markerSymbol - esri symbol in server json format to symbolize the click marker. defaults to a red pin

Returns:

an ESRI GraphicsLayer

Type
Object

makeLayerConfig() → {Object}

Source:

Creates an options object for the map API object

Returns:

an object with api options

Type
Object

makeLayerConfig() → {Object}

Source:

Creates an options object for the map API object

Returns:

an object with api options

Type
Object

makeLayerConfig() → {Object}

Source:

Creates an options object for the map API object

Returns:

an object with api options

Type
Object

makeLayerConfig() → {Object}

Source:

Creates an options object for the map API object

Returns:

an object with api options

Type
Object

(private) makeLayerInfo(type, name, url, json) → {Object}

Source:

Returns a standard information object with info common for most ESRI endpoints .serviceName .serviceType .tileSupport .rootUrl

Parameters:
Name Type Description
type String

serviceType enum value for layer

name String

property in json parameter containing a service name

url String

url we are investigating

json Object

data result from service we interrogated

Returns:
Type
Object

makeLegend(layerList, sectionsAvailable, mapHeight)

Source:

Generate the structure for a legend given a set of layers.

Parameters:
Name Type Description
layerList Array

a list of layers to be updated (modified in place)

sectionsAvailable int

the maximum number of sections to use

mapHeight int

the rendered height of the map image

Returns:

an object with properties layers, sectionsUsed. (layerList is modified in place)

makeSafeExtent(extent) → {Object}

Source:

Takes an extent. If extent has problematic boundaries, adjust the extent inwards.

Parameters:
Name Type Description
extent Object

an extent. Param may be modified in place

Returns:

an extent that has been adjusted if it's too big

Type
Object

makeSymbologyArray(legendData) → {Array}

Source:

Takes an array of (possibly pending) legend data and constructs an array of default symbology objects. As each legend item loads, the symbology objects are updated.

Parameters:
Name Type Description
legendData Array

list of promises that resolve with legend data (svg and labels)

Returns:

a list of symbology objects.

Type
Array

mapDefault(key, valueopt)

Source:

Sets or gets map default config values.

Parameters:
Name Type Attributes Description
key String

name of the default property

value Any <optional>

optional value to set for the specified default property

(private) mapServerLegendToRenderer(serverLegend, layerIndex) → {Object}

Source:

Our symbology engine works off of renderers. When dealing with layers with no renderers, we need to take server-side legend and convert it to a fake renderer, which lets us leverage all the existing symbology code.

Parameters:
Name Type Description
serverLegend Object

legend json from an esri map server

layerIndex Integer

the index of the layer in the legend we are interested in

Returns:

a fake unique value renderer based off the legend

Type
Object

(private) mapServerLegendToRendererAll(serverLegend) → {Object}

Source:

Our symbology engine works off of renderers. When dealing with layers with no renderers, we need to take server-side legend and convert it to a fake renderer, which lets us leverage all the existing symbology code.

Same as mapServerLegendToRenderer function but combines all layer renderers.

Parameters:
Name Type Description
serverLegend Object

legend json from an esri map server

Returns:

a fake unique value renderer based off the legend

Type
Object

mapServerToLocalLegend(mapServerUrl, layerIndexopt) → {Promise}

Source:

Orchestrator function that will:

  • Fetch a legend from an esri map server
  • Extract legend for a specific sub layer
  • Convert server legend to a temporary renderer
  • Convert temporary renderer to a viewer-formatted legend (return value)
Parameters:
Name Type Attributes Description
mapServerUrl String

service url (root service, not indexed endpoint)

layerIndex Integer <optional>

the index of the layer in the legend we are interested in. If not provided, all layers will be collapsed into a single legend

Returns:

resolves in a viewer-compatible legend for the given server and layer index

Type
Promise

moveToOffsetExtent(targetExtent, offsetFraction) → {Promise}

Source:

Will position the map so that the target extent is in view. Offsetting is available to allow the view to take into account UI elements that cover the map (e.g. legend and grid are open, so want extent visible in remaining map area)

Parameters:
Name Type Description
targetExtent Object

an ESRI extent to position the map to

offsetFraction Object

an object with decimal properties x and y indicating percentage of offsetting on each axis

Returns:

resolves after the map is done moving

Type
Promise

(private) newLayerPackage(featureIdx, esriBundle) → {Object}

Source:

Will generate an empty object structure to store attributes for a single layer of features

Parameters:
Name Type Description
featureIdx String

server index of the layer

esriBundle Object

bundle of API classes

Returns:

empty layer package object

Type
Object

(private) newProp(target, propName, getter)

Source:

Worker function to add or override a get property on an object

Parameters:
Name Type Description
target Object

the object that will receive the new property

propName String

name of the get property

getter function

the function defining the guts of the get property.

(private) normalizeProj(proj) → {String}

Source:

Convert a projection to an string that is compatible with proj4. If it is an ESRI SpatialReference or an integer it will be converted.

Parameters:
Name Type Description
proj Object | Integer | String

an ESRI SpatialReference, integer or string. Strings will be unchanged and unchecked, ints and SpatialReference objects will be converted.

Returns:

A string in the form EPSG:####

Type
String

onError(e)

Source:

Triggers when the layer has an error.

Parameters:
Name Type Description
e Object

error event object

onLoad()

Source:

Triggers when the layer loads.

onLoad()

Source:

Triggers when the layer loads.

onLoad()

Source:

Triggers when the layer loads.

onLoad()

Source:

Triggers when the layer loads.

onLoad()

Source:

Triggers when the layer loads.

onLoad() → {Array}

Source:

Triggers when the layer loads.

Returns:

list of promises that need to resolve for layer to be considered loaded.

Type
Array

onMouseOut(standard)

Source:

Triggers when the mouse leaves a feature of the layer.

Parameters:
Name Type Description
standard Object

mouse event object

onMouseOut(standard)

Source:

Triggers when the mouse leaves a feature of the layer.

Parameters:
Name Type Description
standard Object

mouse event object

onMouseOver(standard)

Source:

Triggers when the mouse enters a feature of the layer.

Parameters:
Name Type Description
standard Object

mouse event object

onMouseOver(standard)

Source:

Triggers when the mouse enters a feature of the layer.

Parameters:
Name Type Description
standard Object

mouse event object

onUpdateEnd()

Source:

Triggers when the layer finishes updating.

onUpdateStart()

Source:

Triggers when the layer starts to update.

(private) packLayersIntoExactSections(layers, sections) → {Object}

Source:

Groups multiple layers into each section while attempting to minimize the legend height. Allocates to the exact number specified in the sections argument. NOTE: don't call this with too many layers as it tests all possible groupings and can be computationally expensive (< 15 layers should be fine)

Parameters:
Name Type Description
layers Array

a list of layers to be fitted

sections int

the number of sections to use

Returns:

an object in the form { layers, sectionsUsed, bestPerm, bestHeight }

Type
Object

(private) packLayersIntoOptimalSections(layers, sections) → {Object}

Source:

Groups multiple layers into each section while attempting to minimize the legend height. Repeats as necessary to use the least number of sections while still keeping the resulting legend height within 20% of optimal. NOTE: don't call this with too many layers as it tests all possible groupings and can be computationally expensive (< 15 layers should be fine)

Parameters:
Name Type Description
layers Array

a list of layers to be updated (modified in place)

sections int

the number of sections to use

Returns:

an object in the form { layers, sectionsUsed }

Type
Object

parseUrlIndex(url) → {Object}

Source:

Splits an indexed map server url into an object with .rootUrl and .index properties.

Parameters:
Name Type Description
url String

an indexed map server url

Returns:

the url split into the server root and the index.

Type
Object

predictFileUrlBuilder(url) → {Promise}

Source:
Parameters:
Name Type Description
url String

a url to something that is hopefully a map service

Returns:

a promise resolving with an infomation object

Type
Promise

predictLayerUrl(url, hint) → {Promise}

Source:

Attempts to determine what kind of layer the URL most likely is, and if possible, return back some useful information about the layer

  • serviceType: the type of layer the function thinks the url is referring to. is a value of serviceType enumeration (string)
  • fileData: file contents in an array buffer. only present if the URL points to a file that exists on an internet server (i.e. not a local disk drive)
  • name: best attempt at guessing the name of the service (string). only present for ESRI service URLs
  • fields: array of field definitions for the layer. conforms to ESRI's REST field standard. only present for feature layer and image service URLs.
  • geometryType: describes the geometry of the layer (string). conforms to ESRI's REST geometry type enum values. only present for feature layer URLs.
  • groupIdx: property only available if a group layer is queried. it is the layer index of the group layer in the list under its parent dynamic layer
Parameters:
Name Type Description
url String

a url to something that is hopefully a map service

hint String

optional. allows the caller to specify the url type, forcing the function to run the data logic for that type

Returns:

a promise resolving with an infomation object

Type
Promise

projectGeojson(geojson, outputSpatialReference, inputSpatialReference)

Source:

Reproject a GeoJSON object in place. This is a wrapper around terraformer-proj4js.

Parameters:
Name Type Description
geojson Object

the GeoJSON to be reprojected, this will be modified in place

outputSpatialReference String | Number

the target spatial reference, 'EPSG:4326' is used by default; if a number is suppied it will be used as an EPSG code

inputSpatialReference String | Number

same rules as outputSpatialReference if suppied if missing it will attempt to find it encoded in the GeoJSON

removeAttribListener(listenerCallback)

Source:

Remove an attribute added listener.

Parameters:
Name Type Description
listenerCallback function

function to not call when attributes download event happens

removeGeometry(index)

Source:

Remove the specified graphic.

Parameters:
Name Type Description
index Number

index of the graphic to remove from the layer

removeHoverListener(listenerCallback)

Source:

Remove a mouse hover listener.

Parameters:
Name Type Description
listenerCallback function

function to not call when a hover event happens

removeHoverListener(listenerCallback)

Source:

Remove a mouse hover listener.

Parameters:
Name Type Description
listenerCallback function

function to not call when a hover event happens

removeStateListener(listenerCallback)

Source:

Remove a state change listener.

Parameters:
Name Type Description
listenerCallback function

function to not call when a state change event happens

renderSymbologyIcon(imageUri, draw)

Source:

Renders a supplied image as an icon-style symbology item (fitting an image inside an icon container, usually 32x32 pixels).

Parameters:
Name Type Description
imageUri String

a image dataUrl or a regular url

draw Object

[optional=null] an svg container to draw the image on; if not supplied, a new one is created

renderSymbologyImage(imageUri, draw)

Source:

Renders a supplied image as an image-style symbology item (preserving the true image dimensions).

Parameters:
Name Type Description
imageUri String

a image dataUrl or a regular url

draw Object

[optional=null] an svg container to draw the image on; if not supplied, a new one is created

repokeEsriService(url, esriBundle, childInfo) → {Promise}

Source:

handles the situation where our first poke revealed a child layer (i.e. an indexed endpoint in an arcgis server). We need to extract some extra information about the service it resides in (the root service) and add it to our info package.

Parameters:
Name Type Description
url String

the url of the original endpoint (including the index)

esriBundle Object

has ESRI API objects

childInfo Object

the information we have gathered on the child layer from the first poke

Returns:

resolves with information object containing child and root information

Type
Promise

(private) resizeSVGElement(element, targetSize, targetViewbox) → {Object}

Source:

Scales up or down the specified svg element. To scale it, we need to set the viewbox to the current size and change the size of the element itself.

Parameters:
Name Type Description
element Object

target svg element to be resized

targetSize Object

object with target sizes in the form of { width, height } width {Number} height {Number}

targetViewbox Object

[optional = null] target viewbox sizes in the form of { minX, minY, width, height }; if not specified, the original size will be used as the viewbox minX {Number} minxY {Number} width {Number} height {Number}

Returns:

returns original size and viewbox of the svg element in the form of { originalSize: { width, height }, originalViewbox: { minX, minY, width, height } }; can be used to restore the element to its original state originalSize: width {Number} height {Number} originalViewbox: minX {Number} minxY {Number} width {Number} height {Number}

Type
Object

(private) scrapeListRenderer(renderer, childList, window) → {Array}

Source:

Generate an array of legend items for an ESRI unique value or class breaks renderer.

Parameters:
Name Type Description
renderer Object

an ESRI unique value or class breaks renderer

childList Array

array of children items of the renderer

window Object

reference to the browser window

Returns:

a legend object populated with the symbol and label

Type
Array

searchRenderer(attributes, renderer) → {Object}

Source:

Given feature attributes, find the renderer node that would draw it

Parameters:
Name Type Description
attributes Object

object of feature attribute key value pairs

renderer Object

an enhanced renderer (see function enhanceRenderer)

Returns:

an Object with svgcode and symbol properties for the matched renderer item

Type
Object

serverLayerIdentify(layer, opts) → {Promise}

Source:

Perform a server-side identify on a layer (usually an ESRI dynamic layer) Accepts the following options:

  • geometry: Required. geometry in map co-ordinates for the area to identify. will usually be an ESRI Point, though a polygon would work.
  • mapExtent: Required. ESRI Extent of the current map view
  • width: Required. Width of the map in pixels
  • height: Required. Height of the map in pixels
  • layerIds: an array of integers specifying the layer indexes to be examined. Will override the current visible indexes in the layer parameter
  • returnGeometry: a boolean indicating if result geometery should be returned with results. Defaults to false
  • tolerance: an integer indicating how many screen pixels away from the mouse is valid for a hit. Defaults to 5
Parameters:
Name Type Description
layer Object

an ESRI dynamic layer object

opts Object

An object for supplying additional parameters

Returns:

a promise resolving with an array of identify results (empty array if no hits)

Type
Promise

setDefinitionQuery(query)

Source:

Applies a definition query to the feature class by manipulating the parent record.

Parameters:
Name Type Description
query String

a valid definition query

setDefinitionQuery(query)

Source:

Applies a definition query to the layer.

Parameters:
Name Type Description
query String

a valid definition query

setMapScale(map, lod, zoomIn, positionOverLayer) → {Promise}

Source:

Set map scale depending on zooming in or zooming out of layer visibility scale

Parameters:
Name Type Description
map Object

layer to zoom to scale to for feature layers; parent layer for dynamic layers

lod Object

scale object the map will be set to

zoomIn Boolean

the zoom to scale direction; true need to zoom in; false need to zoom out

positionOverLayer Boolean

ensures the map is over the layer's extent after zooming. only applied if zoomIn is true. defaults to true

Returns:

resolves after map is done changing its extent

Type
Promise

setQueryable(value)

Source:

Applies queryability to the layer.

Parameters:
Name Type Description
value Boolean

the new queryability setting

setVisibility(value)

Source:

Applies visibility to feature class by manipulating the parent record.

Parameters:
Name Type Description
value Boolean

the new visibility setting

setVisibility(value)

Source:

Applies visibility to feature class.

Parameters:
Name Type Description
value Boolean

the new visibility setting

shiftZoom(byValue)

Source:

Changes the zoom level by the specified value relative to the current level; can be negative. To avoid multiple chained zoom animations when rapidly pressing the zoom in/out icons, we update the zoom level only when the one before it resolves with the net zoom change.

Parameters:
Name Type Description
byValue number

a number of zoom levels to shift by

showLayers(layers)

Source:

Set user added layer visibility to true for those whoe where visible

Parameters:
Name Type Description
layers Array

array of graphic layers to set visibility to true

(private) splitLayer(layer, chunkSize, splitCount)

Source:

Split a layer into splitCount parts of roughly equal size.

Parameters:
Name Type Description
layer Object

a layer object to be split into splitCount parts

chunkSize int

the maximum height in pixels of the legend sections

splitCount int

the number of pieces which the layer should be broken into

Returns:

an object with properties whiteSpace: , splits: [ ]

(private) stringToArrayBuffer(str) → {Arraybuffer}

Source:

Converts a string to an array buffer

Parameters:
Name Type Description
str String

a string containing stuff

Returns:

string in array buffer form

Type
Arraybuffer

(private) svgDrawImage(draw, imageUri, width, height, crossOrigin) → {Promise}

Source:

Renders a specified image on an svg element. This is a helper function that wraps around async draw.image call in the svg library.

Parameters:
Name Type Description
draw Object

svg element to render the image onto

imageUri String

image url or dataURL of the image to render

width Number

[optional = 0] width of the image

height Number

[optional = 0] height of the image

crossOrigin Boolean

[optional = true] specifies if the image should be loaded as crossOrigin

Returns:

promise resolving with the loaded image and its loader object (see svg.js http://documentup.com/wout/svg.js#image for details)

Type
Promise

(private) symbolToLegend(symbol, label, definitionClause, window) → {Object}

Source:

Generate a legend item for an ESRI symbol.

Parameters:
Name Type Description
symbol Object

an ESRI symbol object in server format

label String

label of the legend item

definitionClause String

sql clause to filter on this legend item

window Object

reference to the browser window

Returns:

a legend object populated with the symbol and label

Type
Object

synchOpacity(opacity)

Source:

Will set the layer opacity, and update all child FCs to the same opacity. Used for Dynamic layers that do not support child opacity.

Parameters:
Name Type Description
opacity Numeric

an opacity value (decimal between 0 and 1)

updateWfsSource(esriLayer)

Source:

Hot swaps the core underlying layer of this record. THIS IS VERY VERY BAD. Doing this as a workaround to our fundamental WFS loading problem.

Parameters:
Name Type Description
esriLayer Object

an esri layer. specifically a FeatureLayer that's been pre-created from GeoJSON source

(private) validateCSV(data) → {Promise}

Source:

Performs validation on csv data. Returns a promise resolving with the validation object. Worker function for validateFile, see that file for return value specs

Parameters:
Name Type Description
data Object

csv data as string

Returns:

promise resolving with information on the csv data

Type
Promise

validateFile(type, data) → {Promise}

Source:

Validates file content. Does some basic checking for errors. Attempts to get field list, and if possible, provide the file in a more useful format. Promise rejection indicates failed validation

  • formattedData: file contents in a more useful format. JSON for GeoJSON and Shapefile. String for CSV
  • fields: array of field definitions for the file. conforms to ESRI's REST field standard.
  • geometryType: describes the geometry of the file (string). conforms to ESRI's REST geometry type enum values.
Parameters:
Name Type Description
type String

the format of file. aligns to serviceType enum (CSV, Shapefile, GeoJSON)

data Arraybuffer

the file content in binary

Returns:

a promise resolving with an infomation object

Type
Promise

(private) validateGeoJson(geoJson) → {Promise}

Source:

Performs validation on GeoJson object. Returns a promise resolving with the validation object. Worker function for validateFile, see that file for return value specs

Parameters:
Name Type Description
geoJson Object

feature collection in geojson form

Returns:

promise resolving with information on the geoJson object

Type
Promise

validateLatLong(arr, ind1, ind2) → {Boolean}

Source:

Given 2D array in column x row format, check if all entries in the two given columns are numeric.

Parameters:
Name Type Description
arr Array

is a 2D array based on the CSV file that contains row information for all of the rows

ind1 Integer

is a user specified index when uploading the CSV that specifies lat or long column (whichever isn't specified by ind2)

ind2 Integer

is a user specified index when uploading the CSV that specifies lat or long column (whichever isn't specified by ind1)

Returns:

returns true or false based on whether or not all all columns at ind1 and ind2 are numbers

Type
Boolean

wrapEvents(esriObject, handlers) → {object}

Source:

Wire up any supplied handlers to the corresponding dojo .on events on layer. Purpose is to keep Dojo .on events contained in geoApi.

Parameters:
Name Type Description
esriObject esriObject

which contains the dojo events to be wrapped

handlers handlers

is an object which contains all handlers needed

Returns:

evt contains the events created on the object, keyed by same properties as handlers input

Type
object

zoomToBoundary(map) → {Promise}

Source:

Zoom to layer boundary of the layer specified by layerId

Parameters:
Name Type Description
map Object

esriMap object we want to execute the zoom on

Returns:

resolves when map is done zooming

Type
Promise

(private) zoomToExtent(extent) → {Promise}

Source:

Zoom the map to an extent. Extent can be in different projection

Parameters:
Name Type Description
extent Object

map object we want to execute the zoom on

Returns:

resolves when map is done zooming

Type
Promise

zoomToGraphic(apiId, map, offsetFraction) → {Promise}

Source:

Will attempt to zoom the map view so the a graphic is prominent.

Parameters:
Name Type Description
apiId String

API ID of grahpic being searched for. This is a string name from api, not an esri OID.

map Object

wrapper object for the map we want to zoom

offsetFraction Object

an object with decimal properties x and y indicating percentage of offsetting on each axis

Returns:

resolves after the map is done moving

Type
Promise

zoomToGraphic(objId, map, offsetFraction) → {Promise}

Source:

Will attempt to zoom the map view so the a graphic is prominent.

Parameters:
Name Type Description
objId Integer

Object ID of grahpic being searched for

map Object

wrapper object for the map we want to zoom

offsetFraction Object

an object with decimal properties x and y indicating percentage of offsetting on each axis

Returns:

resolves after the map is done moving

Type
Promise

zoomToGraphic(objId, map, offsetFraction) → {Promise}

Source:

Will attempt to zoom the map view so the a graphic is prominent.

Parameters:
Name Type Description
objId Integer

Object ID of grahpic being searched for

map Object

wrapper object for the map we want to zoom

offsetFraction Object

an object with decimal properties x and y indicating percentage of offsetting on each axis

Returns:

resolves after the map is done moving

Type
Promise

zoomToGraphic(childIndex, objId, map, offsetFraction) → {Promise}

Source:

Will attempt to zoom the map view so the a graphic is prominent.

Parameters:
Name Type Description
childIndex String

index of the child layer to target

objId Integer

Object ID of grahpic being searched for

map Object

wrapper object for the map we want to zoom

offsetFraction Object

an object with decimal properties x and y indicating percentage of offsetting on each axis

Returns:

resolves after the map is done moving

Type
Promise

zoomToLatLong(location)

Source:

Takes a location object in lat/long, converts to current map spatialReference using reprojection method in geoApi, and zooms to the point.

Parameters:
Name Type Description
location Object

is a location object, containing geometries in the form of { longitude: , latitude: }

zoomToScale(map, lods, zoomIn, positionOverLayer) → {Promise}

Source:

Zoom to a valid scale level for this layer.

Parameters:
Name Type Description
map Object

the map object

lods Array

level of details array for basemap

zoomIn Boolean

the zoom to scale direction; true need to zoom in; false need to zoom out

positionOverLayer Boolean

ensures the map is over the layer's extent after zooming. only applied if zoomIn is true. defaults to true

Returns:

promise that resolves after map finishes moving about

Type
Promise

zoomToScale(map, lods, zoomIn, positionOverLayer) → {Promise}

Source:

Zoom to a valid scale level for this layer.

Parameters:
Name Type Description
map Object

the map object

lods Array

level of details array for basemap

zoomIn Boolean

the zoom to scale direction; true need to zoom in; false need to zoom out

positionOverLayer Boolean

ensures the map is over the layer's extent after zooming. only applied if zoomIn is true. defaults to true

Returns:

promise that resolves after map finishes moving about

Type
Promise

zoomToScale(childIndex, map, lods, zoomIn, positionOverLayer) → {Promise}

Source:

Zoom to a valid scale level for a child layer.

Parameters:
Name Type Description
childIndex String

index of the child layer to target

map Object

the map object

lods Array

level of details array for basemap

zoomIn Boolean

the zoom to scale direction; true need to zoom in; false need to zoom out

positionOverLayer Boolean

ensures the map is over the layer's extent after zooming. only applied if zoomIn is true. defaults to true

Returns:

promise that resolves after map finishes moving about

Type
Promise