加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

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

发布时间:2020-12-13 16:23:40 所属栏目:PHP教程 来源:网络整理
导读:(注意:the_geom是一个几何值(TYPE:LINESTRING),在这种情况下我将它们随机化以便于阅读) gid | kstart | kend | ctrl_sec_no | the_geom | the_sum_geom626 | 238 | 239 | 120802 | 123456 | NULL638 | 249 | 250 | 120802 | 234567 | NULL4037| 239 | 249
(注意: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可以或不可以执行的操作.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读