计算 GPS 坐标以形成给定大小的半径

Calculate GPS coordinates to form a radius of given size(计算 GPS 坐标以形成给定大小的半径)
本文介绍了计算 GPS 坐标以形成给定大小的半径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想出了一个方法,它接受一个坐标和一个范围(以英里为单位)并返回一个围绕原点形成一个圆的坐标列表.我似乎在这方面取得了一些进展,但我在降低范围部分时遇到了问题.

I've come up with a method that takes a coordinate and a range (in miles) and return a list of coordinates that form a circle around the origin. I seem to have made some progress with it, but I have an issue with getting the range part down.

private const Double LAT_MILE = 0.0144839;
private const Double LONG_MILE = 0.0190693;

public static List<Gps.Coordinate> GetRadius(Double OriginLatitude, Double OriginLongitude, Double Range, int Points)
{
    List<Gps.Coordinate> Result = new List<Coordinate>();

    //insert a new point
    for (int i = 0; i < Points; i++)
    {
        Result.Add(new Gps.Coordinate()
        {
            Latitude = ((Range * LAT_MILE) * System.Math.Cos(i)) + OriginLatitude,
            Longitude = ((Range * LONG_MILE) * System.Math.Sin(i)) + OriginLongitude
        });
    }

    //sort using nearest neighbor
    return SortCoords(ref Result);
}

我发现的问题是,我用来表示距离(以英里为单位)的常数会因位置而异.有没有人有任何解决这个问题的建议,或者更好的捕鼠器?

The issue I've found is that the constant I'm using to tell the distance in miles to degrees changes depending on location.. Does anyone have any suggestions for resolving this issue, or a better mousetrap altogether?

我应该注意,我的数学很糟糕:)

I should note, I'm horrible at math :)

推荐答案

看看这个(包括示例代码):http://www.movable-type.co.uk/scripts/latlong.html

have a look at this (includes example code): http://www.movable-type.co.uk/scripts/latlong.html

余弦球面定律"为您提供两个坐标之间的距离.应该可以修改它,为您提供围绕指定中心和指定半径(距离)的坐标.

the "Spherical Law of Cosines" gives you the distance between two coordinates. it should be possible to modify this to give you the coordinates around a specified center and a specified radius (distance).

这篇关于计算 GPS 坐标以形成给定大小的半径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

DispatcherQueue null when trying to update Ui property in ViewModel(尝试更新ViewModel中的Ui属性时DispatcherQueue为空)
Drawing over all windows on multiple monitors(在多个监视器上绘制所有窗口)
Programmatically show the desktop(以编程方式显示桌面)
c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
LINQ many-to-many relationship, how to write a correct WHERE clause?(LINQ多对多关系,如何写一个正确的WHERE子句?)