I think you need to set the SRID for the point you made, something like:
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_SetSRID(ST_MakePoint( tmp_stands.landx,
tmp_stands.landy), 32755), 500000, 5900000 ) as location from
tmp_stands;
I didn't actually try it, so my apologies if this guess is wrong...
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Jeff
Hamann
Sent: Friday, January 30, 2009 10:59 AM
To: [email protected]
Subject: [postgis-users] why isn't st_translate working for points and
polysin same dataset?
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
[email protected]
http://postgis.refractions.net/mailman/listinfo/postgis-users