38 mars3d 对接地图图层 绘制点线面员

前言

这里主要是展示一下 mars3d 的一个基础的使用 

主要是设计 接入地图服务器的 卫星地图, 普通的二维地图, 增加地区标记 

基础绘制 点线面园 等等

测试用例

<template><div style="width: 1920px; height:1080px;"><div class="mars3dClass" id="mars3dClass"></div></div></template><script>import * as mars3d from "mars3d";const Cesium = mars3d.Cesium;export default {name: "mars3dMapUsage",components: {},props: {},data() {return {map: null,tdtImgLayer: null,labelLayer: null,overlay: null,mapOptions:{scene: {center: {"lat":31.376588,"lng":104.803391,"alt":539.5,"heading":273.6,"pitch":-40.1}},basemaps:[{type:'group',layers:[{name:'3dtiles地图',type:'xyz',url:'/terrainresource/scmf_0to19/{z}/{x}/{y}.png',}],show:true},]},};},computed: {},watch: {},created() {},mounted() {this.initMap()// this.test01AddBoundsLayer()// this.test02AddDtImageLayer()// this.test03AddDtTDLayer()// this.test04AddDtLabelLayer()this.test11AddTerrainLayer()// this.test05AddImageLayer()// this.test06AddCircleLayer([104.065735, 30.759462])// this.test06AddCircleLayer([104.065735, 30.559462], "red")// this.test07AddBoxLayer()// this.test08AddCylinderLayer()// this.test09AddPolylineVolumeLayer()},methods: {initMap() {this.map = new mars3d.Map("mars3dClass")this.map.setCameraView({lng: 104.065735, lat: 30.659462, alt: 44160})},test01AddBoundsLayer() {},test02AddDtImageLayer() {const tdtImgLayer = new mars3d.layer.TdtLayer({url: "/tianditu/servlet/GoogleSatelliteMap?x={x}&y={y}&z={z}",zIndex: 1,crs: mars3d.CRS.EPSG4490});this.map.addLayer(tdtImgLayer);},test03AddDtTDLayer() {const tdtImgLayer = new mars3d.layer.TdtLayer({url: "/tianditu/servlet/GoogleTDMap?x={x}&y={y}&z={z}",zIndex: 1,crs: mars3d.CRS.EPSG4490});this.map.addLayer(tdtImgLayer);},test04AddDtLabelLayer() {const labelLayer = new mars3d.layer.TdtLayer({url: "/tianditu/servlet/GoogleTransparentMap?x={x}&y={y}&z={z}",zIndex: 1,crs: mars3d.CRS.EPSG4490});this.map.addLayer(labelLayer);},test05AddImageLayer() {const graphicLayer = new mars3d.layer.GraphicLayer({zIndex: 20});this.map.addLayer(graphicLayer);const graphic = new mars3d.graphic.BillboardEntity({name: "贴地图标",position: [104.065735, 30.659462, 1000],style: {image: "/img/theme/desktop/17.jpg",scale: 1,horizontalOrigin: mars3d.Cesium.HorizontalOrigin.CENTER,verticalOrigin: mars3d.Cesium.VerticalOrigin.BOTTOM,clampToGround: true,},attr: {remark: "示例3"},});graphicLayer.addGraphic(graphic);},test06AddCircleLayer(coord, color) {const graphicLayer = new mars3d.layer.GraphicLayer({zIndex: 20});this.map.addLayer(graphicLayer);const graphic = new mars3d.graphic.CircleEntity({position: [coord[0], coord[1], 1000],style: {radius: 1800.0,color: color,opacity: 1,outline: true,outlineWidth: 3,outlineColor: color,clampToGround: true,},popup: "直接传参的popup",attr: { remark: "示例6" },});graphicLayer.addGraphic(graphic);},test07AddBoxLayer() {const graphicLayer = new mars3d.layer.GraphicLayer({zIndex: 20});this.map.addLayer(graphicLayer);const graphic = new mars3d.graphic.BoxEntity({position: new mars3d.LngLatPoint(104.165735, 30.759462, 1000),style: {dimensions: new Cesium.Cartesian3(2000.0, 2000.0, 2000.0),fill: true,color: "#00ffff",opacity: 0.9,heading: 45,roll: 45,pitch: 0,},attr: { remark: "示例5" },});graphicLayer.addGraphic(graphic);},test08AddCylinderLayer() {const graphicLayer = new mars3d.layer.GraphicLayer({zIndex: 20});this.map.addLayer(graphicLayer);const graphic = new mars3d.graphic.CylinderEntity({position: [104.265735, 30.759462, 1000],style: {length: 3000.0,topRadius: 0.0,bottomRadius: 1300.0,color: "#00FFFF",opacity: 0.7,},popup: "直接传参的popup",attr: { remark: "示例7" },});graphicLayer.addGraphic(graphic);},test09AddPolylineVolumeLayer() {const graphicLayer = new mars3d.layer.GraphicLayer({zIndex: 20});this.map.addLayer(graphicLayer);const graphic = new mars3d.graphic.PolylineVolumeEntity({positions: [[103.965735, 30.759462, 1000],[103.975735, 30.81, 1000],[103.985735, 30.79, 1000],],style: {shape: "pipeline",radius: 80,color: "#3388ff",opacity: 0.9,},attr: { remark: "示例11" },});graphicLayer.addGraphic(graphic);},test10SetCenter(coord, color) {this.map.setCameraView(coord);},test11AddTerrainLayer() {this.map.setCameraView({lng: 104.803391, lat: 31.376588, alt: 539.5,heading:273.6,pitch:-40.1});const layer = new mars3d.layer.XyzLayer({url: "/terrainresource/xxx/{z}/{x}/{y}.png",zIndex: 1,});this.map.addLayer(layer);}}};
</script><style lang="scss">.mars3dMapUsageClass {}.overdelay1 {position: absolute;border: 1px greenyellow solid;width: 200px;height: 50px;}
</style>

绘制卫星地图 + 地图标注

执行效果如下 

二维地图 + 地图标注

执行效果如下 

绘制点线面园 

执行效果如下 

卫星地图 + 地图标注 + 点线面园 

执行效果如下 

地形资源页面

执行效果如下 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/562920.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

I2C系列(三):软件模拟I2C读写24C04

一.目标 PC 端的串口调试软件通过 RS-485 与单片机通信&#xff0c;控制单片机利用软件模拟 I2C 总线对 EEPROM&#xff08;24C04&#xff09; 进行任意读写。 二.RS-485简述 在工业控制领域&#xff0c;传输距离越长&#xff0c;要求抗干扰能力也越强。由于 RS-232 无法消除…

HTTP(2)

HTTP 通信过程包括从客户端发往服务器端的请求及从服务器端返回客户端的响应。 那么请求和响应是怎样运作的呢 HTTP 报文 用于 HTTP 协议交互的信息被称为 HTTP 报文。 请求端&#xff08;客户端&#xff09;的HTTP 报文叫做请求报文&#xff0c;响应端&#xff08;服务器…

OpenCV学习笔记(十一)——利用Sobel算子计算梯度

Sobel算子是基于一阶导数的离散差分算子&#xff0c;其中Sobel对于像素值的变化是十分敏感的&#xff0c;在进行边缘检测的时候&#xff0c;Sobel算子常用于对周围像素的重要性进行检测。 Sobel算子包括检验水平方向的算子和检测竖直方向的算子 计算机梯度值的操作如下&#x…

C#,图论与图算法,用于检查给定图是否为欧拉图(Eulerian Graph)的算法与源程序

1 欧拉图 欧拉图是指通过图(无向图或有向图)中所有边且每边仅通过一次通路, 相应的回路称为欧拉回路。具有欧拉回路的图称为欧拉图(Euler Graph), 具有欧拉通路而无欧拉回路的图称为半欧拉图。 对欧拉图的一个现代扩展是蜘蛛图,它向欧拉图增加了可以连接的存在点。 这给…

零基础-MySQL数据库的基本操作

①MYSQL数据库基本操作-DDL 1.DDL的解释 DDL&#xff08;Data Definition Language&#xff09;&#xff0c;数据定义语言&#xff0c;包括以下内容&#xff1a; 对数据库的常用操作 对表结构的常用操作 修改表结构 2.对数据库的常用操作 功能SQL查看所有的数据库show d…

从产品组装和维护/维修的角度来看,基于增强现实的指导:关于挑战和机遇的最新综述

作者&#xff1a; 1. M. Eswaran 2. Anil Kumar Gulivindala 3. M.V.A.Raju Bahubalendruni 关于本文 •分析了增强现实在装配和维护/维修中的作用。 •讨论了AR辅助制造系统的软件和硬件元素。 •讨论了AR跟踪和配准技术面临的挑战。 •讨论了AR辅助制造系统的未来…

GDC期间LayaAir启动全球化战略

3 月 18 日至 3 月 22 日&#xff0c;一年一度的游戏开发者大会&#xff08;GDC&#xff09;在美国旧金山举行。在此期间&#xff0c;Layabox宣布LayaAir引擎启动全球扩张战略&#xff0c;这标志着引擎将步入快速发展的新阶段。此举旨在利用公司先进的3D引擎技术&#xff0c;将…

【小沐学Python】Python实现Web图表功能(Lux)

文章目录 1、简介2、安装3、测试3.1 入门示例3.2 入门示例2 结语 1、简介 https://github.com/lux-org/lux 用于智能可视化发现的 Python API Lux 是一个 Python 库&#xff0c;通过自动化可视化和数据分析过程来促进快速简便的数据探索。通过简单地在 Jupyter 笔记本中打印出…

【redis】服务器架构演进

架构演进 单机架构应用数据分离架构应⽤服务集群架构读写分离 / 主从分离架构冷热分离架构垂直分库微服务架构 单机架构 所有的应用服务、业务所需的数据、业务处理等都在一台服务器上。 在初期&#xff0c;用户访问量很少&#xff0c;对服务器的的性能和安全没有很高的要求&am…

NFT交易市场-后端开发

首先我们需要配置好我们的ipfs&#xff0c;参考官方文档 1.https://docs.ipfs.tech/install/command-line/#system-requirementshttps://docs.ipfs.tech/how-to/command-line-quick-start/#initialize-the-repository 首先新建一个文件夹 然后在终端输入npm init -y命令进行初…

H5实现Web ECharts教程:轻松创建动态数据图表

&#x1f31f; 前言 欢迎来到我的技术小宇宙&#xff01;&#x1f30c; 这里不仅是我记录技术点滴的后花园&#xff0c;也是我分享学习心得和项目经验的乐园。&#x1f4da; 无论你是技术小白还是资深大牛&#xff0c;这里总有一些内容能触动你的好奇心。&#x1f50d; &#x…

智慧公厕:跨界融合,打造智慧城市新名片

随着城市化进程的不断加快&#xff0c;公共厕所建设成为一个亟待解决的问题。传统的公厕存在着管理繁琐、卫生差、服务不到位等一系列问题&#xff0c;与城市发展的节奏不协调。为此&#xff0c;推进新型智慧公厕建设成为了一个重要的解决方案。智慧公厕的建设需要推进技术融合…