如何在给定的方位和给定的距离处获得纬度和经度
How to get latitude and longitude at given bearing and given distance from a point
假设我有点 A(28.513393, 77.072276) 并且轴承是 45 度 然后得到点 B (?,?) 距离 5 Km 点 A 在给定方位。
为了计算 B 点的位置,您可以使用
Google 地图 Android API 实用程序库 。实用程序库有一个 class SphericalUtil
允许通过球面几何计算距离、面积和航向。
应该使用SphericalUtil
的方法是computeOffset
。根据文档
public static LatLng computeOffset(LatLng from,
double distance,
double heading)
Returns the LatLng resulting from moving a distance from an origin in the specified heading (expressed in degrees clockwise from north).
来源:http://googlemaps.github.io/android-maps-utils/javadoc/
因此,您示例中的代码片段是
LatLng pointA = new LatLng(28.513393, 77.072276);
double distance = 5000.0; //expressed in meters
double heading = 45.0 //expressed in degrees clockwise from north
LatLng pointB = SphericalUtil.computeOffset(pointA, distance, heading);
有关更多详细信息,请参阅实用程序库的设置指南:
https://developers.google.com/maps/documentation/android-api/utility/setup
希望对您有所帮助!
假设我有点 A(28.513393, 77.072276) 并且轴承是 45 度 然后得到点 B (?,?) 距离 5 Km 点 A 在给定方位。
为了计算 B 点的位置,您可以使用
Google 地图 Android API 实用程序库 。实用程序库有一个 class SphericalUtil
允许通过球面几何计算距离、面积和航向。
应该使用SphericalUtil
的方法是computeOffset
。根据文档
public static LatLng computeOffset(LatLng from, double distance, double heading)
Returns the LatLng resulting from moving a distance from an origin in the specified heading (expressed in degrees clockwise from north).
来源:http://googlemaps.github.io/android-maps-utils/javadoc/
因此,您示例中的代码片段是
LatLng pointA = new LatLng(28.513393, 77.072276);
double distance = 5000.0; //expressed in meters
double heading = 45.0 //expressed in degrees clockwise from north
LatLng pointB = SphericalUtil.computeOffset(pointA, distance, heading);
有关更多详细信息,请参阅实用程序库的设置指南:
https://developers.google.com/maps/documentation/android-api/utility/setup
希望对您有所帮助!