【发布时间】:2016-06-14 14:11:11
【问题描述】:
我正在使用 Java 开发一种用于 GPS 精度的工具。 我对 Lat Lon 有意见,需要建立一个具有一定半径的圆。
这样的问题很多,但在我的情况下,半径通常在 10 米左右,+-5 米,我需要它非常精确。
为了建立一个圈子,我使用JTS。
有一个代码示例:
import com.vividsolutions.jts.geom.*;
public static final int SRID = 4326;
public static PrecisionModel precisionModel = new PrecisionModel(PrecisionModel.maximumPreciseValue);
public static GeometryFactory geometryFactory = new GeometryFactory(precisionModel, SRID);
public static Polygon createCircle(Point initialPoint, int coverArea){
GeometricShapeFactory gsf = new GeometricShapeFactory(geometryFactory);
ArrayList<Point> pointsOfIntersection = new ArrayList<>();
// double radius = getRadius(point);
double size = 0.0001 * coverArea/100;
gsf.setSize(size);
gsf.setNumPoints(50);
gsf.setCentre(point.getCoordinate());
Polygon circle = gsf.createCircle();
return circle;
}
基本上我有一个带坐标的中心点,并将根据该点获得一个直径(5 - 20 米),之后我需要将该半径调整为coverArea 系数(1 - 100 %)并设置一个大小十进制度数的圆。
目前我使用 0.0001 值进行测试,根据 wikipedia 得出的值约为 10.247 米。
所以我需要一个简单有效的公式来将米转换为十进制度。
【问题讨论】:
-
你能贴一点代码让我们看看你的意思吗?
-
地球的平均半径为 6371 公里 = 6.371e6 米。您还需要知道如何根据纬度/经度值计算球坐标系中的距离:movable-type.co.uk/scripts/latlong.html
标签: java gis geospatial jts