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

成都 网站让顾客心动的句子

成都 网站,让顾客心动的句子,网站推广工作独立性较强非常便于在互联网上开展,佛山网站制作建设JTS Java Topology Suite 几何计算: 1. 前端js就用这个 Turfjs的类库。参考网站: 计算两线段相交点 | Turf.js中文网 2. 后端java语言就可以用 JTS这个类库,参考网站: JTS参考网站: 1. https://github.com/locatio…

JTS = Java Topology Suite

几何计算:

1. 前端js就用这个 Turfjs的类库。参考网站: 计算两线段相交点 | Turf.js中文网

2. 后端java语言就可以用 JTS这个类库,参考网站:

 JTS参考网站:

1. https://github.com/locationtech/jts

GitHub - locationtech/jts: The JTS Topology Suite is a Java library for creating and manipulating vector geometry.The JTS Topology Suite is a Java library for creating and manipulating vector geometry. - GitHub - locationtech/jts: The JTS Topology Suite is a Java library for creating and manipulating vector geometry.https://github.com/locationtech/jts 2. https://locationtech.github.io/jts/JTS | Documentationhttps://locationtech.github.io/jts/

1. https://github.com/locationtech/jts

2. https://locationtech.github.io/jts/

POM文件:

<dependency><groupId>org.locationtech.jts</groupId><artifactId>jts-core</artifactId><version>1.18.0</version>
</dependency>

实例代码:

可以通过JTS

要使用JTS(Java Topology Suite)库计算

1. 某个点是否在另外一个闭合的空间内
2. 计算某个闭合的空间的中心的的位置

3. 已知两个点的经纬度,计算他们之间的距离

4. 已知某点的经纬度坐标,计算其他点的经纬度坐标

 简单实例如下:

package com.simulate.jts;import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.GeometryFactory;
import org.locationtech.jts.geom.Point;
import org.locationtech.jts.geom.Polygon;
import org.locationtech.jts.io.ParseException;
import org.locationtech.jts.io.WKTReader;
import org.locationtech.jts.linearref.LengthIndexedLine;public class JtsExample {public static void main(String[] args) throws ParseException {// 1. 某个点是否在另外一个闭合的空间内// isInside();// 2. 计算某个闭合的空间的中心的的位置// calcCentPoint();//3. 已知两个点的经纬度,计算他们之间的距离// pointDistance();// 4. 已知某点的经纬度坐标,计算其他点的经纬度坐标calcCoordinate();// 5.}// 1. 某个点是否在另外一个闭合的空间内static void isInside() throws ParseException{// 创建 GeometryFactory 对象GeometryFactory geometryFactory = new GeometryFactory();// 创建点对象Coordinate pointCoord = new Coordinate(2.0, 2.0);Point point = geometryFactory.createPoint(pointCoord);// 创建多边形对象WKTReader wktReader = new WKTReader(geometryFactory);Polygon polygon = (Polygon) wktReader.read("POLYGON((0 0, 0 4, 4 4, 4 0, 0 0))");// 判断点是否在多边形内部boolean isInside = polygon.contains(point);// 输出结果System.out.println("Point: " + point.toText());System.out.println("Polygon: " + polygon.toText());System.out.println("Is inside: " + isInside);}// 2. 计算某个闭合的空间的中心的的位置static void calcCentPoint(){int pointCount = 5;Coordinate[] coordinates = new Coordinate[pointCount];// 填充Coordinate数组coordinates[0] = new Coordinate(1.0, 1.0);coordinates[1] = new Coordinate(2.0, 3.0);coordinates[2] = new Coordinate(4.0, 1.0);coordinates[3] = new Coordinate(3.0, 4.0);coordinates[4] = new Coordinate(1.0, 1.0);// 创建Polygon对象GeometryFactory factory = new GeometryFactory();Polygon polygon = factory.createPolygon(coordinates);polygon.getDimension();// 计算中心点坐标Coordinate centerCoordinate = polygon.getCentroid().getCoordinate();double centerX = centerCoordinate.x;double centerY = centerCoordinate.y;// 输出结果System.out.println("Center point: (" + centerX + ", " + centerY + ")");}//3. 已知两个点的经纬度,计算他们之间的距离static void pointDistance(){double lon1 = 115.8575; // 第一个点的经度double lat1 = 28.6829;  // 第一个点的纬度double lon2 = 116.4074; // 第二个点的经度double lat2 = 39.9042;  // 第二个点的纬度// 创建GeometryFactory对象GeometryFactory factory = new GeometryFactory();// 创建Coordinate对象Coordinate coordinate1 = new Coordinate(lon1, lat1);Coordinate coordinate2 = new Coordinate(lon2, lat2);// 创建Point对象Point point1 = factory.createPoint(coordinate1);Point point2 = factory.createPoint(coordinate2);// 计算两点之间的距离double distance = point1.distance(point2);// 输出结果System.out.println("Distance between the two points: " + distance);}/// 4. 已知某点的经纬度坐标,计算其他点的经纬度坐标static void calcCoordinate() {// 假设已知的参考点的坐标double lat1 = 40.7128;   // 参考点的纬度double lon1 = -74.0060;  // 参考点的经度// 假设要计算的距离和方向double distanceInMeters = 1000;  // 距离为 1000 米double bearingInDegrees = 45;    // 方向为 45 度// 创建参考点的坐标对象Coordinate referenceCoord = new Coordinate(lon1, lat1);// 计算目标点的坐标Coordinate targetCoord = calculateCoordinate(referenceCoord, distanceInMeters, bearingInDegrees);// 打印目标点的经纬度System.out.println("目标点的经度:" + targetCoord.x);System.out.println("目标点的纬度:" + targetCoord.y);}// 使用 JTS 计算目标坐标static Coordinate calculateCoordinate(Coordinate referenceCoord, double distance, double bearing) {// 将距离转换为度数double distanceInDegrees = Math.toDegrees(distance / 6371000.0); // 假设地球是一个球体,半径为 6371000 米// 根据参考点和距离创建线段对象// LengthIndexedLine line = new LengthIndexedLine(new Coordinate[] { referenceCoord });GeometryFactory factory = new GeometryFactory();Point referencePoint = factory.createPoint(referenceCoord);LengthIndexedLine line = new LengthIndexedLine(referencePoint);// 在线段上根据方向和距离计算目标点的索引double targetIndex = line.project(referenceCoord) + distanceInDegrees;// 根据目标索引获取目标点的坐标Coordinate targetCoord = line.extractPoint(targetIndex);return targetCoord;}
}

http://www.dinnco.com/news/42988.html

相关文章:

  • 做网站如何网站考虑优化产品网络推广方案
  • 网站搭建中114514河南网站建设
  • 阿里云esc建设网站抖音seo招商
  • 北京网站建设华网google搜索app下载
  • 个人网站备案需要盖章吗广告网
  • 代理下单网站开发成都疫情最新情况
  • 网站建设是什么意思 打不开网站推广找哪家公司好
  • 网页设计培训贵不贵seo关键词布局
  • ppt制作教程免费全集企业网站seo案例分析
  • 网站设计制作费用多少百度关键词seo优化
  • 深圳网站建设制作网络公司手游推广平台哪个好
  • 洛阳网站设计哪家专业制作公司网站的步骤
  • 濮阳h5建站搭建一个网站的流程
  • 网站服务器中如何做重定向山西seo排名厂家
  • 做动漫网站要多少钱廊坊网站seo
  • 婚纱摄影网站源码手机百度问一问
  • 赤峰北京网站建设seo关键词排名优化系统
  • 一个网站做多少关键词搜索引擎优化好做吗
  • 鹰潭网站建设手机百度官网
  • 做调查问卷哪个网站好佛山百度seo点击软件
  • 大数据精准营销获客优化网站seo策略
  • 沧州做网站的网页制作代码大全
  • 网站运营论文百度没有排名的点击软件
  • ks2e做网站最近一周的新闻
  • 怎样申请电子邮箱微博seo营销
  • 淄博网站推广哪家好网络安全有名的培训学校
  • 政府网站建设责任google登录
  • 网站 建设平台分析品牌运营中心
  • 专业做域名的网站吗大数据精准营销案例
  • 苏州专业做网站公司百度站长工具域名查询