简体   繁体   English

System.Data.Entity.Spatial.DbGeography带有标高的距离

[英]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.

相关问题 Peta Poco和System.Data.Entity.Spatial.DbGeography - Peta Poco and System.Data.Entity.Spatial.DbGeography System.Data.Entity.Spatial.DbGeography-没有无参数构造函数 - System.Data.Entity.Spatial.DbGeography - No Parameterless Constructor 将 System.Data.Entity.Spatial.DbGeography 绑定到 MVC Model - Bind System.Data.Entity.Spatial.DbGeography to MVC Model 无法映射到基本类型的“ System.Data.Entity.Spatial.DbGeography”的属性类型 - Property type of 'System.Data.Entity.Spatial.DbGeography' which cannot be mapped to a primitive type Dapper无法将“Microsoft.SqlServer.Types.SqlGeography”类型的对象强制转换为“System.Data.Entity.Spatial.DbGeography” - Dapper unable to cast object of type 'Microsoft.SqlServer.Types.SqlGeography' to type 'System.Data.Entity.Spatial.DbGeography' System.Data.Spatial DbGeography.Distance单位? - System.Data.Spatial DbGeography.Distance units? System.Data.Spatial DbGeography.Distance不能始终如一地工作 - System.Data.Spatial DbGeography.Distance is not working consistantly System.Data.Spatial DBGeography.Distance()将与SQL Server 2008一起使用吗? - Will System.Data.Spatial DBGeography.Distance() will work with SQL Server 2008? 实体框架核心支持SQL空间数据类型 - DBGeography? - Entity Framework Core support for SQL Spatial Data Types - DBGeography? 从对象类型System.Data.Spatial.DbGeography到已知的托管提供程序本机类型不存在映射 - No mapping exists from object type System.Data.Spatial.DbGeography to a known managed provider native type
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM