Re: Detecting whether a point is in a box.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Detecting whether a point is in a box.
Дата
Msg-id 10049.1188255527@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Detecting whether a point is in a box.  (HST <helenst@gmail.com>)
Список pgsql-general
HST <helenst@gmail.com> writes:
> I am trying to write a query to find all points that fall within a
> given box. However, I cannot seem to find the functionality for
> determining whether a point is within a box.

> e.g.  select box '((0,0),(1,1))' @> point '(0.5,0.5)';

> operator does not exist: box @> point

psql's \do shows that we have box @> box and polygon @> point,
but no box @> point.  So one possibility is to change your
box data to polygons.  Another is to manufacture a zero-area
box from the point, using the box(point,point) function, and
use @> with that.  Also, there is a point <@ box, although
I'm not sure you want to use that --- the lack of a commutator
suggests that it probably hasn't got any index support.

Is this just for a one-shot query, or are you hoping to do
indexed searches in a big table?  If the latter, which object
is being stored in the table?  You want to be sure you can
create an index that will support the operator you use.

            regards, tom lane

В списке pgsql-general по дате отправления:

Предыдущее
От: "Scott Marlowe"
Дата:
Сообщение: Re: Tables dissapearing
Следующее
От: "Dawid Kuroczko"
Дата:
Сообщение: Re: LDAP service lookup