A
DataSource which processes both
GeoJSON and TopoJSON data.
simplestyle-spec properties will also be used if they
are present.
| Name | Type | Description |
|---|---|---|
name |
string | optional 此数据源的名称 。 如果未定义, 将会从 geoJSON 文件的名称. |
Example:
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: '?'
}));
Demo:
Members
获得或设置默认是否夹在地面.
-
Default Value:
false
获取一个将 crs 链接的href 属性映射到调用函数的对象
它取 crs 属性对象并返回 NT%0 ,以解析
到一个函数,它需要 GeoJSON 坐标并将其转换为 NT 0 地球固定笛卡尔.
本对象的项目优先于 NT 0 crsLinkHrefs NT 1 中定义的项目,假设
链接有指定的类型.
获取一个将 crs 链接的类型属性映射到调用函数的对象
它取 crs 属性对象并返回 NT%0 ,以解析
到一个函数,它需要 GeoJSON 坐标并将其转换为 NT 0 地球固定笛卡尔.
Items in
crsLinkHrefs take precedence over this object.
获取将 crs 名称映射为调用 GeoJSON 坐标的调用函数的对象
并将其转化为 NT 0 地球固定笛卡尔. GeoJSON 的旧版本
supported the EPSG type can be added to this list as well, by specifying the complete EPSG name,
for example 'EPSG:4326'.
static Cesium.GeoJsonDataSource.fill : Color
为多边形内部获取或设置默认颜色.
-
Default Value:
Color.YELLOW
static Cesium.GeoJsonDataSource.markerColor : Color
获取或设置为每个点创建的地图针的默认颜色.
-
Default Value:
Color.ROYALBLUE
获取或设置为每个点创建的地图针的默认大小,以像素为单位.
-
Default Value:
48
获取或设置为每个点创建的地图针的默认符号.
This can be any valid Maki identifier, any single character,
如果不使用符号,则空白.
static Cesium.GeoJsonDataSource.stroke : Color
获取或设置多边线和多边形轮廓的默认颜色.
-
Default Value:
Color.BLACK
获得或设置多边线和多边形轮廓的默认宽度.
-
Default Value:
2.0
changedEvent : Event
获得一个在基础数据变化时会提升的事件.
clock : DataSourceClock
这个数据来源只定义静态数据,因此这个属性总是没有定义的.
clustering : EntityCluster
获取或设置此数据源的分组选项。 此对象可以在多个数据源之间共享.
credit : Credit
获取数据源将显示的信用
entities : EntityCollection
Gets the collection of
Entity instances.
errorEvent : Event
获得一个在处理过程中遇到错误时会提起的事件.
获得一个表示数据源是否正在装入数据的值.
loadingEvent : Event
获得数据源开始或停止加载时将提出的事件.
为这个例子获得或设置一个人可读的名字.
获取是否显示此数据源 .
Methods
static Cesium.GeoJsonDataSource.load(data, options) → Promise.<GeoJsonDataSource>
创建装入 GeoJSON 或 TopoJSON 数据的新实例 .
| Name | Type | Description |
|---|---|---|
data |
Resource | string | object | Url, GeoJSON 对象,或要加载的 TopoJSON 对象. |
options |
GeoJsonDataSource.LoadOptions | optional 指定配置选项的对象 |
Returns:
当数据被装入时会解答的承诺 .
load(data, options) → Promise.<GeoJsonDataSource>
同步加载所提供的GeoJSON或TopoJSON数据,取代任何现有数据.
| Name | Type | Description |
|---|---|---|
data |
Resource | string | object | Url, GeoJSON 对象,或要加载的 TopoJSON 对象. |
options |
GeoJsonDataSource.LoadOptions | optional 指定配置选项的对象 |
Returns:
一个承诺,当GeoJSON上膛时,它就会解决.
process(data, options) → Promise.<GeoJsonDataSource>
同步加载所提供的GeoJSON或TopoJSON数据,而不替换任何现有数据.
| Name | Type | Description |
|---|---|---|
data |
Resource | string | object | Url, GeoJSON 对象,或要加载的 TopoJSON 对象. |
options |
GeoJsonDataSource.LoadOptions | optional 指定配置选项的对象 |
Returns:
一个承诺,当GeoJSON上膛时,它就会解决.
将数据源更新到所提供时间。 此函数是可选的,并且
不需要执行。 提供的数据来源为:
根据当前动画时间或场景状态检索数据.
If implemented, update will be called by
DataSourceDisplay once a frame.
| Name | Type | Description |
|---|---|---|
time |
JulianDate | 模拟时间. |
Returns:
如果此数据源准备在指定时间显示, 则不正确 .
Type Definitions
这种回调显示为GeoJsonData Source类的一部分.
| Name | Type | Description |
|---|---|---|
properties |
object | 特征的属性. |
nameProperty |
string | # NT 0 估计有特性名称的属性密钥 . |
NT 0 load NT 1 方法的初始化选项.
Properties:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
sourceUri |
string |
<optional> |
覆盖用于解析相对链接的url. | |
describe |
GeoJsonDataSource.describe |
<optional> |
GeoJsonDataSource.defaultDescribeProperty | A function which returns a Property object (or just a string). |
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. |
credit |
Credit | string |
<optional> |
数据源的信用,在画布上显示. |