From: Bernhard Reimar Hoefle <Bernhard.Hoefle@uibk.ac.at>
Subject: [postgis-users] X() function working for POINTs and MULTIPOINTs
Date: Sat, 25 Mar 2006 10:27:06 +0100
Message-ID: <1143278826.44250cea7eccc@web-mail1.uibk.ac.at> (raw)
In-Reply-To: <20060324200036.ED8E52C1503@netnation.refractions.net>
References: <20060324200036.ED8E52C1503@netnation.refractions.net>
> Hi, Bernhard,
>
> Bernhard Reimar Hoefle wrote:
>
> > The PostGIS x() function does not support MULTIPOINTs and the geometryN()
> does
> > not support POINTs.
> >
> > select x('MULTIPOINT(1 1 1,2 2 2)'::GEOMETRY);
> > ERROR: Argument to X() must be a point
> > ERROR: Argument to X() must be a point
>
> You might want to write your own set returning plpgsql function. This
> way, it is even possible that select your_x('MULTIPOINT(...)') returns
> two rows, 1 and 2.
>
> HTH,
> Schabi
Hi Markus!
I was thinking of plpgsql functions. How would such a function look like? I
don't know how to write a plpgsql function which works like the dump()
function. I just know to write a function like SELECT * from
your_x('MULTIPOINT(...)')
But my problem is performance and the C functions are quite faster than the
procedural scripts.
Indeed, I do need a function like
SELECT id, your_x('MULTIPOINT(1 1 1, 2 2 2)') from table1;
returning
id|x
-----
1|1
1|2
I was thinking of adapting the C code of the dump() function for my purpose.
What do the PostGIS insiders think is the fastest solution for my problem?
The easiest solution is a combined usage of geometryn() and x(), or writing a
plpgsql script which checks how many geometries are in the MULTIPOINT object
and loops over the geometries with returning the individual values.
Bernhard H.
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: postgis-users@lists.osgeo.org
Cc: Bernhard.Hoefle@uibk.ac.at
Subject: Re: [postgis-users] X() function working for POINTs and MULTIPOINTs
In-Reply-To: <1143278826.44250cea7eccc@web-mail1.uibk.ac.at>
* 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