消除 SQL Server 空间或 OpenLayers 中重叠线的歧义?
我的表中有代表公交车路线的记录,其中 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
SQL Server Spatial Tools 有一个方法,
ShiftGeometry
,这会将几何(不是地理)移动给定的 X 和 Y 量。因此,对于每个连续的地理区域,您可以:
或者,不要将线移过去,而是将它们加厚:
看起来很贵!
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:
Alternatively, rather than shift lines over, fatten them up:
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.