Terria

Terria

new Terria(options)

Source:

The overall model for TerriaJS.

Parameters:
Name Type Description
options Object

Object with the following properties:

Properties
Name Type Attributes Default Description
baseUrl String

The base directory in which TerriaJS can find its static assets.

cesiumBaseUrl String <optional>
'(options.baseUrl)/build/Cesium/build/'

The base directory in which Cesium can find its static assets.

appName String <optional>

The name of the app.

supportEmail String <optional>

The support email for the app.

batchGeocoder AddressGeocoder <optional>

Geocoder to use for geocoding addresses in CSV files.

Members

afterViewerChanged :Event

Source:

Gets or sets the event that is raised just after switching between Cesium and Leaflet.

Type:
  • Event

allowFeatureInfoRequests :Boolean

Source:

Gets or sets whether to make feature info requests when points are clicked.

Type:
  • Boolean

analytics :ConsoleAnalytics|GoogleAnalytics

Source:

Gets or sets the instance to which to report Google Analytics-style log events. If a global ga function is defined, this defaults to GoogleAnalytics. Otherwise, it defaults to ConsoleAnalytics.

Type:
  • ConsoleAnalytics | GoogleAnalytics

appName :String

Source:
Default Value:
  • "TerriaJS App"

The name of the app to be built upon Terria. This will appear in error messages to the user.

Type:
  • String

autoPlay :Boolean

Source:
Default Value:
  • true

Indicates whether time-dynamic layers should start animating immediately upon load. If false, the user will need to press play manually before the layer starts animating.

Type:
  • Boolean

baseMap :ImageryLayerCatalogItem

Source:

Gets or sets the current base map.

Type:

baseMapContrastColor :String

Source:

Gets or sets a color that contrasts well with the base map.

Type:
  • String

baseMapName :String

Source:

Gets or sets the name of the base map to use.

Type:
  • String

baseMaximumScreenSpaceError :Integer

Source:

Base ratio for maximumScreenSpaceError

Type:
  • Integer

batchGeocoder :AddressGeocoder

Source:

The geocoder to use for batch geocoding addresses in CSV files.

Type:

beforeViewerChanged :Event

Source:

Gets or sets the event that is raised just before switching between Cesium and Leaflet.

Type:
  • Event

catalog :Catalog

Source:

Gets or sets the catalog of geospatial data.

Type:

cesium :Cesium

Source:

Gets or sets properties related to the Cesium globe. If the application is in 2D mode, this property will be undefined and Terria#leaflet will be set.

Type:

clock :Clock

Source:

Gets or sets the clock that controls how time-varying data items are displayed.

Type:

configParameters :Object

Source:

Gets or sets the configuration parameters set at startup. Contains:

  • regionMappingDefinitionsUrl: URL of JSON file containing region mapping definitions
  • conversionServiceBaseUrl: URL of OGR2OGR conversion service
  • proj4ServiceBaseUrl: URL of proj4def lookup service
  • corsProxyBaseUrl: URL of CORS proxy
Type:
  • Object

corsProxy :CorsProxy

Source:

Gets or sets the this.corsProxy used to determine if a URL needs to be proxied and to proxy it if necessary.

Type:

currentViewer :Cesium|Leaflet|NoViewer

Source:

Gets or sets a reference to the current viewer, which is a subclass of Terria#globeOrMap - typically Terria#cesium or Terria#leaflet. This property is observable.

Type:

dataSources :DataSourceCollection

Source:

Gets or sets the collection of Cesium-style data sources that are currently active on the map.

Type:
  • DataSourceCollection

error :CesiumEvent

Source:

An event that is raised when a user-facing error occurs. This is especially useful for errors that happen asynchronously and so cannot be raised as an exception because no one would be able to catch it. Subscribers are passed the TerriaError that occurred as the only function parameter.

Type:
  • CesiumEvent

filterStartDataCallback :function

Source:

Gets or sets a callback function that can modify any "start data" (e.g. a share URL) before it is loaded. The function is passed the start data and may modify it in place or return a new instance.

Type:
  • function

fogSettings :Object

Source:

Gets or sets the current fog settings, used in the Cesium Scene/Fog constructor.

Type:
  • Object

homeView :CameraView

Source:

Gets or sets the camera's home view. The home view is the one that the application returns to when the user clicks the "Reset View" button in the Navigation widget. It is also used as the Terria#initialView if one is not specified.

Type:

initSources :Array

Source:

Gets or sets the list of sources from which the catalog was populated. A source may be a string, in which case it is expected to be a URL of an init file (like init_nm.json), or it can be a JSON-style object literal which is the init content itself.

Type:
  • Array

leaflet :Leaflet

Source:

Gets or sets properties related to the Leaflet map. If the application is in 3D mode, this property will be undefined and Terria#cesium will be set.

Type:

locationMarker :CustomDataSource

Source:

Gets or sets the data source that represents the location marker.

Type:

mapInteractionModeStack :Array.<MapInteractionMode>

Source:

Gets or sets the stack of map interactions modes. The mode at the top of the stack (highest index) handles click interactions with the map

Type:

nowViewing :NowViewing

Source:

Gets or sets the collection of geospatial data that is currently enabled.

Type:

pickedFeatures :PickedFeatures

Source:

Gets or sets the features that are currently picked.

Type:

previewedItemId :string

Source:

Gets or sets id of previewed item

Type:
  • string

selectBox :Boolean

Source:

Gets or sets the selectBox function - set true when user requires a rectangle parameter from analytics.

Type:
  • Boolean

selectedFeature :Entity

Source:

Gets or sets the currently-selected feature, or undefined if there is no selected feature. The selected feature is highlighted by drawing a targetting cursor around it.

Type:
  • Entity

serverConfig :Object

Source:

Gets or sets the ServerConfig object representing server-side configuration.

Type:
  • Object

services :Services

Source:

Gets or sets the add-on services known to the application.

Type:
  • Services

shareDataService :Object

Source:

Gets or sets the shareDataService to be used with Terria, which can save JSON or (in future) other user-provided data somewhere. It can be used to generate short URLs.

Type:
  • Object

sharedFromExplorerPanel :Boolean

Source:

Gets or sets whether to toggle viewState's sharedFromExplorerPanel after loading start data. Default false.

Type:
  • Boolean

shouldStartSatelliteGuidance :Boolean

Source:

Gets or sets whether we should initiate the satellite guidance, based on whether a time wms exists in NowViewing

Type:
  • Boolean

showSplitter :Boolean

Source:

Gets or sets whether to show a splitter, if possible. Default false. This property is observable.

Type:
  • Boolean

splitPosition

Source:

Gets or sets the current position of the splitter (if Terria#showSplitter is true) as a fraction of the map window. 0.0 is on the left, 0.5 is in the center, and 1.0 is on the right. This property is observable.

splitPositionVertical

Source:

Gets or sets the current vertical position of the splitter (if Terria#showSplitter is true) as a fraction of the map window. 0.0 is on the top, 0.5 is in the center, and 1.0 is on the bottom. This property is observable.

stories

Source:

Array of stories

supportEmail :String

Source:
Default Value:
  • "support@terria.io"

The support email for the app to be built upon Terria. This will appear in error messages to the user.

Type:
  • String

tileLoadProgressEvent :CesiumEvent

Source:

Event that tracks changes to the progress in loading new tiles from either Cesium or Leaflet - events will be raised with the number of tiles that still need to load.

Type:
  • CesiumEvent

urlShortener :Object

Source:

Gets or sets the urlShorter to be used with terria. This is currently set in the start method to allow the urlShortener object to properly initialize. See the GoogleUrlShortener for an example urlShortener.

Type:
  • Object

useNativeResolution :Boolean

Source:

Gets or sets whether to use the device's native resolution (sets cesium.viewer.resolutionScale to a ratio of devicePixelRatio)

Type:
  • Boolean

userProperties :Object

Source:

Gets or sets the collection of user properties. User properties can be set by specifying them in the hash portion of the URL. For example, if the application URL is http://localhost:3001/#foo=bar&someproperty=true, this object will contain a property named 'foo' with the value 'bar' and a property named 'someproperty' with the value 'true'. Currently recognised URL parameters include 'map=[2D,3D]' (choose the Leaflet or Cesium view) and mode=preview (suppress warnings, when used as an embedded previewer).

Type:
  • Object

viewerMode :ViewerMode

Source:

Gets or sets the map mode.

Type:

zoomWhenInitialViewChanges :Boolean

Source:
Default Value:
  • true

Gets or sets a value indicating whether the application should automatically zoom to the new view when the Terria#initialView (or Terria#homeView if no initial view is specified).

Type:
  • Boolean

Methods

checkNowViewingForTimeWms(The) → {ImagerySplitDirection}

Source:

Returns the side of the splitter the position lies on.

Parameters:
Name Type Description
The Cartesian2 | Cartesian3

screen position.

Returns:

The side of the splitter on which position lies.

Type
ImagerySplitDirection

getSplitterSideForScreenPosition(The) → {ImagerySplitDirection}

Source:

Returns the side of the splitter the position lies on.

Parameters:
Name Type Description
The Cartesian2 | Cartesian3

screen position.

Returns:

The side of the splitter on which position lies.

Type
ImagerySplitDirection

getUserProperty(propertyName) → {Object}

Source:

Gets the value of a user property. If the property doesn't exist, it is created as an observable property with the value undefined. This way, if it becomes defined in the future, anyone depending on the value will be notified.

Parameters:
Name Type Description
propertyName String

The name of the user property for which to get the value.

Returns:

The value of the property, or undefined if the property does not exist.

Type
Object

start(options)

Source:

Starts up Terria.

Parameters:
Name Type Description
options Object

Object with the following properties:

Properties
Name Type Attributes Default Description
applicationUrl String <optional>

The URL of the application. Typically this is obtained from window.location. This URL, if supplied, is parsed for startup parameters.

configUrl String <optional>
'config.json'

The URL of the file containing configuration information, such as the list of domains to proxy.

urlShortener UrlShortener <optional>

The URL shortener to use to expand short URLs. If this property is undefined, short URLs will not be expanded.

persistViewerMode Boolean <optional>

Whether to use the ViewerMode stored in localStorage if avaliable (this takes priority over other ViewerMode options). If not specified the stored ViewerMode will be used.

updateApplicationUrl(newUrl) → {Promise}

Source:

Updates the state of the application based on the hash portion of a URL.

Parameters:
Name Type Description
newUrl String

The new URL of the application.

Returns:

A promise that resolves when any new init sources specified in the URL have been loaded.

Type
Promise