title: Map locations to their nearest location based on latitude and longitude
body: <p>I have two set of locations say A(20K locations) and B(2k locations). I want to have a map for all locations in set A to their closest location in set B based on their latitude and longitude.</p>
  
  <p>Is there any solution in java or R.
  Java solution preferred.</p>