2000字范文,分享全网优秀范文,学习好帮手!
2000字范文 > Cesium 加载自定义DEM数据

Cesium 加载自定义DEM数据

时间:2018-10-11 01:06:20

相关推荐

Cesium 加载自定义DEM数据

下载数据

从地理空间数据云 可以下载DEM数据,但是要注意

将坐标系转为WGS84的需要将格式转换为tif

DEM 瓦片生成

使用Cesium地形生成工具 ,部署和使用方法,里面很详细,这里不再详细介绍。

注意点:

在工具安装的过程中,如果你的电脑安装过ArcGIS的桌面程序,它会在C盘生成一个python的文件夹,我们就不必要安装Python了。

部署发布瓦片

将生成的瓦片的整个文件夹使用nginx或者IIS等进行发布,这里我使用的是nginx,这里需要设置允许跨域

#charset koi8-r;#access_log logs/host.access.log main;location / {root html;index index.html index.htm;add_header 'Access-Control-Allow-Origin' '*';add_header 'Access-Control-Allow-Credentials' 'true';if ($request_method = OPTIONS){add_header 'Access-Control-Allow-Origin' '*';add_header 'Access-Control-Allow-Credentials' 'true';add_header 'Access-Control-Max-Age' 1728000;add_header 'Access-Control-Allow-Credentials' 'true';add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, DELETE';add_header 'Access-Control-Allow-Headers' 'reqid, nid, host, x-real-ip, x-forwarded-ip, event-type, event-id, accept, content-type';}}

在Cesium里加载使用

let terrainLayer = new Cesium.CesiumTerrainProvider({url: "http://localhost/terrain_tiles", // 到文件夹});const viewer = new Cesium.Viewer('map3d', {terrainProvider:terrainLayer,// imageryProvider:image_provider_item,baseLayerPicker:false,homeButton:false,infoBox:false,timeline:false,navigationHelpButton:false,geocoder:false,sceneModePicker:false,animation:false,fullscreenButton:false});

测试效果

在Cesium 查看如下图

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。