请问想做一种这样根据经纬度绘制立体的线,高德有什么好的解决方案吗
var map = new AMap.Map('container', {
viewMode: '3D',
showBuildingBlock: false,
expandZoomRange: true,
zooms: [3, 20],
pitch: 50,
zoom: 16.5,
center: [116.250766, 39.932931]
});
var object3Dlayer = new AMap.Object3DLayer();
map.add(object3Dlayer);
var center_3d = map.lngLatToGeodeticCoord(map.getCenter());
var center = center_3d.add(new AMap.Pixel(0, 0))
var height = 1600
var radius = 500
var bottomColor = [0, 0, 1, 0.9];
//添加一个圆柱体
var cylinder = new AMap.Object3D.Mesh();
var geometry = cylinder.geometry;
var path = []
var x = center.x, y = center.y
var count = 20
for (var i = 0; i < count; i += 1) {
path.push([x, y]);
geometry.vertices.push(x, y, 0); //底部顶点
geometry.vertices.push(x, y, -height * Math.random()); //顶部顶点
x += Math.random() * radius;
y += Math.random() * radius;
geometry.vertexColors.push.apply(geometry.vertexColors, bottomColor); //底部颜色
//geometry.vertexColors.push.apply(geometry.vertexColors, bottomColor); //顶部颜色
if(i){
var bottomIndex = i * 2;
var topIndex = bottomIndex + 1;
var preBottomIndex = bottomIndex - 2;
var preTopIndex = bottomIndex - 1;
geometry.faces.push(bottomIndex, preTopIndex, preBottomIndex); //侧面三角形1
geometry.faces.push(bottomIndex, topIndex, preTopIndex); //侧面三角形2
}
}
cylinder.transparent = true; // 如果使用了透明颜色,请设置true
object3Dlayer.add(cylinder);
10 回答11.2k 阅读
5 回答4.8k 阅读✓ 已解决
4 回答3.1k 阅读✓ 已解决
2 回答2.8k 阅读✓ 已解决
3 回答4.9k 阅读✓ 已解决
1 回答3.2k 阅读✓ 已解决
3 回答2.3k 阅读✓ 已解决
使用cesium的viewer.entities能实现,
数据格式为: