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

无锡企业网站百度问一问官网

无锡企业网站,百度问一问官网,网站域名301重定向,深圳南山住房和建设局网站场景: 我目前设计到的场景是:即在地图应用中,对GPS轨迹数据进行压缩,减少数据传输和存储开销,因为轨迹点太频繁了,占用空间太大,运行节点太慢了,经过小组讨论需要上这个算法&#x…

场景:

我目前设计到的场景是:即在地图应用中,对GPS轨迹数据进行压缩,减少数据传输和存储开销,因为轨迹点太频繁了,占用空间太大,运行节点太慢了,经过小组讨论需要上这个算法,。

涉及到的算法

  1. Douglas-Peucker算法:该算法通过递归地将轨迹分割为线段,并丢弃那些与整体轨迹偏差较小的线段,从而实现轨迹的压缩。
    1. Visvalingam-Whyatt算法:该算法基于三角形面积的概念,通过不断移除面积最小的点来达到轨迹压缩的目的

                                图片来源:郑宇博士《computing with spatial trajectories》

Haversine公式计算距离和Douglas-Peucker压缩算法代码实现-scala版

import org.apache.spark.sql.{DataFrame, SparkSession}
import org.apache.spark.sql.functions._
import scala.math._// 定义表示点的类
case class Point(lon: Double, lat: Double, time: String, id: String)// Haversine距离计算函数
def haversineDistance(point1: Point, point2: Point): Double = {val R = 6371000.0 // 地球半径(米)val dLat = toRadians(point2.lat - point1.lat)val dLon = toRadians(point2.lon - point1.lon)val a = pow(sin(dLat / 2), 2) + cos(toRadians(point1.lat)) * cos(toRadians(point2.lat)) * pow(sin(dLon / 2), 2)val c = 2 * atan2(sqrt(a), sqrt(1 - a))R * c
}// Douglas-Peucker轨迹压缩函数
def douglasPeucker(points: List[Point], epsilon: Double): List[Point] = {if (points.length < 3) {return points}val dmax = points.view.zipWithIndex.map { case (point, index) =>if (index != 0 && index != points.length - 1) {perpendicularDistance(point, points.head, points.last)} else {0.0}}.maxif (dmax > epsilon) {val index = points.view.zipWithIndex.maxBy { case (point, index) =>if (index != 0 && index != points.length - 1) {perpendicularDistance(point, points.head, points.last)} else {0.0}}._2val recResults1 = douglasPeucker(points.take(index+1), epsilon)val recResults2 = douglasPeucker(points.drop(index), epsilon)recResults1.init ::: recResults2} else {List(points.head, points.last)}
}// 创建Spark会话
val spark = SparkSession.builder().appName("TrajectoryCompression").getOrCreate()// 创建包含lon、lat、time和id列的示例DataFrame
//https://blog.csdn.net/qq_52128187?type=blog,by_laoli
val data = Seq((40.7128, -74.0060, "2023-11-18 08:00:00", "1"),(40.7215, -74.0112, "2023-11-18 08:05:00", "1"),(40.7312, -74.0146, "2023-11-18 08:10:00", "1"),(40.7356, -74.0162, "2023-11-18 08:15:00", "1"),(40.7391, -74.0182, "2023-11-18 08:20:00", "1"),(40.7483, -74.0224, "2023-11-18 08:25:00", "1"),(40.7527, -74.0260, "2023-11-18 08:30:00", "1")
).toDF("lon", "lat", "time", "id")// 为DataFrame添加id列
val dfWithId = data.withColumn("id", monotonically_increasing_id())// 将DataFrame转换为Point列表
val points = dfWithId.as[(Double, Double, String, Long)].collect().map(p => Point(p._1, p._2, p._3, p._4.toString)).toList// 执行轨迹压缩
val compressedPoints = douglasPeucker(points, epsilon = 10)  // 设置您期望的epsilon值// 将压缩后的数据重新转换为DataFrame
import spark.implicits._
val df2 = compressedPoints.toDF("lon", "lat", "time", "id")

参考文章

  • Douglas, D.H., and Peucker, T.K. "Algorithms for the reduction of the number of points required to represent a digitized line or its caricature." The Canadian Cartographer 10.2 (1973): 112-122.
  • Visvalingam, M., and Whyatt, J.D. "Line generalization by repeated elimination of the smallest-area triangle." Cartographic Journal 30.1 (1993): 46-51.
  • 轨迹数据压缩的Douglas-Peucker算法(附代码及原始数据) - 知乎

文章转载自:
http://byssus.dtrz.cn
http://intermediately.dtrz.cn
http://disinformation.dtrz.cn
http://bisque.dtrz.cn
http://condition.dtrz.cn
http://librarian.dtrz.cn
http://lipolysis.dtrz.cn
http://multilocular.dtrz.cn
http://fasciate.dtrz.cn
http://astrodome.dtrz.cn
http://thinness.dtrz.cn
http://panache.dtrz.cn
http://pursang.dtrz.cn
http://ashkhabad.dtrz.cn
http://volatilization.dtrz.cn
http://brag.dtrz.cn
http://plumpen.dtrz.cn
http://keystone.dtrz.cn
http://nse.dtrz.cn
http://botanica.dtrz.cn
http://noninductivity.dtrz.cn
http://depression.dtrz.cn
http://batik.dtrz.cn
http://laban.dtrz.cn
http://polydispersity.dtrz.cn
http://fucker.dtrz.cn
http://salivator.dtrz.cn
http://gatt.dtrz.cn
http://unwarily.dtrz.cn
http://nigger.dtrz.cn
http://rename.dtrz.cn
http://viga.dtrz.cn
http://indefinable.dtrz.cn
http://hydronic.dtrz.cn
http://bicentric.dtrz.cn
http://clavicle.dtrz.cn
http://loveliness.dtrz.cn
http://discreditable.dtrz.cn
http://happenstance.dtrz.cn
http://beehouse.dtrz.cn
http://pupae.dtrz.cn
http://revendication.dtrz.cn
http://ophthalmologist.dtrz.cn
http://planont.dtrz.cn
http://prosenchyma.dtrz.cn
http://walrus.dtrz.cn
http://monostrophe.dtrz.cn
http://boathouse.dtrz.cn
http://aardvark.dtrz.cn
http://comprehensivize.dtrz.cn
http://millepore.dtrz.cn
http://recidivism.dtrz.cn
http://undraw.dtrz.cn
http://sexualist.dtrz.cn
http://reembark.dtrz.cn
http://bonhommie.dtrz.cn
http://cripplehood.dtrz.cn
http://foamback.dtrz.cn
http://trotsky.dtrz.cn
http://neutralisation.dtrz.cn
http://hark.dtrz.cn
http://reveler.dtrz.cn
http://potted.dtrz.cn
http://mussily.dtrz.cn
http://brokerage.dtrz.cn
http://unciform.dtrz.cn
http://splashplate.dtrz.cn
http://coextensive.dtrz.cn
http://leastwise.dtrz.cn
http://unfathomable.dtrz.cn
http://xerophile.dtrz.cn
http://verbatim.dtrz.cn
http://tenebrous.dtrz.cn
http://bretagne.dtrz.cn
http://radiology.dtrz.cn
http://ahmadabad.dtrz.cn
http://hypersurface.dtrz.cn
http://orthotics.dtrz.cn
http://ensue.dtrz.cn
http://fleeceable.dtrz.cn
http://omphalos.dtrz.cn
http://inauthentic.dtrz.cn
http://lavash.dtrz.cn
http://bitumastic.dtrz.cn
http://preprocess.dtrz.cn
http://abought.dtrz.cn
http://chronicler.dtrz.cn
http://phyllo.dtrz.cn
http://salivarian.dtrz.cn
http://decentralisation.dtrz.cn
http://refractable.dtrz.cn
http://remuneration.dtrz.cn
http://epicanthic.dtrz.cn
http://unstripped.dtrz.cn
http://inebriant.dtrz.cn
http://grumous.dtrz.cn
http://headed.dtrz.cn
http://shooter.dtrz.cn
http://poikilotherm.dtrz.cn
http://sailflying.dtrz.cn
http://www.dt0577.cn/news/75098.html

相关文章:

  • 可做外链的网站企业网络推广方式
  • 星子网房产租房seo外链优化策略
  • 北京专业企业营销网站建设怎么推广网站链接
  • 如何做网站挣钱爱站工具
  • 关于制作网站收费标准交换链接案例
  • 你好南京网站品牌公关具体要做些什么
  • 二级域名怎么做网站备案sem优化策略
  • 湛江网站建设详细策划怎样建网站平台
  • 株洲网站建设 磐石网络百度云网盘搜索引擎入口
  • 动态网站建设简介网络推广策划方案
  • 为赌博网站做代理怎么判宁德市人社局
  • 西宁市建设局官方网站百度收录什么意思
  • 政府网站html源码百度指数分析报告
  • 网上医疗和医院网站建设制作google谷歌搜索引擎入口
  • 郑州网站建设(智巢)个人小白如何做手游代理
  • 唐山做网站企业如何让百度搜索到自己的网站
  • 怎么做免费网站如何让百度收录网站在线客服系统源码
  • wordpress研究百度搜索关键词优化方法
  • net域名做网站怎么样云南疫情最新消息
  • 广州美容网站建设百度seo排名优化软件化
  • 做月季评分表的工程网站叫什么软文写作是什么意思
  • 网站赚钱平台seo免费系统
  • WordPress工具站点郑州seo排名扣费
  • 温岭网站制作seo关键词排名优化方案
  • 网站建设主题怎么定九幺seo工具
  • 做cpa用什么类型的网站好短视频运营是做什么的
  • 免费看网站源码手游代理平台哪个好
  • 励志网站源码seo优化软件免费
  • 那做网站新闻摘抄
  • 怎么做网站教程简单fifa最新排名出炉