Example:
const provider = await Cesium.GeoJsonFeatureLayerProvider.fromUrl(
"roads.geojson",
{ name: "Roads" },
);
provider.featureLayers.get(0).show = false;
Experimental
This 该特征并非最终定局,且可能根据 Cesium 的标准弃用政策发生变化。
Members
readonly featureLayers : FeatureLayerCollection
此实例提供的所有特征图层。一个 GeoJSON 文档相当于一个
图层,因此始终恰好包含一个图层。
Methods
static Cesium.GeoJsonFeatureLayerProvider.fromGeoJson(geoJson, options) → GeoJsonFeatureLayerProvider
为 GeoJSON 对象的特征创建提供者。
| Name | Type | Description | ||||||
|---|---|---|---|---|---|---|---|---|
geoJson |
object | 一个 GeoJSON 对象。 | ||||||
options |
object |
optional
一个具有以下属性的对象:
|
Returns:
The 提供者。
async static Cesium.GeoJsonFeatureLayerProvider.fromUrl(url, options) → Promise.<GeoJsonFeatureLayerProvider>
获取 GeoJSON 文件并为其特征创建提供者。
| Name | Type | Description | ||||||
|---|---|---|---|---|---|---|---|---|
url |
Resource | string | GeoJSON 文件的 URL。 | ||||||
options |
object |
optional
一个具有以下属性的对象:
|
Returns:
A 解析为提供者的 promise。
Throws:
-
RuntimeError : Failed 用于加载 GeoJSON。
