new Terria(options)
The overall model for TerriaJS.
Parameters:
| Name | Type | Description | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | Object with the following properties: Properties
|
- Source:
Members
afterViewerChanged :Event
Gets or sets the event that is raised just after switching between Cesium and Leaflet.
Type:
- Event
- Source:
analytics :ConsoleAnalytics|GoogleAnalytics
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
- Source:
appName :String
The name of the app to be built upon Terria. This will appear in error messages to the user.
Type:
- String
- Default Value:
- "TerriaJS App"
- Source:
autoPlay :Boolean
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
- Default Value:
- true
- Source:
baseMap :ImageryLayerCatalogItem
Gets or sets the current base map.
Type:
- Source:
baseMapContrastColor :String
Gets or sets a color that contrasts well with the base map.
Type:
- String
- Source:
baseMapName :String
Gets or sets the name of the base map to use.
Type:
- String
- Source:
batchGeocoder :AddressGeocoder
The geocoder to use for batch geocoding addresses in CSV files.
Type:
- Source:
beforeViewerChanged :Event
Gets or sets the event that is raised just before switching between Cesium and Leaflet.
Type:
- Event
- Source:
catalog :Catalog
Gets or sets the catalog of geospatial data.
Type:
- Source:
cesium :Cesium
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:
- Source:
clock :Clock
Gets or sets the clock that controls how time-varying data items are displayed.
Type:
- Source:
configParameters :Object
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
- Source:
corsProxy :CorsProxy
Gets or sets the this.corsProxy used to determine if a URL needs to be proxied and to proxy it if necessary.
Type:
- Source:
currentViewer :Cesium|Leaflet|NoViewer
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:
- Source:
dataSources :DataSourceCollection
Gets or sets the collection of Cesium-style data sources that are currently active on the map.
Type:
- DataSourceCollection
- Source:
error :CesiumEvent
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
- Source:
filterStartDataCallback :function
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
- Source:
fogSettings :Object
Gets or sets the current fog settings, used in the Cesium Scene/Fog constructor.
Type:
- Object
- Source:
homeView :CameraView
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:
- Source:
initSources :Array
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
- Source:
leaflet :Leaflet
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:
- Source:
locationMarker :CustomDataSource
Gets or sets the data source that represents the location marker.
Type:
- Source:
mapInteractionModeStack :Array.<MapInteractionMode>
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:
- Array.<MapInteractionMode>
- Source:
nowViewing :NowViewing
Gets or sets the collection of geospatial data that is currently enabled.
Type:
- Source:
pickedFeatures :PickedFeatures
Gets or sets the features that are currently picked.
Type:
- Source:
selectBox :Boolean
Gets or sets the selectBox function - set true when user requires a rectangle parameter from analytics.
Type:
- Boolean
- Source:
selectedFeature :Entity
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
- Source:
serverConfig :Object
Gets or sets the ServerConfig object representing server-side configuration.
Type:
- Object
- Source:
services :Services
Gets or sets the add-on services known to the application.
Type:
- Services
- Source:
shareDataService :Object
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
- Source:
showSplitter :Boolean
Gets or sets whether to show a splitter, if possible. Default false. This property is observable.
Type:
- Boolean
- Source:
splitPosition
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.
- Source:
splitPositionVertical
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.
- Source:
supportEmail :String
The support email for the app to be built upon Terria. This will appear in error messages to the user.
Type:
- String
- Default Value:
- "support@terria.io"
- Source:
tileLoadProgressEvent :CesiumEvent
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
- Source:
urlShortener :Object
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
- Source:
userProperties :Object
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
- Source:
viewerMode :ViewerMode
Gets or sets the map mode.
Type:
- Source:
zoomWhenInitialViewChanges :Boolean
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
- Default Value:
- true
- Source:
Methods
getUserProperty(propertyName) → {Object}
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. |
- Source:
Returns:
The value of the property, or undefined if the property does not exist.
- Type
- Object
start(options)
Starts up Terria.
Parameters:
| Name | Type | Description | |||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | Object with the following properties: Properties
|
- Source:
updateApplicationUrl(newUrl) → {Promise}
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. |
- Source:
Returns:
A promise that resolves when any new init sources specified in the URL have been loaded.
- Type
- Promise