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 251A0D1E17F for ; Sun, 22 Feb 2004 02:16:41 +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 87282-02 for ; Sat, 21 Feb 2004 22:16:41 -0400 (AST) Received: from cookie.varlena.com (adsl-64-142-36-103.sonic.net [64.142.36.103]) by svr1.postgresql.org (Postfix) with ESMTP id B392FD1DD5F for ; Sat, 21 Feb 2004 22:16:37 -0400 (AST) Received: by cookie.varlena.com (Postfix on SuSE Linux 7.3 (i386), from userid 500) id 0967B38C85; Sat, 21 Feb 2004 18:12:59 -0800 (PST) Date: Sat, 21 Feb 2004 18:12:59 -0800 From: elein To: David Cc: pgsql-sql@postgresql.org Subject: Re: searching polygons Message-ID: <20040221181259.H25537@cookie.varlena.com> Mail-Followup-To: David , pgsql-sql@postgresql.org References: <006501c3f588$807b56b0$9b660c81@ad.kent.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <006501c3f588$807b56b0$9b660c81@ad.kent.ac.uk> User-Agent: Mutt/1.3.22.1i X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/332 X-Sequence-Number: 17022 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