[postgis-users] why isn't st_translate working for points and polys in same dataset?

Jeff Hamann jeff.hamann at forestinformatics.com
Fri Jan 30 10:58:49 PST 2009


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




-------------- next part --------------
A non-text attachment was scrubbed...
Name: jeff_hamann.vcf
Type: text/x-vcard
Size: 284 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20090130/17538c3f/attachment.vcf>


More information about the postgis-users mailing list