postgresql中ST_Buffer、ST_DWithin函数用法

ST_Buffer:用于矢量对象生成缓冲区geometry对象,可用于缓冲区对象的显示,使用举例(其中bufferColumn字段是geometry类型):

update tableName set bufferColumn=ST_Buffer( ST_GeomFromText( ‘LINESTRING(50 50,150 150,150 50)’), 10, ‘endcap=round join=round’);

这是其中一种类型的缓冲区用法,其他用法参考:http://postgis.net/docs/ST_Buffer.html

ST_DWithin:检测一个对象是否在另一个对象的缓冲区范围内,不生成缓冲区对象,效率更高,速度更快。使用举例:

查询tableName表中存在于objectid=100的对象10米缓冲区内的所有对象,其中geom为geometry字段:

select * from tableName where ST_DWithin(geom, (select geom from tableNamewhere objectid=100), 10)=true

其他用法参考:http://postgis.net/docs/ST_DWithin.html

转载自:https://blog.csdn.net/xianyucishi/article/details/71309760

You may also like...