//设定模拟时间的界限
var start = Cesium.JulianDate.fromDate(new Date(2021, 3, 2, 23,50,20))//朱利安时间=UTC=北京时间-8 2021-03-02 15:50:20
var stop = Cesium.JulianDate.fromDate(new Date(2021, 3, 2, 23,56,20))
//确保查看器在想要的时间
viewer.clock.startTime = start.clone()
viewer.clock.stopTime = stop.clone()
viewer.clock.currentTime = start.clone()
viewer.clock.clockRange = Cesium.ClockRange.CLAMPED//达到终止时间后停止,LOOP_STOP:达到终止时间后重新循环,UNBOUNDED:达到终止时间后继续读秒
viewer.clock.multiplier = 10//初始运行速度
//将时间轴设置为模拟边界
viewer.timeline.zoomTo(start, stop)
//生成一个一条线
function computeCirclularFlight() {
var property = new Cesium.SampledPositionProperty()
var dataSource = [{
'id':1,
'time':new Date(2021, 3, 2, 23,50,20),
'lng':120.43413519859315,
'lat':30.238649673375463,
},{
'id':2,
'time':new Date(2021, 3, 2, 23,51,20),
'lng':120.4343605041504,
'lat':30.23831135356134,
},{
'id':3,
'time':new Date(2021, 3, 2, 23,52,20),
'lng':120.43460726737977,
'lat':30.237908148974306,
},{
'id':4,
'time':new Date(2021, 3, 2, 23,53,20),
'lng':120.43478429317476,
'lat':30.237602268529127,
},{
'id':5,
'time':new Date(2021, 3, 2, 23,54,20),
'lng':120.4349720478058,
'lat':30.237282483409622,
},{
'id':6,
'time':new Date(2021, 3, 2, 23,55,20),
'lng':120.4351720478058,
'lat':30.236882483409622,
},{
'id':7,
'time':new Date(2021, 3, 2, 23,56,20),
'lng':120.4353720478058,
'lat':30.236482483409622,
}
]
for (var i = 0i <7i ++) {
var time = Cesium.JulianDate.fromDate(dataSource[i].time)//每个点对应的时间
var position = Cesium.Cartesian3.fromDegrees(dataSource[i].lng,dataSource[i].lat,100)
property.addSample(time, position)
}
return property
}
//Compute the entity position property.
var position = computeCirclularFlight()
//Actually create the entity
var entity = viewer.entities.add({
//Set the entity availability to the same interval as the simulation time.
availability: new Cesium.TimeIntervalCollection([
new Cesium.TimeInterval({
start: start,
stop: stop,
}),
]),
//Use our computed positions
position: position,
//Automatically compute orientation based on position movement.
orientation: new Cesium.VelocityOrientationProperty(position),
//Load the Cesium plane model to represent the entity
model: {
uri: "../SampleData/models/CesiumAir/Cesium_Air.glb",//模型地址
minimumPixelSize: 64,
},
//Show the path as a pink line sampled in 1 second increments.
path: {
resolution: 1,
material: new Cesium.PolylineGlowMaterialProperty({
glowPower: 0.1,
color: Cesium.Color.YELLOW,
}),
width: 10,
},
})
//添加按钮从顶部查看路径
Sandcastle.addDefaultToolbarButton("View Top Down", function () {
viewer.trackedEntity = undefined
viewer.zoomTo(
viewer.entities,
new Cesium.HeadingPitchRange(0, Cesium.Math.toRadians(-90))
)
})
//添加按钮从侧面查看路径
Sandcastle.addToolbarButton("View Side", function () {
viewer.trackedEntity = undefined
viewer.zoomTo(
viewer.entities,
new Cesium.HeadingPitchRange(
Cesium.Math.toRadians(-90),
Cesium.Math.toRadians(-15),
7500
)
)
})
//添加按钮来跟踪实体的移动
Sandcastle.addToolbarButton("View Aircraft", function () {
viewer.trackedEntity = entity
})
//添加一个组合框来选择每个插值模式.
Sandcastle.addToolbarMenu(
[
{
text: "Interpolation: Linear Approximation",
onselect: function () {
entity.position.setInterpolationOptions({
interpolationDegree: 1,
interpolationAlgorithm: Cesium.LinearApproximation,
})
},
},
{
text: "Interpolation: Lagrange Polynomial Approximation",
onselect: function () {
entity.position.setInterpolationOptions({
interpolationDegree: 5,
interpolationAlgorithm:
Cesium.LagrangePolynomialApproximation,
})
},
},
{
text: "Interpolation: Hermite Polynomial Approximation",
onselect: function () {
entity.position.setInterpolationOptions({
interpolationDegree: 2,
interpolationAlgorithm: Cesium.HermitePolynomialApproximation,
})
},
},
],
"interpolationMenu"
)
ArcGIS Server发布服务的方式有多种,最常用的就是通过ArcMap发布。
1、首先在打开您要发布的地图文档,将坐标系切换到3857,具体 *** 作如下:右键Layers,打开属性,切换到Coordinate System标签下,在搜索栏中搜索3857,选中WGS 1984 Web Mercator(auxiliary sphere),确定即可。
2、然后点击File->Share As->Service…,打开Share as Service窗口,如下:
3、选择Publish a service,点击下一步
4、选择ArcGIS Server连接以及设置服务名称,点击下一步,直到ServiceEditor
5、ArcGIS Server的参数非常丰富,可以适应各种需求。目前cesiumlab支持的ArcGIS Server切片必须进行如下设置:
6、在Caching中,
Draw this map service:选择Using tiles from a cache;
Tiling Scheme:选择ArcGIS Online/Bing Maps/Google Maps;
Levels of Detail:默认即可;
7、在Caching->Advanced Settings->Advanced中,将Storage Format切换为EXPLODED,确定。注:该界面的Cache directory是设置切片存储路径的,请记下该路径。
8、最后点击右上角的Publish,等待几秒后d出Copying Data Server窗口,点OK,之后就是复制数据,打包,处理,生成缓存切片等过程
9、完成时将会提示Service Publishing Result
默认情况下,切片数据存储在<Cache directory>/ <mapservername>/Layers下面。
1、打开cesiumlab,切换到分发服务页面,点击添加,d出添加数据窗口
2、点击选择文件夹,选择<Cache directory>/ <mapservername>/Layers,数据名称可以随意设置,然后点击确定。
3、这时,在服务列表中会多出一条记录,通过点击服务路径可跳转至三维视图查看该数据。
至此,cesiumlab完成加载ArcGIS Server切片数据,小伙伴们快来动手试试吧!
一、常用影像图层加载1、添加高德地图
2、添加天地图
3、添加ArcServer地图
4、添加Geoserver 地图
二、Cesium ImageryProvider
加载不同格式的地图需要选择不同的接口,详见官方文档:
https://cesium.com/docs/cesiumjs-ref-doc/ImageryProvider.html
三、常用的影像地图服务:
1、高德:
2、天地图
3、智图
天地图图层加载:
百度地图的加载有点复杂,这篇博客有详细的解决方法: https://blog.csdn.net/KaiSarH/article/details/106242572
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)