简体   繁体   English

从起点计算GPS坐标

[英]Calculate GPS coordinates from a starting point

Is there a library (JS or .NET) or a set of formulas that would help me calculate set of gps coordinates based on starting location, direction and distance. 是否有一个库(JS或.NET)或一组公式可以帮助我根据起始位置,方向和距离来计算一组GPS坐标。

For example. 例如。

I have an exact lon/lat of a certain location. 我在某个位置有确切的经/纬度。 I'd like to calculate an exact lon/lot 5 miles NE from that location. 我想从该位置计算一个准确的lon / lot NE NE 5英里。

也许这可能符合或不符合您的需求,但是您是否尝试过Entity Framework Spatial?

With Javascript you can use the geodesy library (under the MIT license), which is the code behind the Movable-Type.co.uk website. 使用JavaScript可以用大地测量库(MIT许可下),这是后面的代码Movable-Type.co.uk网站。

For example: 例如:

const LatLon = require('geodesy').LatLonSpherical;

const p1 = new LatLon(59.912140, 10.743796);
const distance = 42*10**3;
const bearing = 240.0

const p2 = p1.rhumbDestinationPoint(distance, bearing);

console.log(p2); // LatLon { lat: 59.72328246275707, lon: 10.093154371545552 }

This finds a second point given initial position, distance and bearing. 这将在给定初始位置,距离和方位的情况下找到第二个点。 This particular code is for Node, but it can also be used in the browser. 该特定代码用于Node,但也可以在浏览器中使用。

It should be noted that there are often several different ways to do the various calculations. 应该注意的是,通常有几种不同的方式来进行各种计算。 Some are complex and accurate, while some are simple and less accurate. 有些是复杂且准确的,而有些则是简单且较不准确的。 Using a spherical earth model, as I did in my example, is less accurate, but good enough for ordinary use. 正如我在示例中所做的那样,使用球形地球模型的精度较低,但足以用于普通用途。

Another library you could check out is geolib . 您可以签出的另一个库是geolib

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM