PostGIS 检查圆是否包含某个点

PostGIS checking if a circle contains a certain point

我有 FighterArena。每个对象都有自己的地理位置,由一对值表示:(lat, long),每个 Fighter 也有 searchDistance,即搜索半径。我需要输出每个战士可用的竞技场,也就是说,那些位于战士搜索距离内的竞技场。

PostGIS 文档在我看来有些晦涩难懂,有太多我不理解的术语。 似乎我需要使用 ST_DWithin,但我不知道应该如何传递这个函数以及应该传递什么值。

函数应该是这样的:

public async isArenaAvailableToFighter(fighterId: number, arenaId: number): Promise<boolean> {
    // 1. Retrieve (long, lat) for the arena and (long, lat, searchDistance) for the fighter;
    // 2. Using PostGIS check if the arena is within the fighters search radius;
    //    return TRUE if it is and return FALSE if it is not;
    return;
}

我的问题是第二步。

这应该很简单

WHERE ST_DWithin(player, arena, radius)

如果要使用几何函数,将位置存储为一个点比存储为一对坐标要聪明得多。