GeoJsonDataSource

GeoJsonDataSource

new

A DataSource which processes both GeoJSON and TopoJSON data. Since GeoJSON has no standard for styling content, we provide default graphics via the defaultPoint, defaultLine, and defaultPolygon properties. Any changes to these objects will affect the resulting DynamicObject collection.

Example
//Use a billboard instead of a point.
var dataSource = new GeoJsonDataSource();
var defaultPoint = dataSource.defaulPoint;
defaultPoint.point = undefined;
var billboard = new DynamicBillboard();
billboard.image = new ConstantProperty('image.png');
defaultPoint.billboard = billboard;
dataSource.loadUrl('sample.geojson');
See:
Source:

Members

:DynamicObject

Gets or sets the default graphics to be applied to GeoJSON LineString and MultiLineString geometries.

:DynamicObject

Gets or sets the default graphics to be applied to GeoJSON Point and MultiPoint geometries.

:DynamicObject

Gets or sets the default graphics to be applied to GeoJSON Polygon and MultiPolygon geometries.

<static> :Object

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.

<static> :Object

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.

<static> :Object

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'.

Methods

Gets an event that will be raised when non-time-varying data changes or if the return value of getIsTimeVarying changes.

Returns:
Event The event.

Since GeoJSON is a static format, this function always returns undefined.

Gets the DynamicObjectCollection generated by this data source.

Returns:
DynamicObjectCollection The collection of objects generated by this data source.

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

Returns:
Event The event.

Gets a value indicating if the data varies with simulation time. If the return value of this function changes, the changed event will be raised.

Returns:
Boolean True if the data is varies with simulation time, false otherwise.

<static>

Asynchronously loads the provided GeoJSON object, replacing any existing data.

Parameters:
Name Type Argument Description
geoJson Object The object to be processed.
source String <optional>
The base URI of any relative links in the geoJson object.
Throws:
Returns:
Promise a promise that will resolve when the GeoJSON is loaded.

<static>

Asynchronously loads the GeoJSON at the provided url, replacing any existing data.

Parameters:
Name Type Description
url Object The url to be processed.
Throws:
DeveloperError : url is required.
Returns:
Promise a promise that will resolve when the GeoJSON is loaded.