# Find a sublist with closest X and Y to a specific point in 3D

I have the following list of points and would like to know how I can find the sublist (i.e. point) which has a closest X and Y value to the X and Y value of a specific point (e.g here b1 ={{-20.6105, -290.292, -1914.28}}). I tried to use the following script but no answer.

https://pastebin.com/CdCdgyfA

B5 = Select[Data3D1, MemberQ[#,
Nearest[Data3D1[[All, 1]], b1[[1]]] &&
Nearest[Data3D1[[All, 2]], b1[[2]]]] &]


• It's possible that the nearest y coordinate and the nearest x coordinate belong to two different points. Do you want the EuclideanDistance or ManhattanDistance instead? Jul 1 '20 at 20:57
• Thank you flinty! Not sure, maybe EuclideanDistance works. I almost know which point I need from drawing but can not get that point coordinate. Jul 1 '20 at 21:02
• If you want to find the closest point in x,y ignoring the z coordinate, then do nf = Nearest[Data3D1, DistanceFunction -> Function[{p, q}, EuclideanDistance[Most[p], Most[q]]]]; - this will return a NearestFunction which you can use repeatedly which is more efficient. Try: nf[{-20.6105, -290.292, -1914.28}]` Jul 1 '20 at 21:04