cesium vue 天地图 WMTS图层数据 绘制点、线、面 测距、测面积

article/2025/9/21 10:31:49

cesium vue 绘制点、线、面 测距、测面积
开箱即用
在这里插入图片描述

<template><div class="map-container"><div class="btn-container"><el-button type="primary" @click="drawSelf('Point')">绘制点</el-button><el-button type="primary"  @click="drawSelf('Polyline')">绘制线</el-button><el-button type="primary"  @click="drawSelf('Polygon')">绘制面</el-button></div><div class="btn-container"><el-button type="primary" @click="draw('Polyline')">标点测距</el-button><el-button type="primary" @click="draw('Polygon')">标点测面</el-button><el-button type="primary" @click="clearAllDrawn()">清空数据</el-button></div><div class="btn-container"></div><p>点击鼠标左键标点,右键结束</p><div id="cesiumContainer"></div></div>
</template><script>
import * as Cesium from "cesium";
import  {Cesium3DTileset, Viewer, WebMapTileServiceImageryProvider} from "cesium";
export default {name: 'App',data () {return {tempEntities: [],pointNum: 0,floatingPoint: undefined,activeShape: undefined,viewer: undefined,roadData:[],Cesium}},mounted () {this.Init()this.init3Dtiles()},methods: {/* 初始化 */Init () {const tianDiTuToken = '天地图token'const mapOption = {url: `http://t0.tianditu.com/img_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=img&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default&format=tiles&tk=${tianDiTuToken}`,layer: "tdtBasicLayer",style: "default",format: "image/jpeg",tileMatrixSetID: "GoogleMapsCompatible",level:14,maximumLevel: 18}const imgProvider = new WebMapTileServiceImageryProvider(mapOption);const viewerOption = {animation: false,//是否创建动画小器件,左下角仪表baseLayerPicker: true,//是否显示图层选择器fullscreenButton: false,//是否显示全屏按钮geocoder: true,//是否显示geocoder小器件,右上角查询按钮homeButton: false,//是否显示Home按钮infoBox: false,//是否显示信息框sceneModePicker: false,//是否显示3D/2D选择器scene3DOnly: false,//如果设置为true,则所有几何图形以3D模式绘制以节约GPU资源selectionIndicator: false,//是否显示选取指示器组件timeline: false,//是否显示时间轴navigationHelpButton: false,//是否显示右上角的帮助按钮baselLayerPicker: false,// 将图层选择的控件关掉,才能添加其他影像数据shadows: false,//是否显示背影shouldAnimate: true,imageryProvider: imgProvider,}this.viewer = new Viewer("cesiumContainer", viewerOption);// 添加中文注记图层this.viewer.imageryLayers.addImageryProvider(new WebMapTileServiceImageryProvider({url: `http://t0.tianditu.com/cia_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=cia&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default.jpg&tk=${tianDiTuToken}`,layer: "tdtAnnoLayer",style: "default",format: "image/jpeg",tileMatrixSetID: "GoogleMapsCompatible",//   show: false,}));//优化项--关闭相关特效this.viewer.scene.debugShowFramesPerSecond = true;//显示fpsthis.viewer.scene.moon.show = false;//月亮this.viewer.scene.fog.enabled = false;//雾this.viewer.scene.sun.show = false;//太阳this.viewer.scene.skyBox.show = false;//天空盒this.viewer.resolutionScale = 1.0;//画面细度,默认值为1.0},init3Dtiles(){let provider = new Cesium.WebMapTileServiceImageryProvider({url: 'http://pan.ifunpm.com/image/wmts/5EEBP6px/{z}/{x}/{y}', //服务地址WMTSlayer: '', //图层名称style: '',format: 'image/png',tileMatrixSetID: "EPSG:900913",  // "EPSG:900913"// 地图飞入  定位的坐标  后端返回的数据rectangle: Cesium.Rectangle.fromDegrees(112.8308, 28.2280, 112.8458, 28.2412),//之所以要在这里提出这个tileMatrixLabels参数,是因为GeoServer在缓冲切分瓦片时对每一个缩放级别的存储目录没有使用相应的数字,而使用了网格+级别的方式来命名,如“EPSG:9100913:10”表示的是使用“EPSG:9100913”网格切分的第10级瓦片。tileMatrixLabels : [],tilingScheme: new Cesium.GeographicTilingScheme({numberOfLevelZeroTilesX: 2,numberOfLevelZeroTilesY: 1}),maximumLevel: 18 });let layer = this.viewer.imageryLayers.addImageryProvider(provider);//控制图层显示this.viewer.flyTo(layer, {duration: 2});},/* 空间两点距离计算函数 */getLength (start, end) {// 将起点与终点位置信息从笛卡尔坐标形式转换为Cartographic形式let startCartographic = Cesium.Cartographic.fromCartesian(start)let endCartographic = Cesium.Cartographic.fromCartesian(end)// 初始化测地线let geodesic = new Cesium.EllipsoidGeodesic()// 设置测地线起点和终点,EllipsoidGeodesic中setEndPoints常与surfaceDistance搭配使用geodesic.setEndPoints(startCartographic, endCartographic)// 获取起点和终点之间的表面距离,单位为km,规定四舍五入保留两位小数// surfaceDistance返回number 单位为m,带小数return (geodesic.surfaceDistance / 1000).toFixed(2)},/* 空间两点计算中点函数 */getMidpoint (start, end) {let startPoint = Cesium.Cartographic.fromCartesian(start)let endPoint = Cesium.Cartographic.fromCartesian(end)let geodesic = new Cesium.EllipsoidGeodesic()geodesic.setEndPoints(startPoint, endPoint)let geoPoint = geodesic.interpolateUsingFraction(0.5)return Cesium.Ellipsoid.WGS84.cartographicToCartesian(geoPoint)},addLabel (midPoint, labelLength) {let viewer = this.viewerreturn viewer.entities.add({name: '中点',position: midPoint,label: {text: labelLength + 'km',font: '20px sans-serif',fillColor: Cesium.Color.WHITE,outlineWidth: 2,backgroundColor: Cesium.Color.BLACK,showBackground: true,style: Cesium.LabelStyle.FILL,verticalOrigin: Cesium.VerticalOrigin.BOTTOM,horizontalOrigin: Cesium.HorizontalOrigin.CENTER,heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,disableDepthTestDistance: Number.POSITIVE_INFINITY // 不被建筑物遮挡}})},/* 测量空间面积 */// 方向Bearing (from, to) {let fromCartographic = Cesium.Cartographic.fromCartesian(from)let toCartographic = Cesium.Cartographic.fromCartesian(to)let lat1 = fromCartographic.latitudelet lon1 = fromCartographic.longitudelet lat2 = toCartographic.latitudelet lon2 = toCartographic.longitudelet angle = -Math.atan2(Math.sin(lon1 - lon2) * Math.cos(lat2), Math.cos(lat1) * Math.sin(lat2) - Math.sin(lat1) * Math.cos(lat2) * Math.cos(lon1 - lon2))if (angle < 0) {angle += Math.PI * 2.0}return angle},// 角度pointAngle (point1, point2, point3) {let bearing21 = this.Bearing(point2, point1)let bearing23 = this.Bearing(point2, point3)let angle = bearing21 - bearing23if (angle < 0) {angle += Math.PI * 2.0}return angle},getArea (positions) {let res = 0for (let i = 0; i < positions.length - 2; i++) {let j = (i + 1) % positions.lengthlet k = (i + 2) % positions.lengthlet totalAngle = this.pointAngle(positions[i], positions[j], positions[k])let tempLength1 = this.getLength(positions[j], positions[0])let tempLength2 = this.getLength(positions[k], positions[0])res += tempLength1 * tempLength2 * Math.sin(totalAngle) / 2}res = res.toFixed(2)res = parseFloat(res)return Math.abs(res)},addArea (area, positions) {let viewer = this.viewerreturn viewer.entities.add({name: '多边形面积',position: positions[positions.length - 1],label: {text: area + '平方公里',font: '20px sans-serif',fillColor: Cesium.Color.WHITE,outlineWidth: 2,backgroundColor: Cesium.Color.BLACK,showBackground: true,style: Cesium.LabelStyle.FILL,pixelOffset: new Cesium.Cartesian2(60, -60),verticalOrigin: Cesium.VerticalOrigin.BOTTOM,horizontalOrigin: Cesium.HorizontalOrigin.CENTER,heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,disableDepthTestDistance: Number.POSITIVE_INFINITY}})},/* 绘制函数 */drawPointLabel (position, pointNum) {let viewer = this.viewer// 本质上就是添加一个点的实体return viewer.entities.add({name: '点几何对象',position: position,point: {color: Cesium.Color.WHEAT,pixelSize: 5,outlineWidth: 3,disableDepthTestDistance: Number.POSITIVE_INFINITY, //heightReference: Cesium.HeightReference.CLAMP_TO_GROUND // 规定贴地},label: {text: pointNum,font: '30px sans-serif',fillColor: Cesium.Color.WHITE,outlineWidth: 2,backgroundColor: Cesium.Color.BLACK,showBackground: true,style: Cesium.LabelStyle.FILL,disableDepthTestDistance: Number.POSITIVE_INFINITY,verticalOrigin: Cesium.VerticalOrigin.BOTTOM,horizontalOrigin: Cesium.HorizontalOrigin.CENTER}})},drawPoint (position) {let viewer = this.viewer// 本质上就是添加一个点的实体return viewer.entities.add({position: position,point: {color: Cesium.Color.WHEAT,pixelSize: 5,outlineWidth: 3,disableDepthTestDistance: Number.POSITIVE_INFINITY,heightReference: Cesium.HeightReference.CLAMP_TO_GROUND // 规定贴地}})},drawPolyline (positions) {let viewer = this.viewerif (positions.length < 1) returnreturn viewer.entities.add({name: '线几何对象',polyline: {positions: positions,width: 5.0,material: new Cesium.PolylineGlowMaterialProperty({// eslint-disable-next-line new-capcolor: Cesium.Color.WHEAT}),depthFailMaterial: new Cesium.PolylineGlowMaterialProperty({// eslint-disable-next-line new-capcolor: Cesium.Color.WHEAT}),clampToGround: true}})},drawPolygon (positions) {let viewer = this.viewerif (positions.length < 2) returnreturn viewer.entities.add({name: '面几何对象',polygon: {hierarchy: positions,// eslint-disable-next-line new-capmaterial: new Cesium.ColorMaterialProperty(Cesium.Color.WHEAT.withAlpha(0.4))}})},/* 清除实体 */clearAllDrawn () {let viewer = this.viewerthis.tempEntities = []this.pointNum = 0viewer.entities.removeAll()},drawSelf(type){let that = thislet viewer = this.viewerlet position= []let tempPointsSelf = []let tempEntitiesSelf = []// 开启深度检测viewer.scene.globe.depthTestAgainstTerrain = true// 创建场景的HTML canvas元素let handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas)switch (type) {case 'Point':// 监听鼠标左键 左键单击开始绘制handler.setInputAction(function (movement) {// 从相机位置创建一条射线,这条射线通过世界中movement.position像素所在的坐标let ray = viewer.camera.getPickRay(movement.position)// 找到射线与渲染的地球表面之间的交点。射线必须以世界坐标给出。position = viewer.scene.globe.pick(ray, viewer.scene)// 画出交点let point = that.drawPoint(position)// // 将其添加到tempEntities数组的末尾// tempEntities.push(point)}, Cesium.ScreenSpaceEventType.LEFT_CLICK)// 左键双击或右键单击时停止绘制handler.setInputAction(function () {// 停止监听 关闭事件句柄handler.destroy()handler = null}, Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK)handler.setInputAction(function () {handler.destroy()handler = null}, Cesium.ScreenSpaceEventType.RIGHT_CLICK)breakcase 'Polyline':// 监听鼠标移动handler.setInputAction(function (movement) {}, Cesium.ScreenSpaceEventType.MOUSE_MOVE)// 左键单击开始画线handler.setInputAction(function (click) {// 获取位置信息let ray = viewer.camera.getPickRay(click.position)position = viewer.scene.globe.pick(ray, viewer.scene)tempPointsSelf.push(position) // 记录点位let tempLength = tempPointsSelf.length // 记录点数// 调用绘制点的接口let point = that.drawPoint(tempPointsSelf[tempPointsSelf.length - 1])tempEntitiesSelf.push(point)// 存在超过一个点时if (tempLength > 1) {// 绘制线let pointline = that.drawPolyline([tempPointsSelf[tempPointsSelf.length - 2], tempPointsSelf[tempPointsSelf.length - 1]])tempEntitiesSelf.push(pointline) // 保存记录}}, Cesium.ScreenSpaceEventType.LEFT_CLICK)// 右键单击结束画线handler.setInputAction(function (click) {tempPointsSelf = [] // 清空点位记录handler.destroy()handler = null}, Cesium.ScreenSpaceEventType.RIGHT_CLICK)break  case 'Polygon':// 取消鼠标双击事件viewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK)// 监听鼠标移动handler.setInputAction(function (movement) {}, Cesium.ScreenSpaceEventType.MOUSE_MOVE)// 左键单击开始画线handler.setInputAction(function (click) {// 获取位置信息let ray = viewer.camera.getPickRay(click.position)position = viewer.scene.globe.pick(ray, viewer.scene)tempPointsSelf.push(position) // 记录点位let tempLength = tempPointsSelf.length // 记录点数// 调用绘制点的接口let point = that.drawPoint(tempPointsSelf[tempPointsSelf.length - 1])tempEntitiesSelf.push(point)// 存在超过一个点时if (tempLength > 1) {// 绘制线let pointline = that.drawPolyline([tempPointsSelf[tempPointsSelf.length - 2], tempPointsSelf[tempPointsSelf.length - 1]])tempEntitiesSelf.push(pointline) // 保存记录}}, Cesium.ScreenSpaceEventType.LEFT_CLICK)// 右键单击结束画面handler.setInputAction(function (click) {// 选择一个椭球或地图let cartesian = viewer.camera.pickEllipsoid(click.position, viewer.scene.globe.ellipsoid)if (cartesian) {let tempLength = tempPointsSelf.lengthif (tempLength < 3) {alert('闭合操作需要至少3个点!')} else {// 闭合最后一条线let pointline = that.drawPolyline([tempPointsSelf[tempPointsSelf.length - 1], tempPointsSelf[0]])tempEntitiesSelf.push(pointline)that.drawPolygon(tempPointsSelf)tempEntitiesSelf.push(tempPointsSelf)handler.destroy()handler = null}}}, Cesium.ScreenSpaceEventType.RIGHT_CLICK)break  }},/* 根据类型绘制对象* @param type point polyline polygon */draw (type) {let that = thislet viewer = this.viewerlet tempEntities = this.tempEntitieslet floatingPoint = this.floatingPointlet activeShape = this.activeShapelet position = []let tempPoints = []let activeShapePoints = []// 开启深度检测viewer.scene.globe.depthTestAgainstTerrain = true// 创建场景的HTML canvas元素let handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas)switch (type) {// 绘制线case 'Polyline':// 取消鼠标双击事件viewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK)// 监听鼠标移动handler.setInputAction(function (movement) {if (Cesium.defined(floatingPoint)) {let newPosition = viewer.scene.pickPosition(movement.endPosition)if (Cesium.defined(newPosition)) {floatingPoint.position.setValue(newPosition)activeShapePoints.pop()activeShapePoints.push(newPosition)}}}, Cesium.ScreenSpaceEventType.MOUSE_MOVE)// 左键单击开始画线handler.setInputAction(function (click) {let earthPosition = viewer.scene.pickPosition(click.position)if (Cesium.defined(earthPosition)) {floatingPoint = that.drawPoint(earthPosition)}// 获取位置信息// 从相机位置创建一条射线,这条射线通过世界中movement.position像素所在的坐标,返回Cartesian3坐标let ray = viewer.camera.getPickRay(click.position)// 找到射线与渲染的地球表面之间的交点。射线必须以世界坐标给出。返回Cartesian3坐标position = viewer.scene.globe.pick(ray, viewer.scene)tempPoints.push(position) // 记录点位that.pointNum += 1let tempLength = tempPoints.length // 记录点数// 调用绘制点的接口let point = that.drawPointLabel(tempPoints[tempPoints.length - 1], JSON.stringify(that.pointNum))tempEntities.push(point)// 存在超过一个点时if (tempLength > 1) {// 绘制线let pointLength = that.getLength(tempPoints[tempPoints.length - 2], tempPoints[tempPoints.length - 1])let midPosition = that.getMidpoint(tempPoints[tempPoints.length - 2], tempPoints[tempPoints.length - 1])let pointline = that.drawPolyline([tempPoints[tempPoints.length - 2], tempPoints[tempPoints.length - 1]])let pointLabel = that.addLabel(midPosition, pointLength)tempEntities.push(pointline) // 保存记录tempEntities.push(pointLabel)}}, Cesium.ScreenSpaceEventType.LEFT_CLICK)// 右键单击结束画线handler.setInputAction(function (click) {activeShapePoints.pop()viewer.entities.remove(activeShapePoints)viewer.entities.remove(floatingPoint)tempPoints = [] // 清空点位记录handler.destroy()handler = nullfloatingPoint = undefinedactiveShape = undefinedactiveShapePoints = []}, Cesium.ScreenSpaceEventType.RIGHT_CLICK)break// 绘制面case 'Polygon':// 取消鼠标双击事件viewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK)// 监听鼠标移动handler.setInputAction(function (movement) {if (Cesium.defined(floatingPoint)) {let newPosition = viewer.scene.pickPosition(movement.endPosition)if (Cesium.defined(newPosition)) {floatingPoint.position.setValue(newPosition)activeShapePoints.pop()activeShapePoints.push(newPosition)}}}, Cesium.ScreenSpaceEventType.MOUSE_MOVE)// 左键单击开始画线handler.setInputAction(function (click) {let earthPosition = viewer.scene.pickPosition(click.position)if (Cesium.defined(earthPosition)) {if (activeShapePoints.length === 0) {floatingPoint = that.drawPoint(earthPosition)activeShapePoints.push(earthPosition)const dynamicPositions = new Cesium.CallbackProperty(function () {return new Cesium.PolygonHierarchy(activeShapePoints)}, false)activeShape = that.drawPolygon(dynamicPositions)}activeShapePoints.push(earthPosition)}// 获取位置信息let ray = viewer.camera.getPickRay(click.position)position = viewer.scene.globe.pick(ray, viewer.scene)tempPoints.push(position) // 记录点位let tempLength = tempPoints.length // 记录点数that.pointNum += 1// 调用绘制点的接口let point = that.drawPointLabel(tempPoints[tempPoints.length - 1], JSON.stringify(that.pointNum))tempEntities.push(point)// 存在超过一个点时if (tempLength > 1) {// 绘制线let pointline = that.drawPolyline([tempPoints[tempPoints.length - 2], tempPoints[tempPoints.length - 1]])tempEntities.push(pointline) // 保存记录}}, Cesium.ScreenSpaceEventType.LEFT_CLICK)// 右键单击结束画面handler.setInputAction(function (click) {// 选择一个椭球或地图let cartesian = viewer.camera.pickEllipsoid(click.position, viewer.scene.globe.ellipsoid)if (cartesian) {let tempLength = tempPoints.lengthif (tempLength < 3) {alert('闭合操作需要至少3个点!')} else {// 闭合最后一条线let pointline = that.drawPolyline([tempPoints[0], tempPoints[tempPoints.length - 1]])tempEntities.push(pointline)that.drawPolygon(tempPoints)let pointArea = that.getArea(tempPoints)that.addArea(JSON.stringify(pointArea), tempPoints)tempEntities.push(tempPoints)handler.destroy()handler = null}}activeShapePoints.pop()viewer.entities.remove(activeShapePoints)viewer.entities.remove(floatingPoint)floatingPoint = undefinedactiveShapePoints = []}, Cesium.ScreenSpaceEventType.RIGHT_CLICK)break}}}
}
</script><style>
canvas{
width:1200px;
height:600px;
margin: 20px;
}
.cesium-performanceDisplay,.cesium-viewer-bottom{display: none;
}
</style>
<style lang="scss" scoped>
.map-container{width:100%;height:100%;padding:20px;
}
.btn-container{margin-bottom:20px;
}
</style>

http://chatgpt.dhexx.cn/article/Rk83jpFx.shtml

相关文章

百度地图实现测量面积和测量距离功能

最近在公司的项目中&#xff0c;需要用到百度地图的测距和测面积功能&#xff0c;但是在网上只找到了测量距离的api&#xff0c;即BMapLib.DistanceTool。 但是测面积在网上没有找到很好的资料&#xff0c;百度提供的DrawingManager虽然也可以实现测面积&#xff0c;但是感觉太…

测量面积的手机软件有哪些?这两个不能错过

测量面积的手机软件有哪些&#xff1f;相信很多小伙伴&#xff0c;在日常生活中遇到了场地面积测量的问题总是犯难&#xff0c;如果身边有工具还是可以的&#xff0c;就怕身边没有测量的工具&#xff0c;这样一来不仅仅没办法去操作得到我们想要的数值&#xff0c;也极大的拖累…

【Cesium】距离量测和面积量测

1 、空间量测 空间量测是在三维空间中测量距离、角度、面积等内容。实现方法为在屏幕中拾取对应点的位置&#xff0c;然后将屏幕坐标转换为地理坐标&#xff0c;再根据地球椭球参数&#xff0c;进行几何解算&#xff0c;获取地理空间距离、面积等。 1.1、 距离量测 两点之间的…

百度地图API画多边型,测面积

效果&#xff1a; 脚本&#xff1a; <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv"Content-Type" c…

cad面积计算机,AutoCAD如何测面积 AutoCAD面积计算方法

在AutoCAD运用的实例中&#xff0c;我们常常需要测量所画图形的尺寸面积&#xff0c;如果通过手算的方式总会觉得特别麻烦&#xff0c;还容易出错&#xff0c;为此小编特意为大家准备了最全面的CAD面积计算方法&#xff0c;教你如何巧妙的使用AutoCAD完成面积运算。 AutoCAD面积…

cesium工具-测距和测面-原理和代码

测距分为&#xff1a;空间距离和贴地距离&#xff1b; 测面积分为&#xff1a;水平面积和贴地面积。 下面讲解这4个工具的相关思路和代码&#xff1a; 1、空间距离 思路&#xff1a; Cesium.Cartesian3.distance()计算出两点之间的距离 一条线上的所有点&#xff0c;每2个点依次…

高德地图面积测量小工具

由于项目的需要&#xff0c;需要用到高德地图的测量面积功能&#xff0c;其实高德地图官方已经提供了测量面积的工具&#xff0c;但是感觉有点不太方便&#xff0c;于是在原来的测量面积工具的基础上进行一点补充&#xff0c;由于时间的原因&#xff0c;写的比较粗糙&#xff0…

国土面积测量问题

国土面积测量问题 如图所示一个国家的地图边界线&#xff0c;有关方面需确认国家的国土面积的数值。现在将地图放入平面直角坐标系中&#xff0c;以由西向东方向为 x 轴&#xff0c;由南向北方向为 y 轴&#xff0c;在边界上选取若干 点测出个点对应的坐标数据&#xff08;?,…

cesium面积测量

使用方法新建一个文件measureArea.js将下面代码贴上去 // DrawPolygon /* 绘制面(面积测量)*/class measureArea {constructor(arg) {this.objId Number(new Date().getTime() "" Number(Math.random() * 1000).toFixed(0));this.viewer arg.viewer;this.Cesium…

CAD快速测量面积与周长

这篇来教大家如何用CAD梦想画图快速测出规则图形与不规则图形的面积&#xff0c;首先这些图形都需要是封闭图形。 操作工具 操作系统&#xff1a;Windows10 CAD软件&#xff1a;CAD梦想画图 步骤 1.首先我们画一个规则的矩形与一个用多边形绘制的不规则封闭图形&#xff0…

openlayers测距和测面积

初次使用openlayers地图进行开发各种地图功能,测距和测面积使用的是官方例子并进行了一些简单的修改,官方示例在测量一次之后不能停止,修改后,每点击测量,只会测量一次。 而且需要注意的是,官方例子测距测面积使用的投影坐标系是3857。 js文件:measure.js import Draw…

手机测量面积的软件哪个好用?这些软件你值得收藏

相信大家在日常生活中总会遇到测量的问题&#xff0c;如果身边有测量工具还好&#xff0c;就怕恰好身边没有测量的工具&#xff0c;那就麻烦了。那有没有什么快捷的方法能够让我们迅速获得测量数据呢&#xff1f; 其实&#xff0c;现在市面上有很多面积测量软件&#xff0c;能…

cesium 实现测距离测面积 (划线画面 跟随鼠标位置 )

效果图 方法一&#xff1a;使用插件 cesium_measure.js 下载地址&#xff1a;https://github.com/zhangti0708/cesium-measure/blob/master/src/cesium-measure.js <!DOCTYPE html> <html lang"en"><head><meta charset"UTF-8"&g…

平方面积怎么测量?教你快速学会这个方法

平方面积怎么测量&#xff1f;我们平常可能很少会需要测量平方面积的&#xff0c;但是当我们装修屋子的时候&#xff0c;不可避免地需要计算各种物品的面积。只有精准的计算&#xff0c;才能减少不必要的浪费。我们可以手工测量&#xff0c;然后进行计算。我们也可以借助手机上…

QML QtLocation地图应用学习-3:实现面积测量

1.实现思路 参照网上的测面积功能&#xff0c;界面效果和测距差不多&#xff0c;在点和线的基础上多了一个填充区域。 点和线参照上一篇博客&#xff1a;https://blog.csdn.net/gongjianbo1992/article/details/103674047 填充区域使用 MapPolygon &#xff0c;但是这个类接口…

手机怎么测量物品面积?测试原理是什么?

在我们的日常生活中&#xff0c;我们常常需要测量物品的面积&#xff0c;比如房间的面积、墙壁的面积、家具的面积等等。传统的测量方法需要使用量尺或计算公式&#xff0c;不仅繁琐而且容易出现误差。而现在&#xff0c;我们可以利用手机的功能来快速、准确地测量物品的面积。…

NMF(非负矩阵分解)

NMF 1.算法概述2. 损失函数python代码 1.算法概述 NMF(Non-negative matrix factorization)&#xff0c;即对于任意给定的一个非负矩阵V&#xff0c;其能够寻找到一个非负矩阵W和一个非负矩阵H&#xff0c;满足条件VW*H,从而将一个非负的矩阵分解为左右两个非负矩阵的乘积。 …

CAUCHY NMF FOR HYPERSPECTRAL UNMIXING

J. Peng, F. Jiang, W. Sun and Y. Zhou, "Cauchy NMF for Hyperspectral Unmixing," IGARSS 2020 - 2020 IEEE International Geoscience and Remote Sensing Symposium, 2020, pp. 2384-2387, doi: 10.1109/IGARSS39084.2020.9323950. 摘要&#xff1a; 非负矩阵…

【降维之NMF】NMF(非负矩阵分解)实例

数据介绍&#xff1a;NMF人脸数据特征提取目标&#xff1a;已知 Olivetti 人脸数据共400个&#xff0c;每个数据是 64*64 大小。由于NMF分解得到的 W 矩阵相当于从原始矩阵中提取的特征&#xff0c;那么就可以使用NMF对400个人脸数据进行特征提取。 NMF 非负矩阵分解是在矩阵中…

ADMM求解优化NMF

本文拟对文章&#xff1a;“An Alternating Direction Algorithm for Matrix Completion with Nonnegative Factors”中利用ADMM进行非负矩阵分解部分进行推导。 他的 augmented Lagrangian 可写成如下形式&#xff1a; (1) (1)优化W (2)优化H: &#xff08;3&#xff09;优化…