我是这个 postGIS 的新手。我的要求是检索具有特定半径的数据。在我的数据库中,我有 the_geom(POINT)。现在我有一个查询,它将检索距给定点 2 度以内的数据。
我的查询是:
select level4,level3
from xxxxxxx
where st_distance(the_geom,'SRID=4326;POINT(79.932018 12.513343)') < 2;
但我需要检索特定公里或米内的点..帮我解决这个问题。提前致谢..
我是否必须有“地理”栏。我想现在我有几何栏??
最佳答案
您需要使用地理数据类型。然后你可以使用 ST_DWithin
函数:
boolean ST_DWithin(geography gg1,
geography gg2,
double precision distance_meters);
您可以使用此查询:
select level4,level3
from xxxxxxx
where st_dWithin(the_geom,'SRID=4326;POINT(79.932018 12.513343)', 2000);
关于postgresql - 在 postGIS 中选择特定半径内的查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20391933/