Excel和WPS表格下CASS格式测量地形文件点按距离过滤抽稀

2024-01-25 21:20

本文主要是介绍Excel和WPS表格下CASS格式测量地形文件点按距离过滤抽稀,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

文件名:CASS格式地形文件点抽稀(Excel).rar Excel下的VBA程序,在WPS下也可以使用,打开此表格后点击表中按钮,选择CASS格式测量地形点文件,指定抽稀间距即可按距离进行点抽稀过滤。表格见下载中心。
在这里插入图片描述

Private Declare Function ShellExecute Lib "Shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As LongFunction Distance(Sx As Double, Sy As Double, Ex As Double, Ey As Double, Precision As Integer) As Double
Dim DltX As Double, DltY As Double
DltX = Ex - Sx
DltY = Ey - Sy
Distance = Round(Sqr(DltX * DltX + DltY * DltY), Precision)
End FunctionSub filter()Dim Dia1 As Object, Strr As String, PPath As StringDim filterDist As Integer '抽稀距离Dim Datums As VariantDim RowIndex As LongDim rIndex As Long, rIndex2 As Long, xa As Double, ya As Double, xb As Double, yb As DoubleRowIndex = 1filterDist = Sheet1.Cells(1, 6) '抽稀距离If filterDist = 0 Then filterDist = 2'Sheet1.Cells(1, 7) = "←F1单元格设置抽稀距离"'Sheet1.Cells(2, 7) = "(C)中国电建一二·五联合体测量队"'Sheet1.Cells(3, 7) = "雅砻江两河口水电站大坝工程"'Sheet1.Cells(4, 7) = "覃东 cehui@139.com"Sheet1.Range("A1:E10000").ClearContentsSet Dia1 = Application.FileDialog(msoFileDialogFilePicker)Dia1.Title = "版权所有(C) 中国电建一二·五联合体  覃东 QQ:61902475 Email:cehui@139.com V20160225"With Dia1.AllowMultiSelect = False '限制只能同时选择一个文件.Filters.Clear.Filters.Add "南方CASS格式", "*.dat", 1 '限制显示的文件类型.ShowFor Each vrtSelectedItem In .SelectedItemsPPath = vrtSelectedItemNextEnd WithIf Trim(PPath) <> "" ThenOpen PPath For Input As #1Do While Not EOF(1)Line Input #1, StrrIf Trim(Strr) <> "" ThenDatums = Split(Strr, ",")If UBound(Datums) = 4 ThenSheet1.Cells(RowIndex, 1) = RowIndexSheet1.Cells(RowIndex, 2) = ""Sheet1.Cells(RowIndex, 3) = Datums(2)Sheet1.Cells(RowIndex, 4) = Datums(3)Sheet1.Cells(RowIndex, 5) = Datums(4)End IfEnd IfRowIndex = RowIndex + 1LoopClose #1End If'点抽稀rIndex = 1rIndex2 = rIndex + 1
Do While Sheet1.Cells(rIndex, 1).Text <> ""If Trim(Sheet1.Cells(rIndex2, 2)) = "" Thenxa = Sheet1.Cells(rIndex, 3)ya = Sheet1.Cells(rIndex, 4)rIndex2 = rIndex + 1Do While Sheet1.Cells(rIndex2, 1).Text <> ""If (Abs(Sheet1.Cells(rIndex2, 3).Text - xa) < filterDist And Abs(Sheet1.Cells(rIndex2, 4).Text - ya) < filterDist) ThenIf Distance(xa, ya, Sheet1.Cells(rIndex2, 3).Text, Sheet1.Cells(rIndex2, 4).Text, 3) < filterDist And Trim(Sheet1.Cells(rIndex, 2)) = "" And Trim(Sheet1.Cells(rIndex2, 2)) = "" ThenSheet1.Cells(rIndex2, 2) = "T"End IfEnd IfrIndex2 = rIndex2 + 1LoopEnd IfrIndex = rIndex + 1
LoopIf Trim(PPath) <> "" ThenrIndex = 1RowIndex = 1Open Left(PPath, InStr(UCase(PPath), ".DAT") - 1) & "-抽稀(" & filterDist & "m)-" & Replace(Format(Date, "yyyy-mm-dd"), "-", "") & "-" & Replace(Time, ":", "") & ".dat" For Output As #2Do While Trim(Sheet1.Cells(rIndex, 1)) <> ""'Sheet1.Cells(5, 7) = rIndex & ":" & RowIndexIf Trim(Sheet1.Cells(rIndex, 2)) = "" ThenPrint #2, RowIndex & ",," & Format(Sheet1.Cells(rIndex, 3), "0.000") & "," & Format(Sheet1.Cells(rIndex, 4), "0.000") & "," & Format(Sheet1.Cells(rIndex, 5), "0.000")RowIndex = RowIndex + 1End IfrIndex = rIndex + 1LoopClose #2End IfSheet1.Range("B1:B10000").ClearContentsEnd Sub

在表格中添加一个按钮

在这里插入图片描述
对于删除重合地形点同样有用,只要将过滤间距设为一个很小的值如0.1即可。

这篇关于Excel和WPS表格下CASS格式测量地形文件点按距离过滤抽稀的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/644645

相关文章

深入探索协同过滤:从原理到推荐模块案例

文章目录 前言一、协同过滤1. 基于用户的协同过滤(UserCF)2. 基于物品的协同过滤(ItemCF)3. 相似度计算方法 二、相似度计算方法1. 欧氏距离2. 皮尔逊相关系数3. 杰卡德相似系数4. 余弦相似度 三、推荐模块案例1.基于文章的协同过滤推荐功能2.基于用户的协同过滤推荐功能 前言     在信息过载的时代,推荐系统成为连接用户与内容的桥梁。本文聚焦于

pandas数据过滤

Pandas 数据过滤方法 Pandas 提供了多种方法来过滤数据,可以根据不同的条件进行筛选。以下是一些常见的 Pandas 数据过滤方法,结合实例进行讲解,希望能帮你快速理解。 1. 基于条件筛选行 可以使用布尔索引来根据条件过滤行。 import pandas as pd# 创建示例数据data = {'Name': ['Alice', 'Bob', 'Charlie', 'Dav

easyui同时验证账户格式和ajax是否存在

accountName: {validator: function (value, param) {if (!/^[a-zA-Z][a-zA-Z0-9_]{3,15}$/i.test(value)) {$.fn.validatebox.defaults.rules.accountName.message = '账户名称不合法(字母开头,允许4-16字节,允许字母数字下划线)';return fal

Prompt - 将图片的表格转换成Markdown

Prompt - 将图片的表格转换成Markdown 0. 引言1. 提示词2. 原始版本 0. 引言 最近尝试将图片中的表格转换成Markdown格式,需要不断条件和优化提示词。记录一下调整好的提示词,以后在继续优化迭代。 1. 提示词 英文版本: You are an AI assistant tasked with extracting the content of

C#关闭指定时间段的Excel进程的方法

private DateTime beforeTime;            //Excel启动之前时间          private DateTime afterTime;               //Excel启动之后时间          //举例          beforeTime = DateTime.Now;          Excel.Applicat

[数据集][目标检测]血细胞检测数据集VOC+YOLO格式2757张4类别

数据集格式:Pascal VOC格式+YOLO格式(不包含分割路径的txt文件,仅仅包含jpg图片以及对应的VOC格式xml文件和yolo格式txt文件) 图片数量(jpg文件个数):2757 标注数量(xml文件个数):2757 标注数量(txt文件个数):2757 标注类别数:4 标注类别名称:["Platelets","RBC","WBC","sickle cell"] 每个类别标注的框数:

一步一步将PlantUML类图导出为自定义格式的XMI文件

一步一步将PlantUML类图导出为自定义格式的XMI文件 说明: 首次发表日期:2024-09-08PlantUML官网: https://plantuml.com/zh/PlantUML命令行文档: https://plantuml.com/zh/command-line#6a26f548831e6a8cPlantUML XMI文档: https://plantuml.com/zh/xmi

vue2实践:el-table实现由用户自己控制行数的动态表格

需求 项目中需要提供一个动态表单,如图: 当我点击添加时,便添加一行;点击右边的删除时,便删除这一行。 至少要有一行数据,但是没有上限。 思路 这种每一行的数据固定,但是不定行数的,很容易想到使用el-table来实现,它可以循环读取:data所绑定的数组,来生成行数据,不同的是: 1、table里面的每一个cell,需要放置一个input来支持用户编辑。 2、最后一列放置两个b

excel翻译软件有哪些?如何高效提翻译?

你是否曾在面对满屏的英文Excel表格时感到头疼?项目报告、数据分析、财务报表... 当这些重要的信息被语言壁垒阻挡时,效率和理解度都会大打折扣。别担心,只需3分钟,我将带你轻松解锁excel翻译成中文的秘籍。 无论是职场新人还是老手,这一技巧都将是你的得力助手,让你在信息的海洋中畅游无阻。 方法一:使用同声传译王软件 同声传译王是一款专业的翻译软件,它支持多种语言翻译,可以excel

终于解决了excel操作及cspreadsheet.h问题

困扰多日的excel操作问题终于解决:利用cspreadsheet.h!在vs2005下,不能直接应用cspreadsheet.h,所以必须解决些问题先。 首先, 出现暴多错误。解决UNICODE问题,全部添加L。 [1] +++++++++++++++++++ 其次, 出现问题: error   C2664:   &apos;SQLGetInstalledDriversW &apos;