<html>
<head>
</head>
<body>Oh, I saw my own typo (forget the arguments for pointdistance3d). the query should be<br />
        <br />
        Select * from table1, table2 <br />
        where table1.the_geom && 
ST_Expand(table2.the_geom, 0.1) and<br />
         table2.the_geom && ST_Expand(table1.the_geom, 0.1) and <br />
        
pointdistance3d(table1.the_geom, table2.the_geom)<=0.1;<br />
        <br />
        /Nicklas<br />
        <br />
         2010-05-22 Nicklas Avén  wrote:<br />
        <br />
        Hallo<br />
        ><br />
        >
        The ST_DWithin fuction will only check the 2d distance and not care it the points are far from each other in z direction.<br />
        ><br />
        >
        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:<br />
        ><br />
        ><br />
        >
        create or replace function pointdistance3d(p1 geometry, p2 geometry)<br />
        >
        returns double precision as<br />
        >
        $$<br />
        >
        select sqrt((st_x($1)-st_x($2))^2 + (st_y($1)-st_y($2))^2 + (st_z($1)-st_z($2))^2);<br />
        >
        $$<br />
        >
        language 'sql';<br />
        ><br />
        ><br />
        >
        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.<br />
        ><br />
        >
        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):<br />
        ><br />
        >
        Select * from table1, table2 where table1.the_geom && ST_Expand(table2.the_geom, 0.1) and<br />
        >
        table2.the_geom && ST_Expand(table1.the_geom, 0.1) and pointdistance3d<=0.1;<br />
        ><br />
        >
        Hope that helps<br />
        ><br />
        >
        Nicklas<br />
        ><br />
        ><br />
        >
        Try:<br />
        >
        >   ST_DWithin(point1, point2, 0.00001) <br />
        >
        ><br />
        >
        >-F<br />
        >
        ><br />
        >
        >>
        >
        <div>2010/5/22 eehab hamzeh <<a>eehab40@hotmail.com</a>><br />
                >
                >





>
                >
                <div>
Hello <br />
                        >
                        ><br />
                        >
                        >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.<br />
                        >
                        ><br />
                        >
                        >Thank <br />
                        >
                        ><br />
                        >
                        >kind regards<br />
                        >
                        >>
                        >
                        <div><br />
                                >
                                ><br />
                                >
                                ><br />
                                >
                                ><br />
                                >
                                ><br />
                                >
                                ><hr />
                                
                                Hotmail: Powerful Free email with security by Microsoft. <a href="https://signup.live.com/signup.aspx?id=60969" target="_blank">Get it now.</a></div>

</div>
<br />
                >
                >_______________________________________________<br />
                >
                >
postgis-users mailing list<br />
                >
                ><a>postgis-users@postgis.refractions.net</a><br />
                >
                ><a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">postgis.refractions.net/mailman/listinfo/postgis-users</a><br />
                >
                ><br />
                >
                ></div><br />
        >
        >



</body>
</html>