消除 SQL Server 空间或 OpenLayers 中重叠线的歧义?

发布于 2024-09-18 00:23:33 字数 308 浏览 7 评论 0原文

我的表中有代表公交车路线的记录,其中 SQL Server 空间列代表实际路线的几何形状。 (它们存储在 Geography 列类型中。)

我使用 OpenLayers 在 OpenStreetMap 图层顶部显示这些公交路线。

在公交车路线重叠的情况下,目前您只能看到最上面的路线。我尝试过在线条上使用透明度,但看起来不太好。

有没有办法在 OpenLayers 或 SQL Server 空间中获取重叠线并稍微移动它们(但保持它们平行)以使它们全部可见?如果没有内置任何东西来处理这个问题,是否有一个标准算法来完成这个任务?

I have records in a table representing bus routes, with SQL Server spatial columns for the actual route geometry. (They're stored in a Geography column type.)

I use OpenLayers to display these bus routes on top of an OpenStreetMap layer.

In instances where the bus routes overlap, currently you cannot see anything but the top route. I've tried using transparency on the lines, but it doesn't look that great.

Is there a way, either in OpenLayers or SQL Server spatial, to take overlapping lines and shift them slightly (but keep them parallel) in order to have them all visible? If nothing is built in to handle this, is there a standard algorithm to accomplish this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

迷路的信 2024-09-25 00:23:33

SQL Server Spatial Tools 有一个方法,ShiftGeometry,这会将几何(不是地理)移动给定的 X 和 Y 量。

因此,对于每个连续的地理区域,您可以:

  1. 转换为几何图形,
  2. 将多线字符串分解为线
  3. 缓冲区,并与所有先前处理的线相交,
  4. 将相交线移动适当的斜率 X 和 。 Y 量
  5. 将角重新组合在一起 (??)
  6. 重新组合以进行显示

或者,不要将线移过去,而是将它们加厚:

  1. 足够的缓冲区来检测相交
  2. 再次与之前处理的形状
  3. 缓冲区相交,足以在线下方显示为更胖的形状前一个(--多少??)
  4. 与原始形状
  5. 显示和图层的结合。

看起来很贵!

OpenLayers 可能有这方面的东西。如果没有,它可能有更好的原语来完成它。在 SQL Server 上,这将是 CPU 密集型的。相交并不便宜,您很快就会需要执行大量相交。

SQL Server Spatial Tools has a method, ShiftGeometry, that will shift a geometry (not geography) over by a given X and Y amount.

So, you could, for each successive geography:

  1. convert to geometry
  2. break the multi-line strings down to lines
  3. buffer and intersect with all previously processed lines
  4. shift intersecting lines over by slope-appropriate X & Y amounts
  5. munge the corners back together (??)
  6. reconstitute for display

Alternatively, rather than shift lines over, fatten them up:

  1. buffer enough to detect intersects
  2. intersect w/ previously processed shapes
  3. buffer again, enough to be visible as a fatter shape beneath the previous one (--how much??)
  4. union with original shape
  5. display w/ layers.

Looks expensive!

OpenLayers may have something for this. If not, it may have better primitives for accomplishing it. On SQL Server, it's going to be very CPU intensive. Intersects aren't cheap, and you will very quickly need to perform a lot of intersects.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文