Anti st_union

View: New views
3 Messages — Rating Filter:   Alert me  

Anti st_union

by Bob Pawley :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Hi
 
In order to have only one row, I have a number of points  stored in a table as st_union.
 
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.
 
Bob

_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

Re: Anti st_union

by Maxime van Noppen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Bob Pawley wrote:

> Hi
>  
> In order to have only one row, I have a number of points  stored in a
> table as st_union.
>  
> 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.

Hi,

That depends of the type of the resulting geometry. If it is a
MultiPoint (which it likely is if you ST_Union-ed points) you should
look at the ST_Dump function :

http://postgis.refractions.net/documentation/manual-1.4/ST_Dump.html

--
Maxime
_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

Re: Anti st_union

by Simon Greener-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...
   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
_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users