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

网站开发htmlseo培训班 有用吗

网站开发html,seo培训班 有用吗,grace+wordpress,中国供应商网官网首页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.hkea.cn/news/994433/

相关文章:

  • 柳江区城乡住房建设局网站上海seo优化服务公司
  • 西城企业网站建设企业网站怎么优化
  • 初学者做动态网站项目例子游戏特效培训机构排名
  • 汽车类网站搭建直链平台
  • 做网站遇到的困难总结网络营销软件代理
  • 做网站登录论坛外链代发
  • 东营专业网站建设公司排行青岛谷歌优化公司
  • 公众号和网站先做哪个口碑营销的形式
  • 长沙企业建网站费用关键词搜索推广排行榜
  • 怎么做网站端口代理沧州网络推广外包公司
  • php wordpress 目录seo课程培训机构
  • 常州网站建设方案优化引流app推广软件
  • 网络营销网站建设实训网络营销步骤
  • 网站都有后台吗百度竞价开户公司
  • 秭归网站建设网站seo优化心得
  • wordpress电影网站模板seo运营
  • 公司注册网上核名业务如何终止网站排名优化怎么做
  • 网站建设伍金手指下拉2网上推广平台
  • 沧州网站建设公司翼马爱情链接
  • 计算机学了出来干嘛免费优化推广网站的软件
  • 宁波网站建设优化湖南seo优化按天付费
  • 门户网站手机版google官网入口
  • 深圳市工程建设交易服务中心网站软文什么意思
  • 大型网架加工厂成都网站建设方案优化
  • 导航网站的广告怎么做的千锋教育官方网
  • etc网站开发票网站制作软件免费下载
  • 上海seo网站设计2022十大网络营销案例
  • 还有做网站的必要吗网站运营推广方案
  • 企业营销型网站建设厂家品牌搜索引擎服务优化
  • 学校网站建设计划怎么成为百度推广代理商