怎样通过空间连接汇总数据?请前辈指导!

如下图:村为面状图层,村房屋为点状图层,怎样才能通过空间连接把村里边房屋汇总到一起啊?就像下图的红框里边一样。
2.png

 
已邀请:

刘锋

赞同来自: salecn

可以按照下面方法做:
将两个图层放到pg的sde数据库中后,操作如下:
sde=# alter table testpolygon add column info text;
ALTER TABLE
sde=# \d testpolygon
                数据表 "sde.testpolygon"
   栏位   |    类型     | Collation | Nullable | Default
----------+-------------+-----------+----------+---------
 objectid | integer     |           | not null |
 shape    | st_geometry |           |          |
 info     | text        |           |          |
索引:
    "r67_sde_rowid_uk" UNIQUE, btree (objectid) WITH (fillfactor='75')
    "a56_ix1" gist (shape)
执行如下SQL:
with t1 as 
(select polygon.objectid as polygonid,point.objectid as pointid from gis_poi point,testpolygon polygon where st_within(point.shape,polygon.shape)='t')
,
t2 as 
(select polygonid,string_agg(pointid::text,',') as info from t1 group by polygonid)、
update testpolygon  set info=(select t2.info from t2 where t2.polygonid=testpolygon.objectid); 
处理结果如下:
 

无标题.jpg

 

atlas1563

赞同来自:

字段有长度限制的,一般不会这么存。反过来,用空间连接往房屋的属性表里添加村名称属性就行了,导出excel分分类汇总即可

salecn

赞同来自:

谢谢前辈!

zmg920

赞同来自:

其实连接完用Excel就好,不用那么复杂。

要回复问题请先登录注册