Reusable Accessible Mapping Platform

API Docs for: 5.0.0
Show:

TmplHelper Class

A set of functions used to support and standardize the use of templating.

Methods

getFeatureName

(
  • graphic
  • layerConfig
)
String

Given a feature object or a graphic object (or any object that has a getLayer method and an attributes field) return the attribute value for its designed "name" field

NOTE: all dependent functions should be written as nested functions inside the caller function, otherwise TmplEx templating library won't identify

Parameters:

  • graphic Graphic
  • layerConfig Object

Returns:

String:

imageUrl Url to the features symbology image

getGraphicIcon

(
  • graphic
  • layerConfig
)
String

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

NOTE: all dependent functions should be written as nested functions inside the caller function, otherwise TmplEx templating library won't identify

Parameters:

  • graphic Graphic
  • layerConfig Object

Returns:

String:

imageUrl Url to the features symbology image

getLayerConfigWithId

(
  • id
)

Returns the feature layer config for the given id

Parameters:

getObjectId

(
  • graphic
)
Integer

Given a feature object return the objectid for that item. This will likely fail on a non-feature object (e.g. a plain graphic)

NOTE: all dependent functions should be written as nested functions inside the caller function, otherwise TmplEx templating library won't identify

Parameters:

  • graphic Graphic

Returns:

Integer:

objectId

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

getSymbolForLayer

(
  • layerConfig
)
Icon

Gets an array of symbology images to display in the layer selector

Parameters:

  • layerConfig Object

    A layer's config object

Returns:

Icon:

The array of icon(s) to use in layer selector

loadStrings

()

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

Properties

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

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