如何与QUOT;平均"使用C#/ SQL Server 2008中的空间两个或多个地理线串 [英] How to "average" two or more geography linestrings using C#/SQL Server 2008 spatial

查看:160
本文介绍了如何与QUOT;平均"使用C#/ SQL Server 2008中的空间两个或多个地理线串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假如我有一组结果从研究到一个特定的候鸟的行为。鸟已被标记,以及GPS接收器记录在五年期间,每年它遵循的迁移路径。
结果存储在包含每年的路径中的一个地理线串SQL Server表。

Suppose I've got a set of results from a study into the behaviour of a particular migratory bird. The bird has been tagged, and a GPS receiver records the migration path it follows each year over a five year period. The results are stored in a SQL Server table that contains one geography linestring for each year's path.

您会如何去定义代表了平均线串路径后在五年内?

How would you go about defining the linestring representing the "average" path followed over the five year period?

请注意,每个样品线串可能包含不同数量的点。他们也不会启动,并在完全相同的点结束。

Note that each sample linestring may contain a different number of points. They also don't start and end at exactly the same points.

到目前为止,我已经得到了最好的方法是使用插值在某些设定的比例来确定分沿着每个线串。因此,例如,开始点,沿途的四分之一,沿每条路线等等
中途然后计算平均平均纬度/经度跨所有路线的位置,并从这些均构造一个新的地理线串分。

The best approach I've got so far is to use interpolation to determine the points at certain set proportions along each linestring. So, for example, the start point, a quarter of the way along, halfway along each route etc. Then calculate the mean average lat/long of those positions across all routes, and construct a new geography linestring from those averaged points.

我看着在数计算几何的书籍,看看是否有更好的已知算法或技术来做到这一点,但似乎没有任何东西相关。我简直不敢相信,这是不是一件别人没有以前做虽然...

I've looked in a few computational geometry books to see if there's a better known algorithm or technique to do this, but there doesn't seem to be anything relevant. I can't believe that it isn't something that somebody else hasn't done before though...

我不需要精确的代码 - 任何只是建议更好的一般方法。我不需要超精度要么。一点题外话,我的理想的喜欢办法适用于两个或两个以上的多边形了。

I don't need exact code - just suggestions for any better general approaches. I don't need "super-accuracy" either. As a sidenote, I'd ideally like the approach to be applicable to two or more polygons too.

感谢您的任何建议!

推荐答案

我真的不能发布任何代码示例,因为我从我的iPhone,现在的工作,但我有一个建议(唐知道,如果它是好还是坏)...

I can't really post any sample code as I am working from my iPhone right now, but I do have a suggestion (don't know if it's good or bad) ...

有关每一行,确定每个顶点的沿线位置(百分比)。

For each line, determine each vertex's position (percentage) along the line.

得到这些值后,每行,沿着计算使用所有其他行'百分比值的每一行新的顶点。

After getting those values, per line, compute new vertices along each line using all of the OTHER lines' percentage values.

此时,各行应包含相同数量的顶点和各行的第N个顶点与每个其他线的第N个顶点直接对应。

At this point, each line should contain the same number of vertices and the Nth vertex of each line corresponds directly with the Nth vertex of every other line.

现在,每行平均只顶点0获得顶点0的平均线。重复每个行vertex1等。

Now just average vertex 0 for every line to get vertex 0 of the "averaged" line. Repeat for vertex1 of each line, etc.

这应该适用于线以及多边形。

This should work for lines as well as polygons.

请注意,您也可以采用加权平均的算法,如果你能确定每行一个精确值。在过去试图平均两行的时候我已经使用这个方法。我们不得不让每一行进行加权,典型地为50:50的能力,但所有的方法可以去100:0或0:100,取决于准确性,如果源。

Note that you could also employ a weighted averaging algorithm if you could determine an accuracy value for each line. In the past I have used this approach when trying to average two lines. We had the ability to allow each line to be weighted, typically 50:50, but could go all the way to 100:0 or 0:100, depending on the accuracy if the sources.

我回去重读你的问题,看到你已经谈到插值。你谈到这样做的方式似乎是它可以平滑或计算插值点(固定间隔点)的平均值之前概括的线条。用我的方法,你会第一个致密的每一行,然后计算平均值。看起来这可能是更准确,但也许不会。

I went back and reread your question and saw that you already talked about interpolation. The way you talked about doing it seems like it could smooth or generalize the lines before computing the averages of the interpolated points (the fixed interval points). With my approach you would be densifying each line first and then computing the averages. It seems like that might be more accurate, but maybe not.

这篇关于如何与QUOT;平均"使用C#/ SQL Server 2008中的空间两个或多个地理线串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆