Hello, A multipolygon can not be single polygon but you can declare a polygon to be a multi one with a single element... It is not trivial, but it is !
So, you should try st_multi(st_union())::geometry(multipolygon::srid) HTH Hugues -------- Message d'origine-------- De: [email protected] de la part de [email protected] Date: dim. 20/10/2013 08:19 À: [email protected] Objet : [postgis-users] typemod on ST_Union() results Hi All - I have a process where I split a large number of geometries by a second set of (smaller) geometries, then recombine them using a GROUP BY gid. Both source set and splitter set have the same SRID, and the results, and the combined results, therefore have an SRID. But in the age of typemod, geometry_columns sees a big zero SRID. ugh Using a cast inline has been suggested, but in this case, the result of the ST_Union() can be either Polygon or Multipolygon. As far as I know, the typemod has to know specifically which one.. (actually the result should be a single polygon each time but I havent enforced it yet) e.g. -- results in geometry_column SRID 0 create table dbg_z0_avgfs_blue as select p.gid, sum( p.avg_family_size_estimate * st_area(p.geom_purple) / 22500.0 ) as avg_family_size_estimate, st_union( p.geom_purple ) as geom from dbg_z0_avgfs_purple p GROUP BY p.gid; -- no no create table dbg_z0_avgfs_blue as select p.gid, sum( p.avg_family_size_estimate * st_area(p.geom_purple) / 22500.0 ) as avg_family_size_estimate, st_union( p.geom_purple )::geometry(Multipolygon,3310) as geom --< FAIL, sometimes its a Polygon from dbg_z0_avgfs_purple p GROUP BY p.gid; -- What to do? input welcome -- Brian M Hamlin OSGeo California Chapter blog.light42.com _______________________________________________ postgis-users mailing list [email protected] http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
<<winmail.dat>>
_______________________________________________ postgis-users mailing list [email protected] http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
