Bob, ST_X, ST_Y,ST_Z only work with points. You need ST_Centroid to get the centroid point of the object.
Try using ST_X(ST_Centroid(the_geom)) etc. Hope that helps, Regina -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bob Pawley Sent: Sunday, June 01, 2008 5:17 PM To: PostGIS Users Discussion Subject: Re: [postgis-users] Creating a Flow Diagram with PostGIS Hi Robert I managed to get the function working - in part. UPDATE graphics.process_dgm Set the_geom = translate(the_geom, (x1 - st_x(the_geom)), (y1 - st_y(the_geom))) where graphics.process_dgm.id = '178' and graphics.process_dgm.id = '181'; This will move a point from one location to another depending on what I insert into the x and y column. But when I attempt to move the geometry that I want moved I get a message "Argument to X() must be a point". What am I doing wrong?? Bob ----- Original Message ----- From: "Burgholzer,Robert" <[EMAIL PROTECTED]> To: "PostGIS Users Discussion" <postgis-users@postgis.refractions.net> Sent: Friday, May 30, 2008 11:54 AM Subject: [postgis-users] Creating a Flow Diagram with PostGIS Bob, I am taking this online, since it is relevant to PostGIS, and I want to make sure that others review my comments for veracity Original Question: > At the moment I am importing dxf files, representing process and devices, > into Postgis. > > Say I want to make two processes A & B. > > I import the DXF graphic representing A and B into Postgis. > > I want B to be the first process and the output of B goes to A which is > situated to the right of or below B. > > Using ST_Translate I need to know the distance in both x and y from the > library to where I want to place the images and plug thos values into the > Transform function. Perhaps there is a method of building a function to do > this? > > Bob > > My response: You do not want to use transform for the location. It has nothing to do with the location, only to the projection, i.e., spatial coordinate system. You DO want translate for location, however. Transform might be useful if your objects are not imported from a standard library that you generate, or are not in the projection that you wish to use for your interface. CASE 1 (Objects are in same projection as your "Workspace"): In this case, we don't really have to "know" where the starting location is, since we have functions that can derive this. Also, since our shapes are in the same projection as the workspace, we only need the translate function. For this example, we are storing our components in a table called "widget_table", and the geometry column is "the_geom". Let's assume that your original shape location coordinates are (x0, y0, z0), which can be obtained from the geometry column by using the function st_x, st_y, and st_z, and you want to move them to be located at (x1,y1,z1). For this, the following translate call would work: UPDATE widget_table SET the_geom = translate(the_geom, (x1 - st_x(the_geom)), (y1 - st_y(the_geom)), (z1 - st_z(the_geom))) ; CASE 2 (you are importing user defined shapes, or shapes in disparate projections): In this case you WOULD need transform(), to take them from whatever their source projection is, into whatever their base projection is, as follows (assuming that the workspace coordinate system is decimal degrees): UPDATE widget_table SET the_geom = transform(the_geom, 4326); Then, you would need to relocate them to some other point by using the function above. That function could be encapsulated into its own PG function of course, something like relocate(x1,y1,z1) which would hide all of the calls to st_x,y and z. The catch of course, is that it is essential that we KNOW the projection of our shapes before importing them. That is actually the real sticky part here, not the movement of them. HTH, r.b. Quoting Bob Pawley <[EMAIL PROTECTED]>: > Robert > ---------------------------------------------------------------------------- ---- > _______________________________________________ > 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 _______________________________________________ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users