[postgis-users] Creating a Flow Diagram with PostGIS

Bob Pawley rjpawley at shaw.ca
Sat May 31 15:46:29 PDT 2008


Hi Robert

I think I'm just begining to understand the role of the coordinates in the 
ST_Transform function.

In the example you gave for the ST_Translate function I don't yet understand 
the value that is used for x1, y1 and z1.

As it stands I get the error message that x1 is not a column.

Bob


----- Original Message ----- 
From: "Burgholzer,Robert" <rwburgholzer at deq.virginia.gov>
To: "PostGIS Users Discussion" <postgis-users at 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 <rjpawley at shaw.ca>:

> Robert
>




--------------------------------------------------------------------------------


> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> 




More information about the postgis-users mailing list