knowledge-database (beta)

Current group: pgsql.sql

Problem on Geometric functions

Problem on Geometric functions  
Silke Trissl
 Re: Problem on Geometric functions  
Michael Fuhr
From:Silke Trissl
Subject:Problem on Geometric functions
Date:Thu, 20 Jan 2005 10:39:47 +0100
Hello,

I have a table that has an attribute 'identifier', declared as integer
and an attribute 'plane_coord' defined as 'point':

Table "reference.coord_test"
Column | Type | Modifiers
-------------+---------+-----------
node_name | integer |
plane_coord | point |


I would like to find all points from the table that are within a square.
Is this possible to do so? I have just found a check-operator to find
out if a specified point is contained in or on a figure:

point '(1,1)' @ box '((0,0),(2,2))'
(on http://www.postgresql.org/docs/7.4/interactive/functions-geometry.html).

I am looking for something like

SELECT point(x,y)
FROM reference.coord_test
WHERE point(x,y) € box '((0,0), (2,2))';

Has anyone experience with that?

Regards,

Silke

By the way, I am using PostGreSQL 7.4.1


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly
From:Michael Fuhr
Subject:Re: Problem on Geometric functions
Date:Thu, 20 Jan 2005 03:04:45 -0700
On Thu, Jan 20, 2005 at 10:39:47AM +0100, Silke Trissl wrote:

> Table "reference.coord_test"
> Column | Type | Modifiers
> -------------+---------+-----------
> node_name | integer |
> plane_coord | point |
>
>
> I would like to find all points from the table that are within a square.

Try this:

SELECT plane_coord
FROM reference.coord_test
WHERE plane_coord @ box'((0,0), (2,2))';

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings
   

Copyright © 2006 knowledge-database   -   All rights reserved