Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/string/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Postgresql 最近非相邻点_Postgresql_Geometry_Postgresql 9.3 - Fatal编程技术网

Postgresql 最近非相邻点

Postgresql 最近非相邻点,postgresql,geometry,postgresql-9.3,Postgresql,Geometry,Postgresql 9.3,表中有一个点列。我需要添加另一个点。新点与现有点的距离不能超过一定距离。距离由接地距离分机的运算符给出 如果没有小于1的现有点,则此查询返回候选点,否则返回任意点 select case when not exists ( select 1 from (values ('0.01, 0'::point), ('-0.01, 0'), ('0, 0.01')) s(location) where location <@> poin

表中有一个
列。我需要添加另一个
。新点与现有点的距离不能超过一定距离。距离由
接地距离
分机的
运算符给出

如果没有小于1的现有点,则此查询返回候选点,否则返回任意点

select
    case when not exists (
        select 1
        from (values ('0.01, 0'::point), ('-0.01, 0'), ('0, 0.01')) s(location)
        where location <@> point (0,0) < 1
    )
    then point(0,0)
    else point(1,1)
    end
;

我对此有点困惑。听起来你有一个点的集合,给定一个特定的点作为输入,你想知道哪一个现有点最接近该输入点吗?如“按p点顺序从现有点中选择p(输入水平,输入水平)asc限制1”@yieldsfalsehood否我想要到输入点最近的“空闲槽”。明白了。现在你能澄清一下在你的例子中是什么使得(0,-0.0144733)成为这一点吗?在(0,0)附近有无穷多个点不在集合(0.01,0),(-0.01,0),(0,0.01)中。
create extension cube;
create extension earthdistance;