From: Michael Fuhr <mike@fuhr.org>
To: Nemo Terry <ntuser155@hotmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: How to use function PointN?
Date: Mon, 7 May 2007 07:13:43 -0600
Message-ID: <20070507131343.GA90126@winnie.fuhr.org> (raw)
In-Reply-To: <BAY19-F26CCC320397172DE70B66F5450@phx.gbl>
References: <BAY19-F26CCC320397172DE70B66F5450@phx.gbl>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: mike@fuhr.org, ntuser155@hotmail.com
Subject: Re: How to use function PointN?
In-Reply-To: <20070507131343.GA90126@winnie.fuhr.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox