[postgis-users] ? different geometry types in one geometry column. Is it possible?
Nicolas Ribot
nicky666 at gmail.com
Fri Jul 29 05:47:43 PDT 2005
> Hi all!
>
> may be my question is too dummy, but anyway, I would
> be thankful for reply.
>
> Let's suppose, we have a database table with several
> data colums (say, thematic attributes) and one
> geometry column. These data attributes refer to both
> point and polygon geometries.
>
> Is it possible to put different geometry types (e.g.
> point, polygon) in one PostGIS geometry column?
>
> ... or I should create 2 tables with the same
> structure, but with different type definition of
> geometry column, i.e. separately for points and for
> polygons?
>
> Thanks a lot in advance for opinions/suggestions!
>
Hi Peter,
It is possible to store several geometry types in one postgis column.
Just declare this column to store 'GEOMETRY' type when calling
AddGeometryColumn(...) to register your geometric column.
You will then be able to store points, linestrings, polygons into this column.
Personally, I would prefer to have consistent tables with only one
geometric type in it (a little bit like shapefiles). I find it simpler
to manage, especially when doing geographic operations on my table.
Some of these operations work only on one precise data type (point or
polygon, for instance).
Why not splitting your dataset into several tables, one per geometric
type. Queries and views will allow you to have one "logical" view of
your data, if needed.
Nicolas
More information about the postgis-users
mailing list