I forgot this part of your question. To go from degrees to KM, multiply by DistanceUtils.DEG_TO_KM.
~ David Smiley Freelance Apache Lucene/Solr Search Consultant/Developer http://www.linkedin.com/in/davidwsmiley On Mon, Dec 22, 2014 at 9:35 AM, <ankit.mura...@ril.com> wrote: > > Thanks for the suggestion. > > I am using Lucene Vincenty to find the distance but the output is strange. > I cannot figure out how to convert the output to metres/kilo metres. > > After extensive search on google, I found GeoDesy source code which gives > me distance in metres. This is also the implementation of Vincenty. > > However, I do not intend to use GeoDesy. > > I would prefer to use inbuilt Vincenty of Lucene to get the distance in > metres but I am unable to find this. > > Please suggest. > > > -----Original Message----- > From: david.w.smi...@gmail.com [mailto:david.w.smi...@gmail.com] > Sent: 22 December 2014 19:33 > To: java-user@lucene.apache.org > Subject: Re: Distance between 2 points Lucene Spatial > > Hi Ankit, > > Vincenty is the most accurate one — it is the benchmark for the other 2’s > tests for the true answer. In theory it produces the same answers as the > other 2 simpler formulas you mention but is “numerically robust” for > computers. Note that the world model used by Spatial4j when in “geo” mode > is a spherical model. For more accurate distance computation on Earth, use > an ellipsoidal model. If you google “Vincenty”, it's easy to find > Vincenty’s ellipsoidal formula with the constants for Earth; that is most > often what he is associated with. > > ~ David Smiley > Freelance Apache Lucene/Solr Search Consultant/Developer > http://www.linkedin.com/in/davidwsmiley > > On Mon, Dec 22, 2014 at 12:35 AM, <ankit.mura...@ril.com> wrote: > > > > Dear All, > > > > We are using lucene spatial strategy to find out the distance between > > a pair of Lat/Long. > > > > Given a pair of Lat/Long I need to find the near accurate distance > > between these 2 points. > > > > I have used Haversine, LawOfCosines and Vincernity however unable to > > decide which will provide the best output(accurate output). > > > > There is not just 1 point but millions of points which will need to be > > passed into against a set of point to find the closest point. > > > > Which might be the best approach. Additionally, I observed from the > > API, that the output of these 3 algorithms are in Degress. Is there > > any API in lucene which can return the output in double,long,int etc. > formats. > > > > > > "Confidentiality Warning: This message and any attachments are > > intended only for the use of the intended recipient(s). > > are confidential and may be privileged. If you are not the intended > > recipient. you are hereby notified that any review. re-transmission. > > conversion to hard copy. copying. circulation or other use of this > > message and any attachments is strictly prohibited. If you are not the > > intended recipient. please notify the sender immediately by return > > email. > > and delete this message and any attachments from your system. > > > > Virus Warning: Although the company has taken reasonable precautions > > to ensure no viruses are present in this email. > > The company cannot accept responsibility for any loss or damage > > arising from the use of this email or attachment." > > > "Confidentiality Warning: This message and any attachments are intended > only for the use of the intended recipient(s). > are confidential and may be privileged. If you are not the intended > recipient. you are hereby notified that any > review. re-transmission. conversion to hard copy. copying. circulation or > other use of this message and any attachments is > strictly prohibited. If you are not the intended recipient. please notify > the sender immediately by return email. > and delete this message and any attachments from your system. > > Virus Warning: Although the company has taken reasonable precautions to > ensure no viruses are present in this email. > The company cannot accept responsibility for any loss or damage arising > from the use of this email or attachment." >