简体   繁体   中英

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.

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 ie 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!

You can temporarily change it into one big string, for example if you had an address at 1935 Eastwood Road, you could do:

var num = "1935";
var road = "Eastwood";
var roadname = "Road";

var fullRoadName = num + " " + road + " " + roadname;
console.log(fullRoadName);
//Console will print out '1935 Eastwood Road'

Assuming instead of setting all the variables manually they are grabbed from a database or such.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM