Appearance
KBE3D / KBCore / Cesium / GeoJsonDataSource
类: GeoJsonDataSource
A DataSource which processes both GeoJSON and TopoJSON data. simplestyle-spec properties will also be used if they are present.
示例
ts
const 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: '?'
}));参数
The name of this data source. If undefined, a name will be taken from the name of the GeoJSON file.
属性
markerSize
staticmarkerSize:number
Gets or sets the default size of the map pin created for each point, in pixels.
markerSymbol
staticmarkerSymbol: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.
markerColor
staticmarkerColor:Color
Gets or sets the default color of the map pin created for each point.
stroke
staticstroke:Color
Gets or sets the default color of polylines and polygon outlines.
strokeWidth
staticstrokeWidth:number
Gets or sets the default width of polylines and polygon outlines.
fill
staticfill:Color
Gets or sets default color for polygon interiors.
clampToGround
staticclampToGround:boolean
Gets or sets default of whether to clamp to the ground.
crsNames
staticcrsNames:any
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'.
crsLinkHrefs
staticcrsLinkHrefs:any
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 <code>crsLinkHrefs</code>, assuming the link has a type specified.
crsLinkTypes
staticcrsLinkTypes:any
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 <code>crsLinkHrefs</code> take precedence over this object.
name
name:
string
Gets or sets a human-readable name for this instance.
clock
clock:
DataSourceClock
This DataSource only defines static data, therefore this property is always undefined.
entities
entities:
EntityCollection
Gets the collection of Entity instances.
isLoading
isLoading:
boolean
Gets a value indicating if the data source is currently loading data.
changedEvent
changedEvent:
Event
Gets an event that will be raised when the underlying data changes.
errorEvent
errorEvent:
Event
Gets an event that will be raised if an error is encountered during processing.
loadingEvent
loadingEvent:
Event
Gets an event that will be raised when the data source either starts or stops loading.
show
show:
boolean
Gets whether or not this data source should be displayed.
clustering
clustering:
EntityCluster
Gets or sets the clustering options for this data source. This object can be shared between multiple data sources.
credit
credit:
Credit
Gets the credit that will be displayed for the data source
方法
load()
staticload(data:any,options?:LoadOptions):Promise<GeoJsonDataSource>
Creates a Promise to a new instance loaded with the provided GeoJSON or TopoJSON data.
参数
data
any
A url, GeoJSON object, or TopoJSON object to be loaded.
options?
An object specifying configuration options
返回
Promise<GeoJsonDataSource>
A promise that will resolve when the data is loaded.
load()
load(
data:any,options?:LoadOptions):Promise<GeoJsonDataSource>
Asynchronously loads the provided GeoJSON or TopoJSON data, replacing any existing data.
参数
data
any
A url, GeoJSON object, or TopoJSON object to be loaded.
options?
An object specifying configuration options
返回
Promise<GeoJsonDataSource>
a promise that will resolve when the GeoJSON is loaded.
process()
process(
data:any,options?:LoadOptions):Promise<GeoJsonDataSource>
Asynchronously loads the provided GeoJSON or TopoJSON data, without replacing any existing data.
参数
data
any
A url, GeoJSON object, or TopoJSON object to be loaded.
options?
An object specifying configuration options
返回
Promise<GeoJsonDataSource>
a promise that will resolve when the GeoJSON is loaded.
update()
update(
time:JulianDate):boolean
Updates the data source to the provided time. This function is optional and is not required to be implemented. It is provided for data sources which retrieve data based on the current animation time or scene state. If implemented, update will be called by DataSourceDisplay once a frame.
参数
time
The simulation time.
返回
boolean
True if this data source is ready to be displayed at the provided time, false otherwise.
构造函数
构造函数
new GeoJsonDataSource(
name?:string):GeoJsonDataSource
参数
name?
string
返回
GeoJsonDataSource
