[postgis-users] bbox of translated shapes not translated?

Robert W. Burgholzer rburghol at vt.edu
Fri May 24 08:09:12 PDT 2002


I am attempting to perform a query which locate adjacent neighbors based
on a flow direction (for hydrologic modelling purposes), the technique I
am using involves the following query:


gis=# select gid from microhup where (select
translate(centroid(the_geom),200,0,0) from microhup where gid = 1) ~
the_geom;


I believe this query should return the square adjacent to cell with gid
= 1, which is cell gid 2 (the center of cell 2 is approx. 200 pixels to
the right of cell 1). However, this query consistently returns gid 1.
I have verified that the translate function is returning the translated
point, and that the coordinates of the translated point are in fact
inside of the shape I wish to have returned. I also THINK I have
verified that calling box3d or extent on a result returned from
translate returns the bounding box of the original point or shape. Below
are some queries which I think indicate this.

Am I using the translate function improperly or is there a bug of some
sort?


gis=# select centroid(the_geom) from microhup where gid = 1;
                    centroid
-------------------------------------------------
 SRID=-1;POINT(557505.91488594 4118883.50884623)
(1 row)

gis=# select translate(centroid(the_geom),200,0,0) from microhup where
gid = 1;
                    translate
-------------------------------------------------
 SRID=-1;POINT(557705.91488594 4118883.50884623)
(1 row)

gis=# select box3d(centroid(the_geom)) from microhup where gid = 1;
                                    extent
------------------------------------------------------------------------------

 BOX3D(557505.91488594 4118883.50884623 0,557505.91488594
4118883.50884623 0)
(1 row)

gis=# select box3d(translate(centroid(the_geom),200,0,0)) from microhup
where gid = 1;
                                    box3d
------------------------------------------------------------------------------

 BOX3D(557505.91488594 4118883.50884623 0,557505.91488594
4118883.50884623 0)
(1 row)


gis=# select gid from microhup where
box3d(GeometryFromText('POINT(557705.91488594 4118883.50884623)',-1)) ~
the_geom;
 gid
-----
   2
(1 row)

gis=# select box3d(translate(the_geom,200,0,0)),box3d(the_geom) from
microhup where gid = 1;

box3d
|                                     box3d
--------------------------------------------------------------------------------+--------------------------------------------------------------------------------

 BOX3D(557398.627957722 4118824.32720986 0,557613.201814159
4118942.69048259 0) | BOX3D(557398.627957722 4118824.32720986
0,557613.201814159 4118942.69048259 0)(1 row)





More information about the postgis-users mailing list