[postgis-users] RE: 3d spatial bounding box

ebcorder at rockwellcollins.com ebcorder at rockwellcollins.com
Thu Feb 2 08:13:40 PST 2006



__________________


Hi, I am a newbie trying out the Postgis for a weather forecasting
database.  I am trying to understand the 3d power of Postgis so I tried
this example.
I want to test for 3d relationships but I only get 2d results.   I loaded
3d data into the database and attempted a && (intersect in the bounding
box).   This is what I did:   Below the results are correct if only
considering 2d.

geom_test=# create table polygon3d (id int4);
CREATE TABLE
geom_test=# select addgeometrycolumn('polygon3d','shape',-1,'POLYGON',3);

The data is formatted latitude,longitude,altitude. Each vertices is
separated by comma.
Begin;
insert into polygon3d (id,shape) values (1,geomfromEWKT('POLYGON((29.212389
-81.033350 10,29.211220 -81.033817 10,29.210930 -81.033338 10,29.211520
-81.030326 10,29.212582 -81.030461 10,29.212389 -81.033350 10))',-1));
insert into polygon3d (id,shape) values (2,geomfromEWKT('POLYGON((29.214342
-81.036386 30,29.210082 -81.034641 30,29.213140 -81.036927 30,29.214342
-81.036386 30))',-1));
insert into polygon3d (id,shape) values (3,geomfromEWKT('POLYGON((29.214427
-81.033325 20,29.209782 -81.031445 20,29.209739 -81.031199 20,29.210286
-81.029269 20,29.210383 -81.029404 20 , 29.214427 -81.033325 20))',-1));
commit;

I perform a query
geom_test=# select id from polygon3d where shape &&
geomfromEWKT('POLYGON((29.214427 -81.033325 20,29.209782 -81.031445 20,
29.209739 -81.031199 20,29.210286 -81.029269 20,29.210383 -81.029404 20,,
29.214427 -81.033325 20))');
 id
----
  1
  3
(2 rows)


I expected the result to return none because the height for polygon 1 is
10, polygon 2 30 and polygon 3 20 therefore they should not be bounded.
I want to test for 3d what must I do?



Elwood Cordery
Rockwell Collins
Contract Software Engineer
319-295-8248




More information about the postgis-users mailing list