微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

php – PostGIS函数将几何LINE连接在一起?

(注意:the_geom是一个几何值(TYPE:LInesTRING),在这种情况下我将它们随机化以便于阅读)

gid | kstart  | kend    | ctrl_sec_no | the_geom | the_sum_geom
626 | 238     | 239     | 120802      | 123456   | NULL
638 | 249     | 250     | 120802      | 234567   | NULL
4037| 239     | 249     | 120802      | 345678   | NULL

[真实实践说明]只是为那些不介意目的的人跳过这个

I would like to do ‘this’ (a set of queries from my past question, link
located on the end of this post) for every row in Table B (aka.
land_inventory). These two tables are related by ‘ctrl_sec_no’
(aka. control section number of a road) which means :: in ONE
ctrl_sec_no — 120802 (in fact, it is a road which is equivalent to 3
geometry LInesTRINGs (the_geom) connected together, from kstart 238 (start at kilometre of 238) to kend 250)

[PostGIS问题]

问题是如何将这3行{aka gid(626,638,4037)从表}连接在一起,并通过使用PostGIS函数(无论如何)导致’the_sum_geom'(最初为NULL).之后我们将使用这个’the_sum_geom’在这个几何LInesTRING上找到POINT

(How calculate things from many tables by using a few queries?).

解决方法:

您要查找的功能ST_Union,您需要使用聚合形式:

update mytable set the_sum_geom = 
ST_LineMerge( ( select ST_Union(the_geom) from mytable where ctrl_sec_no  = 120802 ) )
where ctrl_sec_no = 120802;

使用ST_LineMerge,你可以从Multiline转换为Linestring,但有一个警告,如果多行不能合并,它将返回多行而不做任何修改.请参阅ST_LineMerge文档以了解ST_LineMerge可以或不可以执行的操作.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐