Reusable Accessible Mapping Platform

API Docs for: 5.0.0
Show:

Map Class

Map class represents the ESRI map object. The map is generated based on the application configuration and templates.

Methods

_hideLoadingImg

() private

Hides the loading image.

_initEventHandlers

(
  • map
)
private

Creates event handlers for the map control: click, mouse-over, load, extent change, and update events.

Parameters:

  • map Object

    A ESRI map object

_initListeners

(
  • map
)
private

Subscribe to external events (published using topic.publish) and react accordingly

Parameters:

_initRepublishers

(
  • map
)
private

Republishes map events to the outside using topic.publish

Parameters:

_initScale

(
  • event
)
private

Initialize Map Scale

Parameters:

_showLoadingImg

() private

Shows the loading image.

_updateScale

(
  • event
)
private

Update Map Scale when zoom level changes

Parameters:

_wrapFileCallInPromise

(
  • readMethod
)
Function private

Helper function for wrapping File API calls in Promise objects. Used for building a series of helpers which call different file read methods.

Parameters:

  • readMethod String

    a string indicating the FileReader method to call

Returns:

Function:

a function which accepts a {File} object and returns a Promise

AddStaticLayer

(
  • layer_type
  • layer_url
  • layer_op
)
private

Add a static, non-interactive Layer to the map

Parameters:

  • layer_type String

    A value which controls how the layer is going to be added to the map

  • layer_url String

    A URL pointing to a valid map service endpoint

  • layer_op Number

    A value between 0.0 and 1.0 which determines the transparency of the layer

applyExtentDefaulting

() private

Apply extent defaulting prior to URL overrides.

checkBoundary

(
  • e
  • maxExtent
)
Esri/geometry/Extent

Given an ESRI Extent Object, returns a new ESRI Extent Object that contains the extent adjusted according to this map's maximum extent

NOTE: this method is currently unused!

Parameters:

  • e Esri/geometry/Extent

    the extent Object

  • maxExtent Esri/geometry/Extent

    the maximum extent

Returns:

Esri/geometry/Extent:

An adjusted extent, if the target extent is outside the boundary

enhanceLayer

(
  • layer
  • config
  • userLayer
)

Adds custom ramp properties to layer. Adds handlers to loading events.

Parameters:

  • layer Object

    layer to be prepped

  • config Object

    config object for the layer

  • userLayer Boolean

    optional. indicates if layer was added by a user. default value is false

finishExtentProjection

(
  • projectedMaxExtent
)
private

process the projected maximum extent, then alert app to continue loading the map. used as an asynchronous gate for the projection.

Parameters:

  • projectedMaxExtent Array

    an array containing the maximum extent object in the map's projection

getBoundingBoxMapping

() Object

Returns the mapping of feature layer ids to assocciated bounding box layers.

Returns:

Object:

A dictionary of String, Esri/layers/GraphicsLayer pairs.

getFeatureLayer

(
  • featureId
)
Esri/layers/FeatureLayer private

Return the feature layer corresponding to the given id.

Parameters:

  • featureId String

    the id of the feature layer

Returns:

Esri/layers/FeatureLayer:

feature layer

getLayerConfigWithId

(
  • id
)

Returns the feature layer config for the given id

Parameters:

getServiceURL

(
  • rampService
  • mapID
  • language
)

This method builds a complete service URL callout for a map configuration. The URL is built using a base URL and map ID, and a language culture code.

Parameters:

  • rampService String

    The base URL for a web service that provide's valid map JSON configuration data

  • mapID Number

    a unique identifier for a group of map configuration

  • language String

    culture code either 'en' or 'fr'

getSymbolForFeature

(
  • feature
)
Icon

Given a feature object or a graphic object (or any object that has a getLayer method and an attributes field) return the object containing the image URL and legend text for that feature/graphic object.

Parameters:

Returns:

Icon:

The default icon used to represent the feature layer

getVisibleFeatureLayers

() Array

Returns a list of feature layers that are currently visible on the map.

Returns:

Array:

an array of Esri/layers/FeatureLayer objects

init

(
  • currentLevel
)

Initialize navigation widget for pan and zooming using global configuration object

Parameters:

initListeners

() private

Listen to map evens and adjust the navigation widget accordingly

initTopics

() private

Listen to internal events and republish for other modules' benefit

loadStrings

()

Updates some of the Strings on the HTML page using the config string resources

localProjectExtent

(
  • extent
  • sr
)
Esri/Extent

Will project an extent to a desired spatial reference, using client side projection library. Avoids the need for Esri Geometry Service

Parameters:

Returns:

Esri/Extent:

extent in the desired projection

localProjectExtent

(
  • extent
  • sr
)
Esri/Extent private

Will project an extent to a desired spatial reference, using client side projection library. Avoids the need for Esri Geometry Service

Parameters:

Returns:

Esri/Extent:

extent in the desired projection

makeFeatureLayer

(
  • layerConfig
  • userLayer
)
Esri/layers/FeatureLayer

Create a new FeatureLayer object based on the config input

Parameters:

  • layerConfig Object

    config object for the layer to create

  • userLayer Boolean

    optional specifies if layer was added by a user

Returns:

Esri/layers/FeatureLayer:

feature layer object (unloaded)

makeStaticLayer

(
  • layerConfig
  • userLayer
)
Object private

Return the static layer corresponding to the given url.

Parameters:

  • layerConfig Object

    config object for the layer to create

  • userLayer Boolean

    optional specifies if layer was added by a user

Returns:

Object:

layer object of the appropriate type

makeWmsLayer

(
  • layerConfig
  • userLayer
)
Esri/layers/WMSLayer

Return the feature layer corresponding to the given url.

Parameters:

  • layerConfig Object

    config object for the layer to create

  • userLayer Boolean

    optional specifies if layer was added by a user

Returns:

Esri/layers/WMSLayer:

WMS layer

onFeatureDeselect

()

This function is called whenever the "Details" button is deselected (either by the user click on another "Details" button, clicking on another point, or by clicking on an already highlighted "Details" button, or clicking somewhere on the map where is no features present).

onFeatureMouseOut

(
  • evt
)

This function is called whenever the user moves the mouse away from a feature being hovered over.

Parameters:

  • evt Object

    [description]

    • graphic Object

      ESRI graphic object that is moved away from

onFeatureMouseOver

(
  • evt
)

This function is called whenever the user hovers over a feature on the map when another feature already has been selected.

Parameters:

  • evt Object

    [description]

    • graphic Object

      ESRI graphic object that is being hovered over

onFeatureSelect

(
  • evt
)

This function is called whenever the feature on the map is clicked/selected by the user. Publish the "Gui/subPanelOpen" message to indicate a feature has been selected. Panel content and Panel event handler information is passed in as the additional object for the event handler.

Parameters:

prepLayer

(
  • layer
  • config
  • userLayer
)
private

Sets up loading event handlers and initializes the .ramp object of a layer Circular reference errors prevent us from calling LayerLoader directly from this module

Parameters:

  • layer Object

    layer to be prepped

  • config Object

    config object for the layer

  • userLayer Boolean

    optional. indicates if layer was added by a user. default value is false

projectConfigExtents

()

initiate the projection of the config extents to basemap extents

projectExtent

(
  • extent
  • sr
  • callWhenDone
)
private

project an extent to a new spatial reference, if required when projection is finished, call another function and pass the result to it.

Parameters:

projectFullExtent

(
  • projectedDefaultExtent
)
private

process the projected default extent, begin projection of full extent. used as an asynchronous gate for the projection.

Parameters:

  • projectedDefaultExtent Array

    an array containing the default extent object in the map's projection

projectMaxExtent

(
  • projectedFullExtent
)
private

process the projected full extent, begin projection of maximum extent. used as an asynchronous gate for the projection.

Parameters:

  • projectedFullExtent Array

    an array containing the full extent object in the map's projection

registerWMSClick

(
  • map
)

This function should be called after the map has been created. It will subscribe to the Map.CLICK event and trigger GUI.SUBPANEL_OPEN events for displaying the response data.

Parameters:

  • map Object

    an EsriMap instance

republish

(
  • name
)
private

Republish map events using topic.publish

Parameters:

setBoundingBoxVisibility

(
  • layerId
)
private

Sets the visibility of the bounding box that belongs to the layer with the given layerId. Note: the layerId needs to be the ID of the featurelayer, not the ID of the actual bounding box layer.

Parameters:

  • layerId String

    the id of the layer whose bounding box visibility should be set

zoomToLayerScale

(
  • layerId
)

For a specified layer, zooms to the closest level that has some visible data.

Parameters:

  • layerId String

    a layer id to zoom to.

Properties

baseLayer

Esri/layers/ArcGISTiledMapServiceLayer private

The basemap layer

boundingBoxMapping

Object private

Maps the id of a graphic layer to the GraphicsLayer Object that represents its extent bounding box. A dictionary of String, Esri/layers/GraphicsLayer pairs.

config

Object

The RAMP application config, it should be treated as read only by all modules other than globalStorage and bootstrapper

configServiceURL

String

Contains a URL that points to the application configuration (JSON format) if it's hosted on a web service. This is not required if the application has a JSON config file in the website's folder

featureLayers

Array private

An Array of Esri/layers/FeatureLayer objects.

featureLayerStartIndex

Integer private

The map not only contains feature layers, but also other layers such as the basemap layer, highlight layer, bounding box layer, etc. This variable is used to store the starting index of the feature layers in the map.

fullExtent

Esri/geometry/Extent private

Used for full extent in nav widget

getMap

Object

Return the map control object

getMaxExtent

Object

The maximum extent of the map control is allowed to go to

InitExtent

Esri/geometry/Extent private

The initial extent of the map

maxExtent

Esri/geometry/Extent private

The maximum extent of the map

plugins

Object

A registry of plugins for RAMP code to reference, these should be loaded and registered by bootstrapper.js

state

Object

A temporary solution to state management. Will be changed

url

String private

The URL of the first layer of the basemap that is on by default.

wmsLayers

Array private

An Array of Esri/layer/WMSLayer objects.

Events

Navigation.FULL_EXTENT

Published whenever the user clicks on the full extent button in the navigation widget.

Navigation.PAN

Published whenever the user clicks on the pan buttons.

Navigation.ZOOM

Published whenever the user tries to zoom using the slider.

Navigation.ZOOM_STEP

Published whenever the user tries to zoom using the arrow buttons.