当前位置: 首页 > news >正文

6人小组logo设计苏州seo网络推广

6人小组logo设计,苏州seo网络推广,微信官网网页版登录入口,国外网站 设计文章目录 需求分析解决 需求 Cesium 加载 geojson 文件并对文件中的属性值进行颜色设置 分析 在搜寻多种解决方案后,最后总结出 自己的解决方案 方案一,没看懂 var geojsonOptions {clampToGround : true //使数据贴地};var entities;promise Cesium…

文章目录

    • 需求
    • 分析
    • 解决

需求

Cesium 加载 geojson 文件并对文件中的属性值进行颜色设置

在这里插入图片描述

分析

在搜寻多种解决方案后,最后总结出 自己的解决方案

  • 方案一,没看懂
var geojsonOptions = {clampToGround : true //使数据贴地};var entities;promise =Cesium.GeoJsonDataSource.load('数据.geojson', geojsonOptions);promise.then(function (dataSource) {viewer.dataSources.add(dataSource);entities =dataSource.entities.values;var colorHash = {};for (var i = 0; i < entities.length; i++) {var entity = entities[i]; // 赋随机颜色var name = entity.name;var color = colorHash[name];if (!color) {color = Cesium.Color.fromRandom({red: 1,maximumGreen: 1,maximumBlue: 1,alpha : 1.0});colorHash[name] = color;}entity.polygon.material = color;entity.polygon.outline = false;            entity.polygon.extrudedHeight =5000.0;}});viewer.flyTo(promise);
  • 参考烦方案二:https://blog.csdn.net/qq_41553157/article/details/91040920

  • 参考方案三:https://blog.csdn.net/weixin_45782925/article/details/123873146

  • 参考方案四:https://blog.csdn.net/weixin_40187450/article/details/113446962

  • 参考方案六:https://blog.csdn.net/Enbir/article/details/122597412

  • 参考方案七:http://www.taodudu.cc/news/show-6244709.html?action=onClick

  • 最后总结出了自己的解决方案如下

解决

可以遍历 GeoJSON 中的每个要素

// 加载 geojson 文件并添加至 Cesium 的 dataSource 上
promise = viewer.dataSources.add(Cesium.GeoJsonDataSource.load("file.geojson"));//默认是黄色
promise.then(function (dataSource) {// 获取要素中的实体const entities = dataSource.entities.values;const colorHash = {};//显示颜色for (let i = 0; i < entities.length; i++) {const entity = entities[i];let count = entity.properties.count._value; //等级let color = colorHash[count];if (count == '1') {color = new Cesium.Color(76 / 255, 230 / 255, 0, 1);  // #4ce600} else if (count == '2') {color = new Cesium.Color(56 / 255, 168 / 255, 0, 1);  //#38a800} else if (count == '3') {color = new Cesium.Color(255, 25, 25, 1);  // #a8a800} else if (count == "4") {color = new Cesium.Color(230 / 255, 152 / 255, 0, 1);  // #e69800} else if (count == "5") {color = new Cesium.Color(255 / 255, 255 / 255, 0, 1);  // #ffff00} else if (count == "6") {color = new Cesium.Color(168 / 255, 0, 0, 1);  // #a80000} else {color = new Cesium.Color(130 / 255, 130 / 255, 130 / 255, 1);  // #828282}colorHash[count] = color;// 判断加载的空间数据点线面类型   赋值颜色let featureType = entity.properties._geometry._value.type;if (featureType == "MultiPolygon") {entity.polygon.material = color;} else if (featureType == "MultiLineString") {entity.polyline.material = color;entity.polyline.width = 3;} else if (featureType == "MultiPoint") {entity.point.material = color;}}
})
viewer.flyTo(promise);
http://www.15wanjia.com/news/158929.html

相关文章:

  • 设计签名免费网站网站做直播吗
  • 最超值的网站建设做电影网站模板教学
  • 玉树州公司网站建设在哪个网站上可以找兼职做
  • 河南省建设工程招标投标协会网站新媒体营销课程心得体会
  • 域名备案的网站名称公司网站背景图片
  • 服务器内部打不开网站医疗器械公司网站备案怎么做
  • 手机如何制作网站和网页企业邮箱的登录方式
  • 黄冈网站搭建推荐一个网站有多大
  • 镇江市网站天津开发区建设工程管理中心网站
  • 网站开发报告参考文献php与mysql网站开发全接触
  • 做网站烧钱网站和微信公众号建设方案
  • 网站首页动图怎么做电商网站建设题库
  • 佛山制作网站公司哪家好营销号是啥意思
  • 网站做好了怎样推广汤阴做网站
  • 自己学做网站需要学多久阿里巴巴1688官网网页版
  • 网站开发任务概述网站开发总结
  • 电影网站怎么建设兰州 网站建设公司哪家好
  • asp网站连接数据库做网站主要学什么条件
  • 专门做电子书的网站巩义推广网站哪家好
  • 做外贸网站多久更新常州电子商务网站建设
  • 整站网站优化wordpress商城 中文站
  • 网站制作定制18竞价恶意点击报案
  • 中国国际贸易网站桂林两江四湖地图
  • 免费网站个人注册企业网站建设介绍
  • 网站建设科技北京有限公司规划局网站建设工作总结
  • 做网站要用到数据库吗连连建设跨境电商网站
  • 淘宝客网站建站教程沈阳网站建
  • html5微网站demo超轻粘土做动漫网站
  • 网站优化 seo和semui设计自学网站推荐
  • 电商网站建设网黄冈app下载推广平台官网