12.07.2015 Views

PostGIS 1.5.8 Manual - Fedora Project Packages GIT repositories

PostGIS 1.5.8 Manual - Fedora Project Packages GIT repositories

PostGIS 1.5.8 Manual - Fedora Project Packages GIT repositories

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>PostGIS</strong> <strong>1.5.8</strong> <strong>Manual</strong>55 / 310DescriptionAdds a geometry column to an existing table of attributes. The schema_name is the name of the table schema (unused forpre-schema PostgreSQL installations). The srid must be an integer value reference to an entry in the SPATIAL_REF_SYStable. The type must be an uppercase string corresponding to the geometry type, eg, ’POLYGON’ or ’MULTILINESTRING’.An error is thrown if the schemaname doesn’t exist (or not visible in the current search_path) or the specified SRID, geometrytype, or dimension is invalid.NoteViews and derivatively created spatial tables will need to be registered in geometry_columns manually, since AddGeometryColumnalso adds a spatial column which is not needed when you already have a spatial column. Refer toSection 4.3.4.This method implements the OpenGIS Simple Features Implementation Specification for SQL 1.1.This function supports 3d and will not drop the z-index.This method supports Circular Strings and CurvesExamples-- Create a new simple PostgreSQL tablepostgis=# CREATE TABLE my_schema.my_spatial_table (id serial);-- Describing the table shows a simple table with a single "id" column.postgis=# \d my_schema.my_spatial_tableTable "my_schema.my_spatial_table"Column | Type | Modifiers--------+---------+------------------------------------------------------------------------- ←↪id| integer | not null default nextval(’my_schema.my_spatial_table_id_seq’::regclass)-- Add a spatial column to the tablepostgis=# SELECT AddGeometryColumn (’my_schema’,’my_spatial_table’,’the_geom’,4326,’POINT ←↪’,2);--Add a curvepolygonSELECT AddGeometryColumn (’my_schema’,’my_spatial_table’,’the_geomcp’,4326,’CURVEPOLYGON ←↪’,2);-- Describe the table again reveals the addition of a new "the_geom" column.postgis=# \d my_schema.my_spatial_tableColumn | Type | Modifiers------------+----------+------------------------------------------------------------------------- ←↪id | integer | not null default nextval(’my_schema.my_spatial_table_id_seq’:: ←↪regclass)the_geom | geometry |the_geomcp | geometry |Check constraints:"enforce_dims_the_geom" CHECK (ndims(the_geom) = 2)"enforce_dims_the_geomcp" CHECK (ndims(the_geomcp) = 2)"enforce_geotype_the_geom" CHECK (geometrytype(the_geom) = ’POINT’::text ORthe_geom IS NULL)"enforce_geotype_the_geomcp" CHECK (geometrytype(the_geomcp) = ’CURVEPOLYGON

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!