[postgis-users] set srid in geometry column
David Kaplan
david.kaplan at ird.fr
Tue Jan 4 06:13:24 PST 2011
Hi,
I am getting this "cursor states lost" error as well in QGIS and I
believe that this is some sort of recent QGIS problem because I have
found a number of recent posts of this sort on the web (perhaps since
updating to 1.6.0?). In my case, I have checked that all the SRID's are
correct and agree, and that the appropriate constraints have been
applied to the table and the problem hasn't gone away.
Note that I am only having this problem when trying to import LINESTRING
layers into QGIS. Point and polygon layers seem to work fine. Are you
also finding the same thing?
Cheers,
David
On Tue, 2011-01-04 at 13:19 +0100, didier peeters wrote:
> Thank you Rich,
>
> I understand what you say but this leads to another question :
>
> Actually everything started when I first imported a basic table (imported it with SPIT in QGis) and all of the other table in my databases were derived from this first one by SQL scripts. What I'v now noticed is that the first table had some constraints among which this one : CONSTRAINT "enforce_srid_the_geom" CHECK ((srid(the_geom) = -1))
> The other tables don't have any constraint and when I try to update their geometry srid with updategeometrysrid I get an error related to this lack, while when doing this for my first table I obtain the new constrain value : CONSTRAINT "enforce_srid_the_geom" CHECK ((srid(the_geom) = 4326)).
>
> So does this mean that each time I create a new table from the first one (like with a simple "SELECT ... FROM first_table WHERE ....") I must execute an ALTER TABLE statement to add this constraint or is there another (easier) way to do this ?
>
>
> Thanks again.
>
> Didier
>
>
> Le 2 janv. 2011 à 03:54, Richard Greenwood a écrit :
>
> > 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
> > _______________________________________________
> > postgis-users mailing list
> > postgis-users at postgis.refractions.net
> > http://postgis.refractions.net/mailman/listinfo/postgis-users
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
--
**********************************
David M. Kaplan
Charge de Recherche 1
Institut de Recherche pour le Developpement
Centre de Recherche Halieutique Mediterraneenne et Tropicale
av. Jean Monnet
B.P. 171
34203 Sete cedex
France
Phone: +33 (0)4 99 57 32 27
Fax: +33 (0)4 99 57 32 95
http://www.ur097.ird.fr/team/dkaplan/index.html
http://www.amped.ird.fr/
**********************************
More information about the postgis-users
mailing list