[postgis-users] Anti st_union

Simon Greener simon at spatialdbadvisor.com
Fri Oct 16 15:40:21 PDT 2009


Bob,

> In order to have only one row, I have a number of points  stored in a table as st_union.

I assume you mean stored in a table as a MULTIPOINT geometry?

> Is there a method of breaking the points out of  the st_union geometry so that I can access the points individually.
>
> I want to use the points as a reference for st_within. It doesn't seem to works as it seems to regard the st_union point geometry as a whole.

Here is an example of what I think you want using 10 points dynamically generated, unioned and then Dumped.

select (ST_Dump(MPoint)).geom as Point
   from (select ST_Union(ST_Point(g.*,g.*)) as MPoint
           from generate_series(1,10,1) g
        ) as m;

Or

select ST_GeometryN(f.MPoint,f.pcount) as Point
   from (select m.MPoint, generate_series(1,ST_NumGeometries(m.mpoint),1) as pcount
           from (select ST_Union(ST_Point(p.*,p.*)) as MPoint from generate_series(1,10,1) as p ) m
        ) as f;

regards
Simon
-- 
SpatialDB Advice and Design, Solutions Architecture and Programming,
Oracle Database 10g Administrator Certified Associate; Oracle Database 10g SQL Certified Professional
Oracle Spatial, SQL Server, PostGIS, MySQL, ArcSDE, Manifold GIS, FME, Radius Topology and Studio Specialist.
39 Cliff View Drive, Allens Rivulet, 7150, Tasmania, Australia.
Website: www.spatialdbadvisor.com
   Email: simon at spatialdbadvisor.com
   Voice: +61 362 396397
Mobile: +61 418 396391
Skype: sggreener
Longitude: 147.20515 (147° 12' 18" E)
Latitude: -43.01530 (43° 00' 55" S)
GeoHash: r22em9r98wg
NAC:W80CK 7SWP3



More information about the postgis-users mailing list