[postgis-users] make the buffer in 3d

Obe, Regina robe.dnd at cityofboston.gov
Fri Sep 19 04:30:48 PDT 2008


Ihab,
 
If your cylinder is perpendicular to the x-y plane, then I think you may
be able to think of your cylinder as
 
the 2-d buffer integrated along the z-axis from say the base to base +
radius of interest (lets call the radius = 10)
 
So then your query I think can be simplified to 
 
if your point of interest (which is the center of the base of the
cylinder) is ST_MakePoint(1,2,3) and radius 10  (in this example my
cylinder is 3 units above ground)
 
SELECT pt.gid, pt.the_geom
FROM  ST_DWithin(pt.the_geom, ST_MakePoint(1,2,3),10)
AND ST_Z(pt.the_geom) Between 3 and 13
 
 
If your cylinder is partly below ground, then your 3 and 13 change to
say -8 and 2 or whatever.  So basically between zofinterest + 0  and
zofinterest + 10
 
Now if your cylinder is not perpendicular to x-y plane, then I think you
may still be able to use something similar to the above trick,
but you would need to redefine your axis relative to the azimuth of your
cylinder which I haven't given much thought to at all.
 
Hope that helps,
Regina

________________________________

From: eehab hamzeh [mailto:eehab40 at hotmail.com] 
Sent: Thursday, September 18, 2008 2:57 PM
To: Obe, Regina
Subject: RE: [postgis-users] make the buffer in 3d




Hello Regina,
 
Thanks you for your answer. I need to have a cylinder in the result
(visualize the cylinder). the cylinder will be resulted from the buffer
of point, the z value of the buffer will be same as the buffer radius
(or a value entered from the user)
 
then i need the to select any feature that are within the cylinder. 
 
thanks 
 
Ihab 
 


 

________________________________


> Date: Thu, 18 Sep 2008 10:50:03 -0700
> From: kneufeld at refractions.net
> To: eehab40 at hotmail.com
> Subject: Re: [postgis-users] make the buffer in 3d
> 
> Regina answered this question this morning.
>
http://postgis.refractions.net/pipermail/postgis-users/2008-September/02
1232.html
> 
> Essentially, just test if your points lie within some 3D distance of 
> eachother.
> 
> Did you try her logic?
> 
> I was mistaken in my previous message to you, as distance3D is not yet

> implemented, but length3D is. This is what her query does ... but it 
> only works between two points. If you want to test 3D polygons, you're

> stuck with testing those against a 3D cube (which I showed you how to
do 
> on the list).
> 
> Sorry, I'm not much more help.
> Kevin
> 
> 
> eehab hamzeh wrote:
> > Kevin,
> > 
> > Thanks, i will try to use sphere , what are the function for sphere
in 
> > the postgis
> > 
> > thanks
> > 
> > ihab
> > 
> > 
> >
------------------------------------------------------------------------
> > 
> > > Date: Thu, 18 Sep 2008 10:12:52 -0700
> > > From: kneufeld at refractions.net
> > > To: eehab40 at hotmail.com
> > > Subject: Re: [postgis-users] make the buffer in 3d
> > >
> > > There is no native JTS/GEOS geometry type "cylinder". So, unless
you
> > > are a guru in programming in GEOS and C, I would recommend you
don't
> > > even consider trying to compute the intersection of a 3d polygon
or line
> > > with a new cylinder object of your making.
> > >
> > > If you just wanted to test if a point lies within an abstract
cylinder
> > > object, you might be able to do this PL/pgSQL. A great resource is
the
> > > PostgreSQL website
> > > (http://www.postgresql.org/docs/8.3/static/plpgsql.html). You
could
> > > create a function that accepts a source point, a radius, a height,
and a
> > > candidate point. Then perhaps, using some math, determine if your
> > > candidate point is within the radius of the source point and
within some
> > > ; height of source point.
> > >
> > > ie.
> > > CREATE FUNCTION CylinderContainsPoint(center_pt geometry, radius
double
> > > precision, height double precision, candidate_pt geometry)
> > > RETURNS boolean AS $$
> > > DECLARE
> > > ....
> > > BEGIN
> > > ...
> > > RETURN ...;
> > > END;
> > > $$ LANGUAGE plpgsql;
> > >
> > >
> > > You're sure you need a cylinder, not a sphere? A sphere can be
tested
> > > on distance == 0 instead of testing for intersection, producing
the same
> > > results - this is easy to do with functions already in PostGIS.
> > >
> > > Have fun!
> > > -- Kevin
> > >
> > >
> > > eehab hamzeh wrote:
> > > > Thanks for your replay,
> > > >
> > > > what i need is to find all the object (3d polygon, line with z 
> > value or
> > > > points) that are intersect that cylinder that resulted from the
buffer.
> > > >
> > > > can you please give me the steps that i need to follow... Is
there is
> > > > any source to learn PL SQL?
> > > > How i can insert cylinder in postgis?
> > > > Thanks
> > > > ihab
> > > >
> > > >
> > 
> > 
> >
------------------------------------------------------------------------
> > Explore the seven wonders of the world Learn more! 
> >
<http://search.msn.com/results.aspx?q=7+wonders+world&mkt=en-US&form=QBR
E>



________________________________

Get news, entertainment and everything you care about at Live.com. Check
it out! <http://www.live.com/getstarted.aspx>  


-----------------------------------------
The substance of this message, including any attachments, may be
confidential, legally privileged and/or exempt from disclosure
pursuant to Massachusetts law. It is intended
solely for the addressee. If you received this in error, please
contact the sender and delete the material from any computer.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20080919/bc065c88/attachment.html>


More information about the postgis-users mailing list