[postgis-users] MULTIPOINT geometry variable
Rodrigo Martín LÓPEZ GREGORIO
rodrigomlg at yahoo.com.ar
Mon Feb 19 04:15:09 PST 2007
Thank you very much.
I finally use a "workaround" to solve my problem. I first add a point far
away of my geometries so I know there would be no chances of that point to
be added as result of my function:
mymultipoint:=PointFromText('POINT(-10000000000 -10000000000)');
then add the points using GeomUnion:
mymultipoint:=GeomUnion(mymultipoint,newpoint);
and finally, at the end of the function, removes the "false" point and
return the multipoint geometry:
mymultipoint:=Difference(mymultipoint,PointFromText('POINT(-10000000000
-10000000000)'));
RETURN mymultipoint;
This is not a very nice solution but it works fine for me. Thanks anyway for
your answer, maybe I will modify my function and include your sugestion.
Rodrigo.
On 2/19/07, Markus Schaber <schabi at logix-tt.com> wrote:
>
> Hi, Rodrigo,
>
> "Rodrigo Martín LÓPEZ GREGORIO" <rodrigomlg at yahoo.com.ar> wrote:
>
> > But if mymultipoint variable has not points yet, this doesnt work so I
> must
> > check in every assignment if mymultipoint variable is null or empty or
> > something like that.
>
> Yes, but you can use an SQL-Level CASE expression to simplify that:
>
> mymultipoint:=CASE WHEN mymultipoint IS NULL THEN newpoint ELSE
> GeomUnion(newpoint, mymultipoint) END;
>
> Or even shorter, using COALESCE:
>
> mymultipoint:=COALESCE(GeomUnion(newpoint, mymultipoint), newpoint);
>
> or:
>
> mymultipoint:=GeomUnion(newpoint, COALESCE(mymultipoint, newpoint));
>
> > However I think that there may be a much simple way to do that.
>
> In case you find one, please tell me.
>
> > I think that must be something like
> > addpoint(mymultipoint,newpoint).
>
> But for your solution, you also need some notion of an "empty
> multipoint" to start with, so that won't change your problem.
>
> > Another solution could be initialize mymultipoint variable in some way
> that
> > not implies adding a point.
>
> Initially, I thougt you could initialize your multipoint variable with
> an empty geometry collection, but it seems that geomunion does not
> support geometry collections as input argument, which is braindead
> IMHO, and I think patches fixing that will be accepted.
>
>
>
>
> Regards,
> Markus
>
> --
> Markus Schaber | Logical Tracking&Tracing International AG
> Dipl. Inf. | Software Development GIS
>
> Fight against software patents in Europe! www.ffii.org
> www.nosoftwarepatents.org
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20070219/7268d121/attachment.html>
More information about the postgis-users
mailing list