[postgis-users] set srid in geometry column

Richard Greenwood richard.greenwood at gmail.com
Sat Jan 1 18:54:36 PST 2011


On Sat, Jan 1, 2011 at 11:49 AM, didier peeters <dpeeter1 at ulb.ac.be> wrote:
> Hi everybody,
>
> I use QGis to display postgis data and in the geometry column I have srid = '-1' (no value).  Everything works fine, I only have to specify the srid in the QGis project but when I set the right srid directly into the geometry column table (srid = 4326, for WGS 84) I get the following error when trying to load the layer in QGis.

The -1 in the geometry_columns table probably means that a SRID was
not specified when the data was imported. The updategeometrysrid()
function can be used to assign a SRID to the geometry objects in a
table. This does not transform the data to a new coordinate system, it
simply assigns a new SRID, so it's up to you to choose the correct
SRID:

   select updategeometrysrid('schema_name_optional', 'table_name','
geometry_column_name', 4326);

After assigning the new (hopefully correct) SRID to all of geometry
objects in the table, use the populate_geometry_columns() to update
the geometry_columns table. This function examines all tables and view
in the database and inserts/deletes/updates rows as appropriate.

   select populate_geometry_columns();

Rich

-- 
Richard Greenwood
richard.greenwood at gmail.com
www.greenwoodmap.com



More information about the postgis-users mailing list