Get x from path/polygon?

From: Daniel Lau <iedaniel(at)ust(dot)hk>
To: pgsql-sql(at)postgresql(dot)org
Subject: Get x from path/polygon?
Date: 2003-12-30 06:49:50
Message-ID: Pine.WNT.3.96L2.1031230140025.2536A-100000@iey118.ust.hk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi all,

I succeed in extracting x and y value from POINT. Is it also possible to
extract x and y value from PATH and POLYGON?

I tried to get x and y from PATH using the similar method. However, the
machine says the PATH is not an array and does not allow me to do so.

Any hints on this? Thanks in advance.

regards,
Daniel Lau

On Mon, 22 Dec 2003, Michael Fuhr wrote:

> On Mon, Dec 22, 2003 at 04:54:01PM +0800, Daniel Lau wrote:
> > I am wondering if we are able to extract the x-coordinate from a
> > point-type attribute with SQL. I have been looking for this sort of
> > functions from documents and websites but it seems the function does not
> > exist. Or, any altnernate to do so?
>
> From the bottom of the Geometric Functions and Operators chapter of
> the documentation:
>
> "It is possible to access the two component numbers of a point as
> though it were an array with indices 0 and 1. For example, if t.p
> is a point column then SELECT p[0] FROM t retrieves the X coordinate
> and UPDATE t SET p[1] = ... changes the Y coordinate. In the same way,
> a value of type box or lseg may be treated as an array of two point
> values."
>
> http://www.postgresql.org/docs/current/static/functions-geometry.html
>
> --
> Michael Fuhr
> http://www.fuhr.org/~mfuhr/
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message beyaRecords - The home Urban music 2003-12-30 16:05:36 postgreSQL editors
Previous Message Tom Lane 2003-12-29 23:00:53 Re: 7.4.1 install problems on OS X 10.3