gpt4 book ai didi

javascript - 有没有办法将 GeoJSON 中的一组 2D 多边形要素添加到 ArcGIS JS API 4.11 中 SceneView 的 3D 图层中?

转载 作者:行者123 更新时间:2023-11-30 19:31:49 25 4
gpt4 key购买 nike

我需要将一组二维多边形要素从以下文件类型之一加载到 ArgGIS JS API 4.11 中的 SceneView 中:GeoJSON、KML 或 ShapeFile。

我目前可以获取 geojson、KML 或 ShapeFile 格式的数据。我能够使用 GeoJSONLayer 将其放入我的 SceneView,实际层使用带有简单填充的 SimpleRenderer 进行渲染。但是,我需要将这些多边形投影到 3D 中,可能是通过在渲染器中使用 PolygonSymbol3D 和 ExtrudeSymbol3DLayer。问题是从 ArcGIS API 4.11 开始,GeoJSONLayer 不支持 ExtrudeSymbol3DLayer。所以我想我需要找到一种不同的方式来加载支持使用 ExtrudeSymbol3DLayer 的功能。

我希望能够使用 KMLLayer,但 KMLLayer 对 SceneView 的支持也不适用于 ArcGIS API 4.11。

在 ArcGIS JS API 4.11 中,是否有任何方法可以将一组定义为 GeoJSON 的 2D 多边形要素作为 3D 多边形图层?

这是我当前在 SceneView 中对 2D 图层的图层实现:


let layer = new GeoJSONLayer({
title: "My Layer",
url: "http://localhost/data/layer.geojson",
renderer: {
type: "simple",
symbolLayers: [{
type: "simple-fill",
material: { color: "orange" }
}]
}
minScale: 0,
opacity: 0.40,
geometryType: "polygon"
});

下面是我的 GeoJSON 的概念:

{
"type": "FeatureCollection",
"features": [
{
"type":"Feature",
"properties":{
"name":"Feature 1",
...
},
"geometry": {
"type": "MultiPolygon",
"coordinates": [[[...]]]
}
},
...
],
}

最佳答案

您可以使用 ExtrudeSymbol3DLayerGeoJSONLayer .使用看起来像这样的渲染器:

var renderer = {
type: "simple", // autocasts as new SimpleRenderer()
symbol: {
type: "polygon-3d", // autocasts as new PolygonSymbol3D()
symbolLayers: [
{
type: "extrude", // autocasts as new ExtrudeSymbol3DLayer()
material: { color: "red" },
edges: {
type: "solid", // autocasts as new SolidEdges3D()
color: [50, 50, 50, 0.5]
}
}
]
},
label: "Population Density per County",

// these visual variables are the key to "Extruding" the polygons
visualVariables: [
{
type: "size",
axis: "height",

field: "pop_2000",
normalizationField: "sq_miles",
}
]
};

完整演示 here .

关于javascript - 有没有办法将 GeoJSON 中的一组 2D 多边形要素添加到 ArcGIS JS API 4.11 中 SceneView 的 3D 图层中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56348251/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com