Google Geocode API返回不确定的结果 [英] Google geocode API returns inconclusive results

查看:70
本文介绍了Google Geocode API返回不确定的结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于我尝试进行地址解析的某些地址,google返回的结果没有适当的结论.

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

以下是示例,但这不是孤立的事件.返回的第一个结果是完全匹配,但是google将其标记为"partial_match":

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

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

我在这里的问题是确定哪个是正确的匹配项.在这种情况下,部分匹配"标志没有用,因为在所有匹配结果上将其设置为"true".在这种情况下,我可以测试街道地址,城市,州和/或邮递区号是否相等,但是,如果我向Google发送的邮件与作为响应得到的邮件之间的拼写差异很小,那也不行. (例如:公路"与公路").

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?

谢谢!

推荐答案

Google在逼近地址方面做得很好.您正在寻找的是地址验证. SmartyStreets 提供了一个地址验证API,该API在其结果中具有决定性作用.这是SmartyStreets API针对该地址返回的内容:

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_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".这就是USPS所说的经过验证的交付点-您知道那是一个真实的地址. SmartyStreets使用官方的最新USPS数据,并且是经过CASS认证的软件提供商.

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.

API对非营利组织,教育机构和低使用率用户免费.收到SmartyStreets的结果后,您就可以使用Google对其进行地理编码.全面披露:我是SmartyStreets的开发人员.

The API is free for non-profits, educational institutions and low-usage users. Once you've received a result from SmartyStreets you could then geocode it with Google. Full disclosure: I'm a developer at SmartyStreets.

添加了纬度/经度字段(新发布)

Added Latitude/Longitude fields (newly released)

这篇关于Google Geocode API返回不确定的结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆