[英]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)?
或者是否有免费的 api 来做到这一点(有配额限制)? 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.简单来说,您需要做的是,将地址转换为地理编码,即经度和纬度类似于(纬度 37.423021 和经度 -122.083739),然后您需要将要检查的地址转换为地理编码可以像普通数组比较一样进行检查。
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:您可以暂时将其更改为一个大字符串,例如,如果您的地址位于 1935 Eastwood Road,则可以执行以下操作:
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.假设不是手动设置所有变量,而是从数据库等中获取它们。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.