X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 141C6D1B4DE for ; Fri, 27 Feb 2004 17:29:36 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 52673-08 for ; Fri, 27 Feb 2004 13:29:23 -0400 (AST) Received: from greendale.ukc.ac.uk (greendale.ukc.ac.uk [129.12.21.13]) by svr1.postgresql.org (Postfix) with ESMTP id 13D3FD1D52E for ; Fri, 27 Feb 2004 13:29:22 -0400 (AST) Received: from pelican.ukc.ac.uk ([129.12.200.26]) by greendale.ukc.ac.uk with esmtp (Exim 4.22) id 1AwlnV-0007UV-Lp; Fri, 27 Feb 2004 17:29:13 +0000 Received: from dhcp665f.ukc.ac.uk ([129.12.102.95] helo=PC2LP080) by pelican.ukc.ac.uk with smtp (Exim 4.22) id 1AwlnV-0006cq-4a; Fri, 27 Feb 2004 17:29:13 +0000 Message-ID: <001701c3fd57$3772fa50$5f660c81@ad.kent.ac.uk> From: "David" To: "elein" , "David" Cc: References: <006501c3f588$807b56b0$9b660c81@ad.kent.ac.uk> <20040221181259.H25537@cookie.varlena.com> Subject: Re: searching polygons Date: Fri, 27 Feb 2004 17:29:12 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-UKC-Mail-System: No virus detected X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/375 X-Sequence-Number: 17065 Hi elin thanks for advice, i looked at your website but i didnt really understand the information given, sorry. However i looked at the postgres documentation and realised what i had to do select * from species where location[1] @ polygon '((0,0), (1000,0), (1000,1000), (0,1000))': This works fine for just the one location ([1]), but when i tried to search the entire array of polygons using the query: select * from species where location @ polygon '((0,0), (1000,0), (1000,1000), (0,1000))': i got this: Error: ' and 'polygon' You will have to retype this query using an explicit cast (State:S1000, Native Code: 7) I am not sure how to do this, any suggestions Many thanks Dave ----- Original Message ----- From: "elein" To: "David" Cc: Sent: Sunday, February 22, 2004 2:12 AM Subject: Re: [SQL] searching polygons > You should use some variation of overlaps or > contains within. There is some discussion and > a list of operators in Issue #61 of General Bits. > ( http://www.varlena.com/GeneralBits/61 ) > > I would also suggest looking at the geometric > operators in the documentation. You may have > to cast the polygon to a circle to use the operators, > but it will still tell you whether the smaller polys > are contained within or overlap the larger. > > elein > > On Tue, Feb 17, 2004 at 07:01:51PM -0000, David wrote: > > What query would i have to use to search for an item using a polygon as a > > parameter? (i.e a very large polygon that would identify smaller polygons > > within it) ideally i would like to give postgresq a series of co-ordinates > > and then have it return all those results whose polygons fall into that set > > of co-ordinates, is this possible? > > > > at the moment all i can think of is > > > > > > select * from species where location between '(0,0)' and '(1000,0)' and > > '(0, 1000)' and '(1000; 1000)'; > > > > I think im way off, any suggestions? > > > > Cheers Dave > > > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 6: Have you searched our list archives? > > > > http://archives.postgresql.org >