Class: GeoJsonDataSource

GeoJsonDataSource

new GeoJsonDataSource(nameopt)

A DataSource which processes both GeoJSON and TopoJSON data. simplestyle-spec properties will also be used if they are present.
Parameters:
Name Type Attributes Description
name String <optional>
The name of this data source. If undefined, a name will be taken from the name of the GeoJSON file.
Source:
Example
var viewer = new Cesium.Viewer('cesiumContainer');
viewer.dataSources.add(Cesium.GeoJsonDataSource.load('../../SampleData/ne_10m_us_states.topojson', {
  stroke: Cesium.Color.HOTPINK,
  fill: Cesium.Color.PINK,
  strokeWidth: 3,
  markerSymbol: '?'
}));

Members

(static) clampToGround :Boolean

Gets or sets default of whether to clamp to the ground.
Type:
  • Boolean
Default Value:
  • false
Source:

(static) crsLinkHrefs :Object

Gets an object that maps the href property of a crs link to a callback function which takes the crs properties object and returns a Promise that resolves to a function that takes a GeoJSON coordinate and transforms it into a WGS84 Earth-fixed Cartesian. Items in this object take precedence over those defined in crsLinkHrefs, assuming the link has a type specified.
Type:
  • Object
Source:

(static) crsLinkTypes :Object

Gets an object that maps the type property of a crs link to a callback function which takes the crs properties object and returns a Promise that resolves to a function that takes a GeoJSON coordinate and transforms it into a WGS84 Earth-fixed Cartesian. Items in crsLinkHrefs take precedence over this object.
Type:
  • Object
Source:

(static) crsNames :Object

Gets an object that maps the name of a crs to a callback function which takes a GeoJSON coordinate and transforms it into a WGS84 Earth-fixed Cartesian. Older versions of GeoJSON which supported the EPSG type can be added to this list as well, by specifying the complete EPSG name, for example 'EPSG:4326'.
Type:
  • Object
Source:

(static) fill :Color

Gets or sets default color for polygon interiors.
Type:
Default Value:
  • Color.YELLOW
Source:

(static) markerColor :Color

Gets or sets the default color of the map pin created for each point.
Type:
Default Value:
  • Color.ROYALBLUE
Source:

(static) markerSize :Number

Gets or sets the default size of the map pin created for each point, in pixels.
Type:
  • Number
Default Value:
  • 48
Source:

(static) markerSymbol :String

Gets or sets the default symbol of the map pin created for each point. This can be any valid Maki identifier, any single character, or blank if no symbol is to be used.
Type:
  • String
Source:

(static) stroke :Color

Gets or sets the default color of polylines and polygon outlines.
Type:
Default Value:
  • Color.BLACK
Source:

(static) strokeWidth :Number

Gets or sets the default width of polylines and polygon outlines.
Type:
  • Number
Default Value:
  • 2.0
Source:

changedEvent :Event

Gets an event that will be raised when the underlying data changes.
Type:
Source:

clock :DataSourceClock

This DataSource only defines static data, therefore this property is always undefined.
Type:
Source:

clustering :EntityCluster

Gets or sets the clustering options for this data source. This object can be shared between multiple data sources.
Type:
Source:

entities :EntityCollection

Gets the collection of Entity instances.
Type:
Source:

errorEvent :Event

Gets an event that will be raised if an error is encountered during processing.
Type:
Source:

isLoading :Boolean

Gets a value indicating if the data source is currently loading data.
Type:
  • Boolean
Source:

loadingEvent :Event

Gets an event that will be raised when the data source either starts or stops loading.
Type:
Source:

name :String

Gets a human-readable name for this instance.
Type:
  • String
Source:

show :Boolean

Gets whether or not this data source should be displayed.
Type:
  • Boolean
Source:

Methods

(static) load(data, optionsopt) → {Promise.<GeoJsonDataSource>}

Creates a Promise to a new instance loaded with the provided GeoJSON or TopoJSON data.
Parameters:
Name Type Attributes Description
data String | Object A url, GeoJSON object, or TopoJSON object to be loaded.
options Object <optional>
An object with the following properties:
Properties
Name Type Attributes Default Description
sourceUri String <optional>
Overrides the url to use for resolving relative links.
markerSize Number <optional>
GeoJsonDataSource.markerSize The default size of the map pin created for each point, in pixels.
markerSymbol String <optional>
GeoJsonDataSource.markerSymbol The default symbol of the map pin created for each point.
markerColor Color <optional>
GeoJsonDataSource.markerColor The default color of the map pin created for each point.
stroke Color <optional>
GeoJsonDataSource.stroke The default color of polylines and polygon outlines.
strokeWidth Number <optional>
GeoJsonDataSource.strokeWidth The default width of polylines and polygon outlines.
fill Color <optional>
GeoJsonDataSource.fill The default color for polygon interiors.
clampToGround Boolean <optional>
GeoJsonDataSource.clampToGround true if we want the geometry features (polygons or linestrings) clamped to the ground. If true, lines will use corridors so use Entity.corridor instead of Entity.polyline.
Source:
Returns:
A promise that will resolve when the data is loaded.
Type
Promise.<GeoJsonDataSource>

load(data, optionsopt) → {Promise.<GeoJsonDataSource>}

Asynchronously loads the provided GeoJSON or TopoJSON data, replacing any existing data.
Parameters:
Name Type Attributes Description
data String | Object A url, GeoJSON object, or TopoJSON object to be loaded.
options Object <optional>
An object with the following properties:
Properties
Name Type Attributes Default Description
sourceUri String <optional>
Overrides the url to use for resolving relative links.
describe GeoJsonDataSource~describe <optional>
GeoJsonDataSource.defaultDescribeProperty A function which returns a Property object (or just a string), which converts the properties into an html description.
markerSize Number <optional>
GeoJsonDataSource.markerSize The default size of the map pin created for each point, in pixels.
markerSymbol String <optional>
GeoJsonDataSource.markerSymbol The default symbol of the map pin created for each point.
markerColor Color <optional>
GeoJsonDataSource.markerColor The default color of the map pin created for each point.
stroke Color <optional>
GeoJsonDataSource.stroke The default color of polylines and polygon outlines.
strokeWidth Number <optional>
GeoJsonDataSource.strokeWidth The default width of polylines and polygon outlines.
fill Color <optional>
GeoJsonDataSource.fill The default color for polygon interiors.
clampToGround Boolean <optional>
GeoJsonDataSource.clampToGround true if we want the features clamped to the ground.
Source:
Returns:
a promise that will resolve when the GeoJSON is loaded.
Type
Promise.<GeoJsonDataSource>

Type Definitions

describe(properties, nameProperty)

This callback is displayed as part of the GeoJsonDataSource class.
Parameters:
Name Type Description
properties Object The properties of the feature.
nameProperty String The property key that Cesium estimates to have the name of the feature.
Source: