3

Can anyone tell me what is the purpose of geography_columns view and geometry_columns view in a PostGIS database?

My geography_columns view is empty so I can't see what the purpose of it is.

Andre Silva
  • 10,259
  • 12
  • 54
  • 106
sam
  • 237
  • 1
  • 7
  • 2
    Please see this Question and Accepted answer - http://gis.stackexchange.com/questions/6681/postgis-what-are-the-pros-and-cons-of-geography-and-geometry-types – Mapperz Mar 18 '13 at 17:03

3 Answers3

6

geometry_columns is part of the Simple Features specification for OGC and ISO 19125-2:2004 Standards compliance. geography_columns is a non-Standard variation to support the geography type.

Mike T
  • 42,095
  • 10
  • 126
  • 187
4

Those views (tables in older versions) is there to help client software fast understand what it can expect of the datasets. Most of the information in those views is also in each geometry, like srid, number of dimensions and so on. But it would take a very long time for a client program to scan all the geometries to find that out.

Nicklas Avén
  • 13,241
  • 1
  • 39
  • 48
0

In a perhaps simplified explanation:

... geometry_columns is used by certain applications to be aware of which tables in the database contain geometry data. QGIS Training Manual 17: Spatial Database Concepts with PostGIS

In PostGIS, geometry_columns and geography_columns are system views that serve the purpose of providing metadata to correctly interpret and manipulate "spatial data" stored in within a PostgreSQL/PostGIS database.

The following is from the PostGIS Manual 4.6.2. GEOMETRY_COLUMNS View

In PostGIS geometry_columns is a view reading from database system catalog tables. This ensures that the spatial metadata information is always consistent with the currently defined tables and views. The view structure is: \d geometry_columns

Which includes the following columns: f_table_catalog, f_table_schema, f_table_name, f_geometry_column, coord_dimension, srid, and type.