Oh, I saw my own typo (forget the arguments for pointdistance3d). the query 
should be

Select * from table1, table2 
where table1.the_geom &&ST_Expand(table2.the_geom, 0.1) and
 table2.the_geom && ST_Expand(table1.the_geom, 0.1) and 
pointdistance3d(table1.the_geom, table2.the_geom)<=0.1;

/Nicklas

2010-05-22 Nicklas Avén  wrote:

Hallo
>
>The ST_DWithin fuction will only check the 2d distance and not care it the 
>points are far from each other in z direction.
>
>If you need to also check they are close in z-direction I guess the easiest 
>way is to calculate the 3d distance between the points with Pythagorean 
>theorem. The cleanest maybe is to make a function of it like this:
>
>
>create or replace function pointdistance3d(p1 geometry, p2 geometry)
>returns double precision 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';
>
>
>then to get some speed of it you can use st_dwithin to do a first index-based 
>search. That is as said only a 2d calculation, but if the distance is more 
>than your tolerance in 2d it will be also in 3d.
>
>I think the most effective way of doing this is to only do the bounding box 
>comparison that is built into st_dwithin and then go straightly to the 3d 
>calculation. That would look something like this if we use the tolerance 0.1 
>meters (requires based coordinate sytem):
>
>Select * from table1, table2 where table1.the_geom && 
>ST_Expand(table2.the_geom, 0.1) and
>table2.the_geom && ST_Expand(table1.the_geom, 0.1) and 
>pointdistance3d<=0.1;
>
>Hope that helps
>
>Nicklas
>
>
>Try:
>>   ST_DWithin(point1, point2, 0.00001) 
>>
>>-F
>>
>>>>
2010/5/22 eehab hamzeh <eeha...@hotmail.com>
>>>>
Hello 
>>
>>I want to check if two points are identical, the points has x,y,z coordinates 
>>and they are not exactly the same, i need to check the intersection between 
>>them with tolerance value. any direction of how to do that.
>>
>>Thank 
>>
>>kind regards
>>>>

>>
>>
>>
>>
>>Hotmail: Powerful Free email with security by Microsoft. Get it now.
>>_______________________________________________
>>postgis-users mailing list
>>postgis-users@postgis.refractions.net
>>postgis.refractions.net/mailman/listinfo/postgis-users
>>
>>
>>
_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users

Reply via email to