【问题标题】:Select query within a particluar radius in postGIS在 postGIS 中的特定半径内选择查询
【发布时间】:2013-12-05 19:56:19
【问题描述】:

我是这个 postGIS 的新手。我的要求是检索具有特定半径的数据。在我的数据库中,我有 the_geom(POINT)。现在我有一个查询,它将从给定点检索 2 度内的数据。

我的查询是:

select level4,level3
        from xxxxxxx
        where st_distance(the_geom,'SRID=4326;POINT(79.932018 12.513343)') < 2;

但我需要检索特定公里或米内的点..帮我解决这个问题。提前谢谢..

我是否必须有“地理”列。我想现在我有几何列??

【问题讨论】:

  • 上述查询有什么问题
  • @Vijaykumar Hadalgi 上面的查询没有问题..实际上在那个查询中

标签: postgresql postgis


【解决方案1】:

您需要使用地理数据类型。然后就可以使用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);

另见this page in the postGIS manual

【讨论】:

  • 我找到了以下查询:“select level4,level3 from TN_Village where ST_Distance_Sphere(the_geom,'SRID=4326;POINT(79.932018 12.513343)')
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-03-29
  • 1970-01-01
  • 1970-01-01
  • 2011-09-22
  • 1970-01-01
  • 2010-11-17
相关资源
最近更新 更多