Search code examples
javascriptstring-comparisonstreet-address

What's the best way to compare two street addresses?


I want to compare two postal addresses, Will it be a bad practice to consider addresses as strings and compare the similarity between them. Is there a standard algorithm that to implement in the programming language I use? or is there a free api to do that (with quota limit)? In reality I am open to any idea or advice I am not posting my problem to be solved here but to receive index that guides my search. Thank you for reading that.


Solution

  • If I am not wrong, then what you are looking for is "GeoCoding" to learn more click here

    In simple terms what you need to do is, convert the address into Geocodes i.e. longitude and latitude similar to (latitude 37.423021 and longitude -122.083739) and then you will need to have the addresses you want to check against already converted into geocodes with which you can check against like a normal array comparison.

    If you need to check if an address belongs to a particular region then you will need to have geocoding information for each region and then you can geocode the host address and use any vector algorithm that check if the given point fall's into it or not!