[postgis-users] Aggregate Functions

Paul Ramsey pramsey at refractions.net
Thu Feb 20 09:48:30 PST 2003

What is an aggregate function? A function which works on a result set 
and returns a summary. For example,

   select max(salary) from employees
   select mean(age) from patients

Both queries return a *single* value, the aggregate result.

What is a spatial aggregate? Same thing, only with goemetries. I really 
look forward to being able to do this to create a single drainage 
polygon for a river system:

   select union(geom) from watersheds where ws_code > '1000331421'

Things might get confusing, because the opengis spatial operators will 
have the same name but different arguments.

   select union(a.geom,b.geom) from a,b where a.id = b.id

The standard union() function is a pairwise union.

I hope that confuses things substantially. :/


      | Paul Ramsey
      | Refractions Research
      | Email: pramsey at refractions.net
      | Phone: (250) 885-0632

More information about the postgis-users mailing list