Your constraint is an SRID constraint, and you aren't setting your SRID when you construct your new points. Try this:
truncate stands; insert into stands select tmp_stands.gid as id, tmp_stands.strata as strata, tmp_stands.initage as initage, st_translate( tmp_stands.boundary, 500000, 5900000,0) as boundary, st_translate( ST_SRID(ST_MakePoint( tmp_stands.landx, tmp_stands.landy), 32755), 500000, 5900000 ) as location from tmp_stands; On Fri, Jan 30, 2009 at 10:58 AM, Jeff Hamann <jeff.ham...@forestinformatics.com> wrote: > I'm sure I must be doing something foolish, but I've hammered on this for an > hour or so, and can't seem to get this to complete. I'm trying to translate > a small dataset from a simple set of points and polygons: > > Table "public.stands" > Column | Type | Modifiers > ----------+----------+----------------------------------------------------- > id | integer | not null default nextval('stands_id_seq'::regclass) > strata | integer | not null > initage | integer | > boundary | geometry | > location | geometry | > Indexes: > "stands_pkey" PRIMARY KEY, btree (id) > "stands_boundary_gist" gist (boundary) > "stands_location_gist" gist (location) > Check constraints: > "enforce_dims_boundary" CHECK (ndims(boundary) = 2) > "enforce_dims_location" CHECK (ndims(location) = 2) > "enforce_geotype_boundary" CHECK (geometrytype(boundary) = > 'MULTIPOLYGON'::text OR boundary IS NULL) > "enforce_geotype_location" CHECK (geometrytype(location) = 'POINT'::text > OR location IS NULL) > "enforce_srid_boundary" CHECK (srid(boundary) = 32755) > "enforce_srid_location" CHECK (srid(location) = 32755) > > and when I try to populate the location field using the ST_MakePoint() > function, I seem to always get the same result: > > delete from stands; > insert into stands > select > tmp_stands.gid as id, > tmp_stands.strata as strata, > tmp_stands.initage as initage, > st_translate( tmp_stands.boundary, 500000, 5900000,0) as boundary, > st_translate( ST_MakePoint( tmp_stands.landx, tmp_stands.landy), 500000, > 5900000 ) as location > from tmp_stands; > > ERROR: new row for relation "stands" violates check constraint > "enforce_srid_location" > > which I don't understand because when I remove the > st_translate(st_makepoint()) command, the boundary translated just fine. In > fact, I can't go back and update the locations no matter what values I use. > If the points (which are in the middle of the polygons) violate the check > constraints, then why do the boundaries translate just fine? > > Jeff Hamann, PhD > Forest Informatics > > > > > > _______________________________________________ > postgis-users mailing list > postgis-users@postgis.refractions.net > http://postgis.refractions.net/mailman/listinfo/postgis-users > > _______________________________________________ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users