Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id D20999FB869 for ; Mon, 7 May 2007 10:13:54 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 50876-06 for ; Mon, 7 May 2007 10:13:51 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by postgresql.org (Postfix) with ESMTP id 378B19FB866 for ; Mon, 7 May 2007 10:13:50 -0300 (ADT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.8/8.13.8) with ESMTP id l47DDiZP052660 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 7 May 2007 07:13:47 -0600 (MDT) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.8/8.13.8) with ESMTP id l47DDhkK090305; Mon, 7 May 2007 07:13:43 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.8/8.13.8/Submit) id l47DDhEZ090304; Mon, 7 May 2007 07:13:43 -0600 (MDT) (envelope-from mfuhr) Date: Mon, 7 May 2007 07:13:43 -0600 From: Michael Fuhr To: Nemo Terry Cc: pgsql-sql@postgresql.org Subject: Re: How to use function PointN? Message-ID: <20070507131343.GA90126@winnie.fuhr.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200705/43 X-Sequence-Number: 28324 On Mon, May 07, 2007 at 04:07:00PM +0800, Nemo Terry wrote: > select PointN(envelope(polyline),1) from highway; > return null,why? PointN is a PostGIS function; you might get more help on the postgis-users mailing list. http://postgis.refractions.net/mailman/listinfo/postgis-users See also the PostGIS documentation for Envelope and PointN: http://postgis.refractions.net/docs/ch06.html Envelope(geometry) Returns a POLYGON representing the bounding box of the geometry. PointN(geometry,integer) Return the N'th point in the first linestring in the geometry. Return NULL if there is no linestring in the geometry. You've used Envelope to get a polygon but PointN expects a linestring. Try using ExteriorRing on Envelope's polygon: SELECT PointN(ExteriorRing(Envelope(polyline)), 1) FROM highway; -- Michael Fuhr