arcgis多面体数据转面,PostGIS-将多面转换为单面

在PostGIS中,可以使用ST_GeometryN与ST_NumGeometries及generate_series函数将包含多面体的形状文件转换为单个面。通过这个方法,可以从多面体几何中提取单独的面。示例中创建了一个包含多面体的表,并展示了如何通过这些函数拆分多面体,保留其他属性不变,得到单个面的几何数据。
摘要由CSDN通过智能技术生成

Is it possible to import a shape file containing multipolygons into single polygon in PostGIS? Whenever I try importing a shape file of a polygon, it is stored as a multipolygon (as opposed to a single polygon) in a geom column. Thus, I am unable to extract it as a single polygon value from the multipolygon.

All helpful suggestions much appreciated

解决方案

You can use ST_GeometryN together with ST_NumGeometries and the generate_series function to obtain what you need.

Let's assume you have the table from Jakub's example:

CREATE TABLE multi AS(

SELECT 1 as id, 2 as test, ST_GeomFromText('MULTIPOLYGON(((0 0,4 0,4 4,0 4,0 0)),((1 1,2 1,2 2,1 2,1 1)), ((-1 -1,-1 -2,-2 -2,-2 -1,-1 -1)))') AS geom

);

This one contains a multipolygon, an id and another column.

To get each single polygon from the table including all other

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值