将 LineString 添加到 MultiLineString
使用 SQLServer 2008,我尝试将两个 LineString 转换为多个 LineString(最好是 MultiLineString),方法是根据彼此部分拆分它们。
L1 |---------------| L2 |----| = |----|----|-----|
以通用术语思考,我可以通过使用 L1.STIntersection(L2) 获得中心部分。 我可以通过 L1.STSymDifference(Intersection) 获得其他两个部分。 最后两个部分作为 MultiLineString 返回。
如何将第一个中心部分添加到此 MultiLineString 中?
使用 STUnion 将产生像 L1 一样的单个合并 LineString。 也许这就是问题所在,可以合并的MultiLineStrings应该总是被合并?
With SQLServer 2008 I'm trying to transform two LineStrings to a multiple LineStrings (preferably a MultiLineString), by splitting them up in part based on each other.
L1 |---------------| L2 |----| = |----|----|-----|
Thinking in generic terms I can get the centerpart by using L1.STIntersection(L2). The two other parts I can get with L1.STSymDifference(Intersection). The two last parts are returned as a MultiLineString.
How can I add the first centerpart to this MultiLineString?
Using STUnion will result in a single merged LineString like L1. Perhaps this is the problem, MultiLineStrings that can be merged should always be merged?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在 SQL Server 2008 中找不到任何可以完成此操作的函数,但我对 SQL Server 2008 sql 函数也比较陌生。
在处理 SQL Server 2008 时,我通常会查看 PostGIS 论坛和论坛。 电子邮件列表,看看它是如何完成的(PostgreSQL-PostGIS 已经在这方面工作了很长时间)。 有人似乎有相反的问题 这似乎就是您想要的结果。
不幸的是,没有 ST_LineMerge (或 STLineMerge),因此您可能需要自己动手。
我不确定这些示例是否适用于所有情况(并且线串本身不按顺序排列):
以下是与实际线串数据相同的逻辑:
I can't find anything functions that would accomplish this in SQL Server 2008, but I'm also relatively new to SQL Server 2008 sql functions.
When dealing with SQL Server 2008, I usually check PostGIS forums & email lists and see how it's done there (PostgreSQL-PostGIS have been at this a lot longer). Someone seems to have the opposite problem as this one which appears to be the result you are after.
Unfortunately, there's no ST_LineMerge (or STLineMerge), so you'll probably need to roll your own.
I'm not sure if these examples will work in all cases (and the linestrings themselves are not in sequential order):
here's the same logic with actual linestring data: