Google 地理编码 API 返回不确定的结果

发布于 2025-01-05 10:20:41 字数 715 浏览 1 评论 0原文

对于我尝试进行地理编码的某些地址,谷歌会返回不恰当的不确定结果。

以下是一个例子,但这并不是一个孤立的事件。第一个返回的结果是完全匹配的,但是谷歌将其标记为“partial_match”:

Street address: 16160 Frederick Rd 
City:           Gaithersburg 
State:          MD
Zip code:       20877

链接:http://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=16160%20Frederick%20Rd,+Gaithersburg,+MD,+20877

我的问题这是确定哪个是正确的匹配。在这种情况下,“部分匹配”标志没有用,因为它在所有匹配结果上都设置为“true”。在这种情况下,我可以测试街道地址、城市、州和/或邮政编码的相等性,但是,如果我发送给谷歌的内容和我得到的响应之间的拼写存在微小差异,那将也不工作。 (例如:“Road”与“Rd”)。

我在这里做错了什么吗?有没有一种确定的方法来区分我不熟悉的精确匹配?

谢谢!

For some addresses that I attempt to geocode, google returns inappropriately inconclusive results.

The following is an example, but it is not an isolated incident. The first returned result is the exact match, however google flags it as a "partial_match":

Street address: 16160 Frederick Rd 
City:           Gaithersburg 
State:          MD
Zip code:       20877

Link: http://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=16160%20Frederick%20Rd,+Gaithersburg,+MD,+20877

My issue here is in determining which is the correct match. In this case, the "partial match" flag is not useful because it is set to "true" on all matching results. In this case, I could test for equality on the street address, city, state, and/or zip, however, if there is even a small difference in spelling between what I send google, and what I get as a response, that will not work either. (Example: "Road" vs "Rd").

Am I doing something wrong here? Is there a conclusive way to distinguish the exact match that I am unfamiliar with?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

纵情客 2025-01-12 10:20:41

谷歌在地址近似方面做得非常出色。您正在寻找的是地址验证。 SmartyStreets 提供了一个地址验证 API,其结果是决定性的。以下是 SmartyStreets API 为该地址返回的内容:

输入:

https://api.qualifiedaddress.com/street-address/?street=16160%20Frederick%20Rd&street2=&city=gaithersburg&state=md&zipcode=20877&candidates=10&auth-token= YOUR_AUTHENTICATION_TOKEN_HERE

输出:

[
    {
        "input_index": 0,
        "candidate_index": 0,
        "delivery_line_1": "16160 Frederick Rd",
        "last_line": "Gaithersburg MD 20877-4011",
        "delivery_point_barcode": "208774011604",
        "components": {
            "primary_number": "16160",
            "street_name": "Frederick",
            "street_suffix": "Rd",
            "city_name": "Gaithersburg",
            "state_abbreviation": "MD",
            "zipcode": "20877",
            "plus4_code": "4011",
            "delivery_point": "60",
            "delivery_point_check_digit": "4"
        },
        "metadata": {
            "record_type": "S",
            "county_fips": "24031",
            "county_name": "Montgomery",
            "carrier_route": "C004",
            "congressional_district": "08",
            "latitude": 39.12162,
            "longitude": -77.17619,
            "precision": "Zip9"
        },
        "analysis": {
            "dpv_match_code": "Y",
            "dpv_footnotes": "AABB",
            "dpv_cmra": "N",
            "dpv_vacant": "N",
            "ews_match": false
        }
    }
]

通知“dpv_match_code”是“Y”。这是美国邮政局对经过验证的投递点的说法 - 您知道它是该点的真实地址。 SmartyStreets 使用最新的官方 USPS 数据,并且是 CASS 认证的软件提供商。

一旦您收到来自 SmartyStreets 的结果,您就可以使用 Google 对其进行地理编码。全面披露:我是 SmartyStreets 的开发人员。

编辑:添加纬度/经度字段(新发布)

Google does a wonderful job at address approximation. What you're looking for is address verification. SmartyStreets provides an address verification API that is conclusive in it's results. Here's what the SmartyStreets API returns for that address:

Input:

https://api.qualifiedaddress.com/street-address/?street=16160%20Frederick%20Rd&street2=&city=gaithersburg&state=md&zipcode=20877&candidates=10&auth-token=YOUR_AUTHENTICATION_TOKEN_HERE

Output:

[
    {
        "input_index": 0,
        "candidate_index": 0,
        "delivery_line_1": "16160 Frederick Rd",
        "last_line": "Gaithersburg MD 20877-4011",
        "delivery_point_barcode": "208774011604",
        "components": {
            "primary_number": "16160",
            "street_name": "Frederick",
            "street_suffix": "Rd",
            "city_name": "Gaithersburg",
            "state_abbreviation": "MD",
            "zipcode": "20877",
            "plus4_code": "4011",
            "delivery_point": "60",
            "delivery_point_check_digit": "4"
        },
        "metadata": {
            "record_type": "S",
            "county_fips": "24031",
            "county_name": "Montgomery",
            "carrier_route": "C004",
            "congressional_district": "08",
            "latitude": 39.12162,
            "longitude": -77.17619,
            "precision": "Zip9"
        },
        "analysis": {
            "dpv_match_code": "Y",
            "dpv_footnotes": "AABB",
            "dpv_cmra": "N",
            "dpv_vacant": "N",
            "ews_match": false
        }
    }
]

Notice that the "dpv_match_code" is "Y". That's USPS-speak for a verified delivery point--you know that it's a real address at that point. SmartyStreets uses official, current USPS data and is a CASS-Certified software provider.

Once you've received a result from SmartyStreets you could then geocode it with Google. Full disclosure: I'm a developer at SmartyStreets.

EDIT: Added Latitude/Longitude fields (newly released)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文