Database Reference
In-Depth Information
SELECT l.gid, l.the_geom FROM
chp07.hydro h, chp07.lidar l
WHERE ST_3DDWithin(h.the_geom, l.the_geom, 5);
But, this isalittle bit of asloppy approach—we could endupwith duplicate LiDAR
points,sowewillrefineourquerywith
LEFT JOIN
and
SELECT DISTINCT
instead,
but continue using
ST_3DWithin
as our limiting condition, as follows:
SELECT DISTINCT ON (l.gid) l.gid, l.the_geom
FROM chp07.hydro h
LEFT JOIN chp07.lidar l ON
ST_3DDWithin(h.the_geom, l.the_geom, 5);
Now, we can visualize our returned points, as shown in the following image: