Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Physical distance between two places

I need to measure the physical distance between two places whose names are provided as strings. Since sometimes the names are written slightly differently, I was looking for a library that could help me measure the difference and then combine it with a measure of the latitude and longitude to select the correct matches. Preferred languages: Java or PHP.

Any suggestions?

like image 676
PieroP Avatar asked Feb 03 '23 11:02

PieroP


2 Answers

Have a look at the Levenshtein distance. This is a way of measuring how different two strings are from one another.

Hopefully I understood your question correctly; using "distance" in the same sentence as "latitude and longitude" could be confusing!

like image 192
Greg Hewgill Avatar answered Feb 06 '23 00:02

Greg Hewgill


Although written in c (with python and tcl bindings), libdistance would be a tool for applying several distances metrics on strings/data.

Metrics included:

  • bloom
  • damerau
  • euclid
  • hamming
  • jaccard
  • levenshtein
  • manhattan
  • minkowski
  • needleman_wunsch
like image 37
miku Avatar answered Feb 06 '23 01:02

miku