[postgis-users] 3D filtering?

Paul Ramsey pramsey at cleverelephant.ca
Thu May 8 11:12:27 PDT 2008

Because you are working with points, the answer is "yes", barely...

create or replace function d3d(geometry, geometry) returns float as
'select sqrt((st_x($1)-st_x($2))^2 + (st_y($1)-st_y($2))^2 +
(st_z($1)-st_z($2))^2)' language sql;

select b.* from a join b on (st_dwithin(a.geom, b.geom, [distance])
and d3d(a.geom, b.geom) < [distance]);

if st_dwithin worked in 3d the second clause would not be necessary,
but it doesn't. neither to the indices, so it could be slow, if you
have a lot of variation in z.


On Thu, May 8, 2008 at 10:56 AM, Decarlo,  Thomas R. (LARC-B702)[NCI
INFORMATION SYSTEMS] <thom.decarlo at nasa.gov> wrote:
> I've got a question about processing 3D geometry data and I'm not sure
> if the query functions in PostGIS can help me.
> I have two tables (A and B) of 3D point features in a Euclidean space.
> I want to select all the points in B that are NOT within some distance
> (S) of any of the points in A.
> Can I do this query using PostGIS? If yes, what would the query look
> like?
> Thanks!
> Thom
> --
> Thom DeCarlo
> -------------------------------------
>     That Which Does Not Kill Me
>     Can Still Hurt Really Bad.
> _______________________________________________
> 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