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

做网站都需要哪些信息移动网站搭建

做网站都需要哪些信息,移动网站搭建,东莞网络营销推广专业,可以做海报的网站场景#xff1a; 我目前设计到的场景是#xff1a;即在地图应用中#xff0c;对GPS轨迹数据进行压缩#xff0c;减少数据传输和存储开销#xff0c;因为轨迹点太频繁了#xff0c;占用空间太大#xff0c;运行节点太慢了#xff0c;经过小组讨论需要上这个算法#x…场景 我目前设计到的场景是即在地图应用中对GPS轨迹数据进行压缩减少数据传输和存储开销因为轨迹点太频繁了占用空间太大运行节点太慢了经过小组讨论需要上这个算法。 涉及到的算法 Douglas-Peucker算法该算法通过递归地将轨迹分割为线段并丢弃那些与整体轨迹偏差较小的线段从而实现轨迹的压缩。 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(index1), 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?typeblog,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://www.w-s-a.com/news/778175/

相关文章:

  • 足球直播网站怎么做crm系统介绍
  • 株洲网站建设联系方式东莞凤岗网站制作
  • 小纯洁网站开发如何注册域名
  • 网上做试卷的网站如何把刚做的网站被百度抓取到
  • 滕州网站建wordpress用户中心按钮不弹出
  • 清远新闻最新消息福建seo搜索引擎优化
  • 凡客建站网微信网站怎么做的
  • 网站建设费怎么写会计科目行业网站建设公司
  • 网站里的友情链接网站建设个人简历的网页
  • 佛山自助建站软件湖南seo优化推荐
  • 免费微信微网站模板下载不了优化人员配置
  • wordpress 导航网站主题画流程图的网站
  • 皮卡剧网站怎样做排名网
  • 网站开发 兼职哪个网站是做安全教育
  • 商品展示类网站怎么用群晖nas做网站
  • 长腿蜘蛛wordpresssem优化推广
  • 中国铁路建设监理协会官方网站深圳福田区怎么样
  • 互联网网站开发发展wordpress文章自定义栏目
  • 众筹网站平台建设工信部网站备案系统
  • 网站301重定向代码wordpress 加子目录
  • 淄博网站制作优化推广asp做学生信息网站
  • 海口招商建设有限公司网站淮安哪有专业做网站的公司
  • 喀什哪有做网站的国内正规seo网络推广
  • 网站设计初步规划公司网页打不开是什么原因
  • 深圳企业网站建设推广服务php做的商城网站设计论文
  • 韩雪冬网站手机网站开发 宽度
  • 奉贤专业做网站新手怎么做企业网站
  • 做网站用哪几个端口 比较好手机号网站源码
  • 手机免费代理ip网站那个旅游网站做攻略最好
  • 西安做网站找哪家公司好苏州专业网站建设开发