[postgis-users] I need to simplify a table

strk at refractions.net strk at refractions.net
Mon Oct 10 09:31:39 PDT 2005


On Mon, Oct 10, 2005 at 09:42:23AM +0200, José Vicente Higón Valero wrote:
> Hi list,
> I'm a beginner in postgis and I want to simplify a table in order to
> serve a layer with full extent in mapserver.
> I have done these steps with a table of multipoligons:
> 
> First, I reduce the table with Simplify function:
> create table muni_simplify as (select gid,Simplify(the_geom,100) as
> the_geom,provincias from muni_pol_10k)
> 
> Second, I group the records:
> 
> create table muni_collect as (select Collect(the_geom) as the_geom from
> muni_simplify group by provincias)
> 
> Later, I try to export the created table to a shapefile but the
> geometrycollection isn't support by pgsql2shp, how can I collect into
> multipoligon?

You should first split in polygons, then collect again, something
like this:

	SELECT collect(geom) FROM
		( SELECT geom(dump(the_geom))) from mytable ) as foo;

> I can't use the function addGeometryType in the created
> table 'muni_collect', why?.

What does the error message say ?

> How can I preserve de column gid in the collect operation?

You're grouping multiple rows, each with its own gid, how would
you preserve the gid ?

> Is my approach correct?

Probably not, you can skip the collect() part and use pgsql2shp
directly. You just want a simplified version of your shapefile,
right ?

--strk;



More information about the postgis-users mailing list