Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a web application that needs to know the geometry type of a PostGIS table's geom field before inserting rows into it. I use the following query to determine the geometry type of the geom column:

SELECT GeometryType(geom) FROM my_schema.building LIMIT 1

This returns the geometry type of an actual row, so it does not work when my table is empty. How do I determine the geometry type of the geometry column itself?

share|improve this question
up vote 5 down vote accepted

The query could be run against the geometry_columns table in this way

SELECT type 
FROM geometry_columns 
WHERE f_table_schema = 'my_schema' 
AND f_table_name = 'building' 
and f_geometry_column = 'geom';

(or, if you are using a geography type, subsititute geometry_columns with geography_columns and f_geometry_column with f_geography_column)

share|improve this answer

Look for a table geometry_columns. All geo columns with srid and geometry type are registered here. If there is a column with type GEOMETRY there all geometry types can be stored.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.