[英]System.Data.Entity.Spatial.DbGeography Distance with elevation
I'm want to find the distance between 2 points on the planet (using WGS84) and System.Data.Entity.Spatial.DbGeography seemed like a good shout, but i'm not getting the expected result from the Distance function when the points have an elevation: 我想找到行星上的两个点之间的距离(使用WGS84)和System.Data.Entity.Spatial.DbGeography似乎很好,但是当这些点到达时,我无法从Distance函数获得预期的结果有海拔:
var geogA = DbGeography.PointFromText("POINT(179.04 89.77 100)", 4326);
var geogB = DbGeography.PointFromText("POINT(179.04 89.77 200)", 4326);
var distance = geogA.Distance(geogB); //distance is 0, not 100
I was expecting distance to be able to take the elevation into account as well - am I missing something obvious here? 我期望距离也能够考虑到海拔高度-我在这里遗漏了明显的东西吗?
I'm sure this must be fairly trivial, but I know little about the maths behind it all, so i'm probably not qualified to make that statement. 我敢肯定这肯定是微不足道的,但是我对这一切背后的数学知之甚少,所以我可能没有资格发表该声明。
My intuition tells me, just use Pythagoras here, but i'm not 100% sure that's correct. 我的直觉告诉我,仅在此处使用毕达哥拉斯,但我不确定100%正确。
In the SQL Server Libraries Z (Elevation) is more like a Tag or a pure user defined property. 在SQL Server库中,Z(海拔)更像是标记或纯用户定义的属性。
So it is not used in any calculations. 因此,它不用于任何计算。 This makes it similar to M which also only has meaning to my specific dataset.
这使其与M类似,后者仅对我的特定数据集有意义。
If elevation actually matters to you from a Math perspective then you will have to do this add/minus after you get the geography distance results. 如果从Math的角度来看海拔确实对您很重要,那么您必须在获得地理距离结果之后执行此加/减操作。 Take care to subtract from the higher elevation.
请注意从较高的高度减去。
You are adding two numbers (distance on the surface) + (elevation delta). 您要添加两个数字(曲面上的距离)+(高程增量)。 If you use Pythagoreans theorem you have to take into account a lot of subtle logic the geography libraries are doing for you.
如果使用勾股定理,则必须考虑到地理库为您所做的许多微妙的逻辑。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.