Wednesday, April 02, 2008

SRID stuff in PostGIS

Got these errors?

ERROR: Operation on mixed SRID geometries

ERROR: new row for relation "dummy" violates check constraint "enforce_srid_the_geom"

Be sure all your geometry tables share the same srid! Srid is defined in tabel geometry_columns. update srid in this table using this statement:

select updategeometrysrid('dummy', 'the_geom', 4326);

Next update the srid in the geometries itself using this statement:

update dummy set the_geom = setsrid(the_geom,4326);

check it using:

select getsrid(the_geom) from dummy

select asewkt(the_geom) from dummy limit 10

4 comments:

Anonymous said...

Hey Thanks for the tip! I had the same problem with SRID and your guide help me solve it.

TheRealJimShady said...

As above, thanks for the help with setting a SRID, I couldn't get it to work but I can now.

TheRealJimShady said...

Thanks for the help with setting SRID.... really helpful....

Aksel said...

Hallelujah. SRID for dummies. Thanks!