How to add geometry column using pgAdmin
To do this with pgAdmin's "New Column..." dialog, if you can't find geometry
, then you might be able to find public.geometry
instead (if PostGIS was installed there, which is normal).
However, I advise against using pgAdmin for creating geometry columns, as it does not understand typmods used to define the geometry type and SRID.
The best way is using DDL to directly manipulate the table, e.g.:
ALTER TABLE locations ADD COLUMN geom geometry(PointZ,4326);
to add a geom
column of XYZ points (long, lat, alt).
Related videos on Youtube
Alessandro Carrese
“Man cannot discover new oceans unless he has the courage to lose sight of the shore.” - André Gide
Updated on June 27, 2022Comments
-
Alessandro Carrese almost 2 years
I'm using a database created in the PostgreSQL. In its schema there are two tables and in one of them I want to add a
geometry
column.The problem is that I created the postgis Extension (
CREATE EXTENSION postgis;
) for the database, but I'm not able to add this data type (geometry) column using pgAdmin.-
a_horse_with_no_name about 8 yearsShow us the statement you are running to add the columns and the error message you get (Edit your question). Did you commit the
create extension
? What doesselect extname from pg_extension
show you? Is PostGIS listed there?
-