如何计算两个多边形的重叠·区域

查看PDF手册有方法如下:
8.10.13 ST_Intersection
ST_Intersection — (T) Returns a geometry that represents the shared portion of geomA and geomB. The geography implementation
does a transform to geometry to do the intersection and then transform back to WGS84.
Synopsis
geometry ST_Intersection( geometry geomA , geometry geomB );
geography ST_Intersection( geography geogA , geography geogB );
Description
Returns a geometry that represents the point set intersection of the Geometries.
In other words - that portion of geometry A and geometry B that is shared between the two geometries.
If the geometries do not share any space (are disjoint), then an empty geometry collection is returned.
ST_Intersection in conjunction with ST_Intersects is very useful for clipping geometries such as in bounding box, buffer, region
queries where you only want to return that portion of a geometry that sits in a country or region of interest.


示例如下:
CREATE TABLE testintersection
(
geom geometry(Polygon,4326),
gid serial NOT NULL
);
insert into testIntersection values(st_geomfromtext('POLYGON((110 30,110 31, 111 31, 111 30, 110 30))',4326));
insert into testIntersection values(st_geomfromtext('POLYGON((110.5 30.5,110.5 31.5, 111.5 31.5, 111.5 30.5, 110.5 30.5))',4326));
insert into testIntersection select ST_Intersection(st_geomfromtext('POLYGON((110 30,110 31, 111 31, 111 30, 110 30))',4326), st_geomfromtext('POLYGON((110.5 30.5,110.5 31.5, 111.5 31.5, 111.5 30.5, 110.5 30.5))',4326));

使用QGIS查看效果如下

[img]http://dl2.iteye.com/upload/attachment/0113/4654/e25b06dd-b1b5-33bf-9cf0-be65a718afcc.jpg[/img]


[img]http://dl2.iteye.com/upload/attachment/0113/4654/e25b06dd-b1b5-33bf-9cf0-be65a718afcc.jpg[/img]
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值