Members
(private, constant) featureTypeToRenderer
Properties:
Name | Type | Description |
---|---|---|
featureTypeToRenderer |
Object |
Maps GeoJSON geometry types to a set of default renders defined in GlobalStorage.DefaultRenders
mapManager
- Source:
The MapManager
module exports an object with the following properties:
Extent
{type} of esri/geometryMap
{type} of esri/mapOverviewMap
{type} of esri/dijit/OverviewMapScalebar
{type} of esri/dijit/Scalebar- `getExtentFromSetting {function} create an ESRI Extent object from extent setting JSON object.
setupMap
{function} interates over config settings and apply logic for any items present.setProxy
{function} Set proxy service URL to avoid same origin issues
(constant) serviceType
Properties:
Name | Type | Description |
---|---|---|
serviceType |
Object |
Different types of services that a URL could point to
Methods
addHilight(graphic)
- 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 |
addPin(point)
- 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 |
(private) arrayBufferToString(buffer) → {String}
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()
Performs in place assignment of integer ids for a GeoJSON FeatureCollection. Assumes all features have ids or all do not. May fail (create duplicate keys) if some do and some don't
checkProj(spatialReference, epsgLookup) → {Object}
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 |
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, message: (string) provides a reason why the projection was not found, lookupPromise: (Promise) an optional promise resolving with true or false if a lookup function was provided and had to be invoked }
- Type
- Object
clearHilight()
- Source:
Remove hilight from map
cloneLayerGraphic(graphic) → {Object}
- Source:
Clone a graphic from a map-bound layer.
Parameters:
Name | Type | Description |
---|---|---|
graphic |
Graphic | an ESRI graphic that resides in a map layer. |
Returns:
an unbound copy of the graphic
- Type
- Object
convertImageToCanvas(url, crossOrigin) → {Promise}
Convert an image to a canvas element
Parameters:
Name | Type | Default | Description |
---|---|---|---|
url |
String | image url to convert (result from the esri print task) |
|
crossOrigin |
Boolean |
true
|
[optional] default to 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) → {Promise}
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 |
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
csvPeek(csvData, delimiter) → {Array}
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
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()
Extracts fields from the first feature in the feature collection, does no guesswork on property types and calls everything a string.
(private) generatePlaceholderSymbology(name, colour) → {Promise}
- 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:
promise resolving with symbology svg code and its label
- Type
- Promise
generateUUID() → {String}
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
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
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
getLayerType(layer) → {String}
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 strings identifying the WMS layers to be queried |
Returns:
a list of strings containing URLs for specified layers (order is preserved)
- Type
- Array
getUnboundGraphics(graphicBundles, spatialReference) → {Array}
- Source:
Generating a graphic from server geometry.
Parameters:
Name | Type | Description |
---|---|---|
graphicBundles |
Array | set of graphic bundles with properties .graphic, .source, .layer, .featureIdx. |
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
getZoomLevel(lods, maxScale) → {Number}
- Source:
Takes the lod list and finds level as close to and above scale limit
Parameters:
Name | Type | Description |
---|---|---|
lods |
Array | array of esri LODs https://developers.arcgis.com/javascript/jsapi/lod-amd.html |
maxScale |
Integer | object largest zoom level for said layer |
Returns:
current LOD
- Type
- Number
(private) guessCSVfields(rows) → {Object}
From provided CSV data, guesses which columns are long and lat. If guessing is no successful, returns null for one or both fields.
Parameters:
Name | Type | Description |
---|---|---|
rows |
Array | csv data |
Returns:
an object with lat and long string properties indicating corresponding field names
- Type
- Object
(static) isSpatialRefEqual(sr1, sr2) → {Boolean}
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
(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
|
callerDef |
Object | deferred object that resolves when current data has been downloaded |
loadFeatureAttribs(layerUrl, featureIdx, attribs, esriBundle) → {Object}
- Source:
fetch attributes from an ESRI ArcGIS Server Feature Layer Service endpoint
Parameters:
Name | Type | Description |
---|---|---|
layerUrl |
String | an arcgis feature layer service endpoint |
featureIdx |
Integer | index of where the endpoint is. used for legend output |
attribs |
String | a comma separated list of attributes to download. '*' will download all |
esriBundle |
Object | bundle of API classes |
Returns:
attributes in a packaged format for asynch access
- Type
- Object
localProjectExtent(extent, sr) → {Object}
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}
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}
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
makeGeoJsonLayer(geoJson, opts) → {Promise}
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)
- fields: an array of fields to be appended to the FeatureLayer layerDefinition (OBJECTID is set by default)
- 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 pinSymbol - esri symbol in server json format to symbolize the click marker. defaults to a red pin hazeOpacity - how opaque the haze sheet behind the hilight is. 0 to 255, 0 being transparent. defaults to 127 |
Returns:
an ESRI GraphicsLayer
- Type
- Object
(private) newLayerBundle() → {Object}
- Source:
Will generate an empty object structure to store a bundle of attributes for a full layer
Returns:
empty layer bundle object
- Type
- Object
(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 |
Integer | server index of the layer |
esriBundle |
Object | bundle of API classes |
Returns:
empty layer package object
- Type
- Object
(private) normalizeProj(proj) → {String}
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
predictLayerUrl(url, hint) → {Promise}
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
(private) processDynamicLayer(layer, options, esriBundle) → {Object}
- Source:
Ochestrate the attribute extraction of a dynamic map service layer object.
Parameters:
Name | Type | Description |
---|---|---|
layer |
Object | an ESRI API Dynamic Map Service layer object |
options |
Object | information on layer and attribute skipping |
esriBundle |
Object | bundle of API classes |
Returns:
attributes in layer bundle format (see newLayerBundle)
- Type
- Object
(private) processFeatureLayer(layer, options, esriBundle) → {Object}
- Source:
Ochestrate the attribute extraction of a feature layer object.
Parameters:
Name | Type | Description |
---|---|---|
layer |
Object | an ESRI API Feature layer object |
options |
Object | information on layer and attribute skipping |
esriBundle |
Object | bundle of API classes |
Returns:
attributes in layer bundle format (see newLayerBundle)
- Type
- Object
projectGeojson(geojson, outputSpatialReference, inputSpatialReference)
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 |
projectionLookup()
Makes an attempt to load and register a projection definition. Returns promise resolving when process is complete projModule - proj module from geoApi projCode - the string or int epsg code we want to lookup epsgLookup - function that will do the epsg lookup, taking code and returning promise of result or null
(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}
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
(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, 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 |
window |
Object | reference to the browser window |
Returns:
a legend object populated with the symbol and label
- Type
- Object
(private) validateCSV(data) → {Promise}
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}
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}
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}
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)
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 |