[postgis-users] st_union says geometries have different srids

Mike Leahy mgleahy at alumni.uwaterloo.ca
Sun Mar 16 21:14:31 PDT 2008


Hello list,

I seem to be having trouble with st_union as an aggregate function. 
Sorry if this is a known issue, but a quick search didn't turn anything 
up similar.  Below is an example where I have two polygons next to each 
other

test=# create table test (gid serial primary key);
test=# select 
addgeometrycolumn('public','test','test_geom',4326,'MULTIPOLYGON',2);
test=# insert into test (test_geom) values ('srid=4326;MULTIPOLYGON(((1 
1,1 2,2 2,2 1,1 1)))');
test=# insert into test (test_geom) values ('srid=4326;MULTIPOLYGON(((2 
1,3 1,3 2,2 2,2 1)))');


The following will fail no matter what shapes/srid I'm using:

test=# select st_union(test_geom) from test;
ERROR:  Operation on mixed SRID geometries

But this works fine:

test=# select st_memunion(test_geom) from test;
 
 
 
 
    st_memunion 
 
 

------------------------
  0103000020E610000001...


Is there something in particular that I'm doing wrong?  This only seems 
to be an issue with st_union as an aggregate, if I use 
st_union(geometry,geometry), the result looks fine.  This is on a 
Fedora-7 (x86_64) machine with PostgreSQL 8.3, PostGIS 1.3.2, 
Proj-4.5.0, GEOS-3.0.0 - I have a similar setup on another machine 
running F8-x86_64 (except for Proj-4.6.0), and the failure is worse (the 
postgresql server segfaults with 'signal 11').  Would this be a bug, or 
have I committed some kind of user error?  Is there anything I should 
try to figure out where the source of my problem is?

Thanks in advance for any suggestions.

Mike



More information about the postgis-users mailing list