1

I am trying to find the distance between two location P(x,y) and Q(a,b) in Java using MongoDB.

I am passing x,y that is latitude and longitude from my application and i get a,b as the nearest point, now what i am looking only distance between these two points. Somewhere i read geoNear support this, but i don't find Java code for geoNear, i got only commond which i can run on MongoDB command prompt.

Please let me know how to get distance calculation in Java Using MongoDB.

Thanks

geekIndiana
  • 87
  • 4
  • 14

1 Answers1

1

Another user just asked a similar question regarding how to use the geoNear command with the Java driver. Hopefully the answer will address your question as well.
Calculate distance in Java Using MongoDB

Community
  • 1
  • 1
Marc
  • 5,488
  • 29
  • 18