Thread: Getting points from polygon

Getting points from polygon

From
albrechtt@inseal.de (Sebastian Albrecht)
Date:
Hello,

how can I get single xy-points from a polygon like for example:

CREATE TABLE "public"."country" 
("country_id" INTEGER NOT NULL,    "geo" polygon NOT NULL    
)

SELECT geo.x, geo.y FROM country WHERE geo.x=5

or

SELECT geo[24th point].x FROM country

...

Thanks in advance and best regards,
Sebastian


Re: Getting points from polygon

From
Tom Lane
Date:
albrechtt@inseal.de (Sebastian Albrecht) writes:
> how can I get single xy-points from a polygon like for example:

[ looks through pg_proc... ]  Hmm, this seems to be an oversight
in the polygon datatype.  I don't think it'd be real practical
to support an array-subscript-like notation, but certainly a
function like point(polygon, n) wouldn't be too hard to add.
        regards, tom lane