Class: CesiumGeohash

CesiumGeohash()

A Geohash Model represents a geohash layer in a map.

Constructor

new CesiumGeohash()

Since:
  • 2.18.0
Source:

Extends

Members

defaults :Object

Default attributes for Geohash models
Type:
  • Object
Properties:
Name Type Description
type 'CesiumGeohash' The format of the data.
label string The label for the layer.
geohashes Geohashes The collection of geohashes to display on the map.
opacity number The opacity of the layer.
colorPalette AssetColorPalette The color palette for the layer.
outlineColor AssetColor The outline color for the layer.
highlightColor AssetColor The color to use for features that are selected/highlighted.
showLabels boolean Whether to show labels for the layer.
maxGeoHashes number The maximum number of geohashes to render at a time for performance reasons. If the number of geohashes exceeds this number, then the precision will be decreased until the number of geohashes is less than or equal to this number.
Overrides:
Source:

type :string

The name of this type of model
Type:
  • string
Inherited From:
Source:

Methods

addCustomProperties(properties) → {Object}

Given a set of properties from a Feature from this Map Asset model, add any custom properties to the properties object and return it.
Parameters:
Name Type Description
properties Object A set of key-value pairs representing the existing properties of a feature from this asset.
Since:
  • 2.19.0
Inherited From:
Source:
Returns:
The properties object with any custom properties added.
Type
Object

addEntity(entity) → {Cesium.Entity}

Manually an entity to the Cesium EntityCollection.
Parameters:
Name Type Description
entity Object The ConstructorOptions with properties to pass to Cesium.EntityCollection.add. See https://cesium.com/learn/cesiumjs/ref-doc/EntityCollection.html?classFilter=EntityCollection#add
Since:
  • 2.27.0
Inherited From:
Source:
Returns:
The Cesium Entity that was added
Type
Cesium.Entity

colorForEntity(entity) → {Cesium.Color|null}

Return the color for a feature based on the colorPalette and filters attributes.
Parameters:
Name Type Description
entity Cesium.Entity A Cesium Entity
Since:
  • 2.25.0
Inherited From:
Source:
Returns:
A Cesium Color or null if the color is invalid or alpha is 0
Type
Cesium.Color | null

colorToCesiumColor(color) → {Cesium.Color|null}

Covert a Color model to a Cesium Color
Parameters:
Name Type Description
color Color A Color model
Since:
  • 2.25.0
Inherited From:
Source:
Returns:
A Cesium Color or null if the color is invalid
Type
Cesium.Color | null

containsFeature(feature) → {boolean}

Given a feature object from a Feature model, checks if it is part of the selectedFeatures collection. See featureObject property from Feature#defaults. For vector and 3d tile models only.
Parameters:
Name Type Description
feature * An object that a Map widget uses to represent this feature in the map, e.g. a Cesium.Entity or a Cesium.Cesium3DTileFeature
Since:
  • 2.25.0
Inherited From:
Source:
Returns:
Returns true if the given feature is part of the selectedFeatures collection in this asset
Type
boolean

createCesiumModel(recreateopt)

Creates a Cesium.DataSource model and sets it to this model's 'cesiumModel' attribute. This cesiumModel contains all the information required for Cesium to render the vector data. See https://cesium.com/learn/cesiumjs/ref-doc/DataSource.html?classFilter=DataSource
Parameters:
Name Type Attributes Default Description
recreate Boolean <optional>
false Set recreate to true to force the function create the Cesium Model again. Otherwise, if a cesium model already exists, that is returned instead.
Inherited From:
Source:

featureIsSelected(feature) → {boolean}

Given a feature object from a Feature model, checks if it is part of the selectedFeatures collection. See featureObject property from Feature#defaults. For vector and 3d tile models only.
Parameters:
Name Type Description
feature * An object that a Map widget uses to represent this feature in the map, e.g. a Cesium.Entity or a Cesium.Cesium3DTileFeature
Inherited From:
Source:
Returns:
Returns true if the given feature is part of the selectedFeatures collection in this asset
Type
boolean

featureIsVisible(properties) → {boolean}

This function checks whether a feature from the MapAsset is visible on the map based on the properties of the feature and the MapAsset's filter settings.
Parameters:
Name Type Description
properties Object The properties of the feature to be filtered. (See the 'properties' attribute of Feature#defaults.)
Inherited From:
Source:
Returns:
Returns true if the feature passes all the filters, or if there are no filters set for this MapAsset. Returns false if the feature fails any of the filters.
Type
boolean

fetchIcon(pid)

Fetches an SVG given a pid, sanitizes it, then updates the model's icon attribute with the new and SVG string (after sanitizing it)
Parameters:
Name Type Description
pid string
Inherited From:
Source:

formatDateProperty(config, properties) → {string}

Given a definition for a new date property, and the properties that already exist on a specific feature, returns a new string with the formatted date.
Parameters:
Name Type Description
config MapConfig#CustomDateProperty An object that defines the new date property to create
properties Object key-value pairs representing existing properties in a Feature
Since:
  • 2.19.0
Inherited From:
Source:
Returns:
The value for the new date property, formatted as defined by config, for the given feature
Type
string

formatStringProperty(config, properties) → {string}

For a given set of Feature properties and a definition for a new sting property, returns the value of the custom property. Note that since only static strings are supported so far, this function essentially just returns the value of config.value. This function exists to allow support of dynamic strings in the future (e.g. combining strings from existing properties)
Parameters:
Name Type Description
config MapConfig#CustomStringProperty The object the defines the new custom property
properties Object key-value pairs representing existing properties in a Feature
Since:
  • 2.19.0
Inherited From:
Source:
Returns:
The new string for the given Feature property
Type
string

getBoundingSphere(dataSourceDisplay) → {Promise}

Waits for the model to be ready to display, then gets a Cesium Bounding Sphere that can be used to navigate to view the full extent of the vector data. See https://cesium.com/learn/cesiumjs/ref-doc/BoundingSphere.html.
Parameters:
Name Type Description
dataSourceDisplay Cesium.DataSourceDisplay The data source display attached to the CesiumWidget scene that this bounding sphere is for. Required.
Inherited From:
Source:
Returns:
Returns a promise that resolves to a Cesium Bounding Sphere when ready
Type
Promise

getCesiumModelFromFeature(feature) → {Cesium.GeoJsonDataSource|Cesium.CzmlDataSource}

Return the DataSource model for a feature from a Cesium DataSource model
Parameters:
Name Type Description
feature Cesium.Entity A Cesium Entity
Inherited From:
Source:
Returns:
The model
Type
Cesium.GeoJsonDataSource | Cesium.CzmlDataSource

getCesiumOptions() → {Object}

Get the asset config's cesiumOptions, if it has any. This will return a copy of the cesiumOptions object, so that changes made to the returned object will not affect the original cesiumOptions object.
Since:
  • 2.26.0
Inherited From:
Source:
Returns:
A copy of the cesiumOptions object, or null if there are no cesiumOptions.
Type
Object

getColor(properties) → {AssetColor#Color}

Given properties of a Feature model from this MapAsset, returns the color associated with that feature.
Parameters:
Name Type Description
properties Object The properties of the feature to get the color for; An object containing key-value mapping of property names to properties. (See the 'properties' attribute of Feature#defaults.)
Inherited From:
Source:
Returns:
The color associated with the given set of properties.
Type
AssetColor#Color

getEntities() → {Array.<Cesium.Entity>}

Get the Cesium Entities for this asset
Since:
  • 2.27.0
Inherited From:
Source:
Returns:
The Cesium Entities
Type
Array.<Cesium.Entity>

getEntityCollection() → {Cesium.EntityCollection}

Get the Cesium EntityCollection for this asset
Since:
  • 2.27.0
Inherited From:
Source:
Returns:
The Cesium EntityCollection
Type
Cesium.EntityCollection

getEntityFromMapObject(mapObject) → {Cesium.Entity}

Try to find Entity object that comes from an object passed from the Cesium map. This is useful when the map is clicked and the map returns an object that may or may not be an Entity.
Parameters:
Name Type Description
mapObject Object An object returned from the Cesium map
Since:
  • 2.25.0
Inherited From:
Source:
Returns:
- The Entity object if found, otherwise null.
Type
Cesium.Entity

getFeatureAttributes(feature) → {Object}

Given a feature object from a Feature model, returns the attributes needed to create a Feature model. For vector and 3d tile models only.
Parameters:
Name Type Description
feature * An object that a Map widget uses to represent this feature in the map, e.g. a Cesium.Entity or a Cesium.Cesium3DTileFeature
Inherited From:
Source:
Returns:
An object with properties, mapAsset, featureID, featureObject, and label properties. Returns null if the feature is not the correct type for this asset model.
Type
Object

getIDFromFeature(feature) → {string}

Return the ID used by Cesium for a feature from a DataSource model
Parameters:
Name Type Description
feature Cesium.Entity A Cesium Entity
Inherited From:
Source:
Returns:
The ID
Type
string

getLabelFromFeature(feature) → {string}

Return the label for a feature from a DataSource model
Parameters:
Name Type Description
feature Cesium.Entity A Cesium Entity
Inherited From:
Source:
Returns:
The label
Type
string

getPropertiesFromFeature(feature) → {Object}

Given a feature from a Cesium Vector Data source, returns any properties that are set on the feature, similar to an attributes table.
Parameters:
Name Type Description
feature Cesium.Entity A Cesium Entity
Inherited From:
Source:
Returns:
An object containing key-value mapping of property names to properties.
Type
Object

getSelectedStyles(entity) → {Object}

Return the styles for a selected feature
Parameters:
Name Type Description
entity Cesium.Entity A Cesium Entity
Since:
  • 2.25.0
Inherited From:
Source:
Returns:
An object containing the styles for the feature
Type
Object

getStyles(entity) → {Object}

Return the styles for a feature
Parameters:
Name Type Description
entity Cesium.Entity A Cesium Entity
Since:
  • 2.25.0
Inherited From:
Source:
Returns:
An object containing the styles for the feature
Type
Object

handleError()

When the asset can't be loaded, hide it from the map and show an error.
Since:
  • 2.27.0
Inherited From:
Source:

initialize(assetConfigopt)

Executed when a new CesiumVectorData model is created.
Parameters:
Name Type Attributes Description
assetConfig MapConfig#MapAssetConfig <optional>
The initial values of the attributes, which will be set on the model.
Inherited From:
Source:

isSVG(str) → {Boolean}

Simple test to see if a string is an SVG
Parameters:
Name Type Description
str string The string to check
Inherited From:
Source:
Returns:
Returns true if the string starts with ``, regardless of case
Type
Boolean

isVisible() → {boolean}

Checks that the visible attribute is set to true and that the opacity attribute is greater than zero. If both conditions are met, returns true.
Inherited From:
Source:
Returns:
Returns true if the MapAsset has opacity > 0 and is visible.
Type
boolean

listenToSelectedFeatures()

Update the appearance of features from this asset when they are selected or deselected in the map widget.
Since:
  • 2.27.0
Inherited From:
Source:

removeEntity(entity) → {Boolean}

Manually remove an entity from the Cesium EntityCollection.
Parameters:
Name Type Description
entity Cesium.Entity | string The entity or ID of the entity to remove
Since:
  • 2.27.0
Inherited From:
Source:
Returns:
True if the entity was removed, false otherwise
Type
Boolean

resetStatus()

Resets the Map Asset's status and statusDetails attributes to their default values.
Since:
  • 2.21.0
Inherited From:
Source:

resumeEvents()

Resume events on the Cesium EntityCollection. This will allow visualizers to run again.
Since:
  • 2.27.0
Inherited From:
Source:

runVisualizers()

Run the Cesium visualizers for this asset. Visualizers render data associated with DataSource instances. Visualizers must be run after changes are made to the data or the appearance of the data.
Since:
  • 2.27.0
Inherited From:
Source:
See:

sanitizeIcon(icon, callback)

Takes an SVG string and returns it with only the allowed tags and attributes
Parameters:
Name Type Description
icon string The SVG icon string to sanitize
callback function Function to call once the icon has been sanitized. Will pass the sanitized icon string.
Inherited From:
Source:

setError(error)

Set an error status and message for this asset.
Parameters:
Name Type Description
error Object | String An error object with a status code attribute or or string with details about the error.
Since:
  • 2.27.0
Inherited From:
Source:

setListeners()

Set listeners that update the cesium model when the backbone model is updated.
Inherited From:
Source:

setReady()

Set a ready status for this asset.
Since:
  • 2.27.0
Inherited From:
Source:

show()

Make sure the layer is visible. Sets visibility to true if false, and sets opacity to 0.5 if it's less than 0.05.
Inherited From:
Source:

styleBillboard(entity, styles)

Update the styles for a billboard entity
Parameters:
Name Type Description
entity Cesium.Entity The entity to update
styles Object Styles to apply, as returned by getStyles
Since:
  • 2.25.0
Inherited From:
Source:

styleEntities(entities)

Update the styles for a set of entities
Parameters:
Name Type Description
entities Array The entities to update
Since:
  • 2.25.0
Inherited From:
Source:

styleLabel(entity, styles)

Update the styles for a label entity
Parameters:
Name Type Description
entity Cesium.Entity The entity to update
styles Object Styles to apply, as returned by getStyles
Since:
  • 2.25.0
Inherited From:
Source:

stylePoint(entity, styles)

Update the styles for a point entity
Parameters:
Name Type Description
entity Cesium.Entity The entity to update
styles Object Styles to apply, as returned by getStyles
Since:
  • 2.25.0
Inherited From:
Source:

stylePolygon(entity, styles)

Update the styles for a polygon entity
Parameters:
Name Type Description
entity Cesium.Entity The entity to update
styles Object Styles to apply, as returned by getStyles
Since:
  • 2.25.0
Inherited From:
Source:

stylePolyline(entity, styles)

Update the styles for a polyline entity
Parameters:
Name Type Description
entity Cesium.Entity The entity to update
styles Object Styles to apply, as returned by getStyles
Since:
  • 2.25.0
Inherited From:
Source:

suspendEvents()

Suspend events on the Cesium EntityCollection. This will prevent visualizers from running until resumeEvents is called.
Since:
  • 2.27.0
Inherited From:
Source:

updateAppearance()

Updates the styles set on the cesiumModel object based on the colorPalette and filters attributes.
Inherited From:
Source:

updateFeatureVisibility()

Shows or hides each feature from this Map Asset based on the filters.
Inherited From:
Source:

updateIcon(icon)

Sanitizes an SVG string and updates the model's 'icon' attribute the sanitized string. Also sets the 'iconStatus' attribute to 'success'.
Parameters:
Name Type Description
icon string An SVG string to use for the MapAsset icon
Inherited From:
Source:

usesFeatureType(feature) → {boolean}

Checks if a feature from the map (a Cesium object) is the type of feature that this map asset model contains. For example, if a Cesium3DTilesetFeature is passed to this function, this function will return true if it is a Cesium3DTileset model, and false if it is a CesiumVectorData model.
Parameters:
Name Type Description
feature Cesium.Cesium3DTilesetFeature | Cesium.Entity
Since:
  • 2.25.0
Inherited From:
Source:
Returns:
true if the feature is an instance of the feature type set on the asset model, false otherwise.
Type
boolean

whenDisplayReady() → {Promise}

Checks that the map is ready to display this asset. The displayReady attribute is updated by the Cesium map when the dataSourceDisplay is updated.
Inherited From:
Source:
Returns:
Returns a promise that resolves to this model when ready to be displayed.
Type
Promise

whenReady() → {Promise}

Checks if the asset information has been fetched and is ready to use.
Inherited From:
Source:
Returns:
Returns a promise that resolves to this model when ready.
Type
Promise

whenVisualizersReady(callBack, pingRateopt, maxPingsopt)

Check for the existence of visualizers and run the callback when they are ready. This is useful for waiting to run code that depends on the visualizers being ready. It will attempt to run the callback every pingRate ms until the visualizers are ready, or until the maxPings is reached.
Parameters:
Name Type Attributes Default Description
callBack function The function to run when the visualizers are ready
pingRate Number <optional>
100 The number of milliseconds to wait between pings - pings are used to check if the visualizers are ready
maxPings Number <optional>
30 The maximum number of pings to wait before giving up
Inherited From:
Source:

zoomTo(feature)

Indicate that the map widget should navigate to a given feature from this MapAsset.
Parameters:
Name Type Description
feature Feature The feature to navigate to.
Since:
  • 2.27.0
Inherited From:
Source:

Type Definitions

cesiumOptions

Options that are supported for creating Cesium DataSources. The object will be passed to the cesium DataSource's load method as options, so the properties listed in the Cesium documentation are also supported. Each type of Cesium Data Source has a specific set of load method options. See for example, the GeoJsonDataSource options: https://cesium.com/learn/cesiumjs/ref-doc/GeoJsonDataSource.html
Type:
  • Object
Properties:
Name Type Description
data string | Object The url, GeoJSON object, or TopoJSON object to be loaded.
Inherited From:
Source: