[postgis-users] is there any 'common' geometry type?

Li Li fancyerii at gmail.com
Tue Apr 13 19:53:10 PDT 2010


How to let the table allow both polygon and multipolygon?
I create geometry column use  SELECT AddGeometryColumn
('','china_block','geom',4326,'POLYGON',2);
I tried SELECT AddGeometryColumn ('','mytable','geom',4326,'MULTIPOLYGON',2);

it says
ERROR:  column "geom" of relation "china_block" already exists
CONTEXT:  SQL statement "ALTER TABLE public.china_block ADD COLUMN
geom geometry "
PL/pgSQL function "addgeometrycolumn" line 121 at EXECUTE statement
SQL statement "SELECT AddGeometryColumn('', $1 , $2 , $3 , $4 , $5 , $6 )"
PL/pgSQL function "addgeometrycolumn" line 4 at SQL statement

As you suggested, I can change POLYGON to MULTIPOLYGON.
But if the column has LINESTRING and POLYGON, what should I do?

thanks.

2010/4/13 Stephen Woodbridge <woodbri at swoodbridge.com>:
> Li Li wrote:
>>
>> I have a table from oracle. a spatial column geom  is SDO_GEOMETRY. I
>> migrated it to postgis. this geom column has record with type of
>> POLYGON and MULTIPOLYGON. is there any common type that can store any
>> geometry?
>
> The common type in PostGIS is "geometry", but you can also change the
> constraints you table to allow both POLYGON and MULTIPOLYGON.
>
> Or you can do something like:
>
> update mytable set the_geom = ST_Multi(the_geom)
>  where ST_GeometryType = "POLYGON';
>
> -Steve W
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>



More information about the postgis-users mailing list