在SQLite中使用同一表合并ST_CONTAINS和ST_BUFFER

问题描述

我希望从同一表的其他点中选择已创建缓冲区中的一些点。 我想要这样的东西:

Select a.geom,a.type
from a
where st_contains( (st_buffer( (a.geom where a.type = 'b'),50),(a.geom where a.type = 'c))

我不知道如何解决这个问题,而且似乎没有找到不包括为ex创建新表的合理解决方案。

 a.geom where a.type = 'b 

那不是我真正想要的。

解决方法

您可能只两次引用该表:

Select distinct c.geom,c.type
from a b,a c
where st_contains( (st_buffer( b.geom,50),c.geom) = 1
and b.type = 'b'
and c.type = 'c'