I have two tables "ad" and "st" in my postgres DB. Table ad has 87 rows while st has 16,060 rows. Following code works perfectly to select st.geom (streets' geometry) within 50 meter radius with respect to every address locations.
SELECT ad.gid As address_id, ad.geom As address, st.geom As streets FROM st JOIN ad ON ST_DWithin(ad.geom, st.geom, 50.0) Order by address_id
However, what I noticed that in the query results some address IDs are missing (for example; 5, 51, 56 etc.) which is not desired as I needed to search nearest streets for all 87 rows of ad table. Here is the screen shot of query results.
Using this command, I cross checked that address_id_5 does exist in the respective column.
Select ad.gid from ad;
Can some one please help me to understand this ambiguity? There are seven address locations missing out of 87. I have tried the same on other data as well and the problem persists. Both tables contain spatial indexes already.