Google 地图 API - 地理编码精度图表?

发布于 2024-09-01 15:58:19 字数 96 浏览 5 评论 0原文

在 Google Maps API 文档中的哪里可以找到解释地理编码查找的准确度值的表格?

V2 和 V3 之间的值范围是否发生变化?

Where in the Google Maps API docs can I find a table explaining the accuracy values of Geocode lookups?

Has the range of values changed in between V2 and V3?

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

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

发布评论

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

评论(3

假面具 2024-09-08 15:58:19

以下是 Google 地图 API 文档。它包含一个包含精度值的表格...

http://code.google .com/apis/maps/documentation/reference.html#GGeoAddressAccuracy

常量 | 描述
0 位置未知。
1 国家级准确度。
2 地区(州、省、地等)级别精度。
3 次区域(县、市等)级别精度。
4 镇(市、村)级别精度。
5 邮政编码(zip code)级别的准确性。
6 街道级精度。
7 交叉口水平精度。
8 地址级别精度。
9 场所(建筑物名称、物业名称、购物中心等)等级准确度。

Here are the Google Maps API Docs. It contains a table with accuracy values...

http://code.google.com/apis/maps/documentation/reference.html#GGeoAddressAccuracy

Constant | Description
0 Unknown location.
1 Country level accuracy.
2 Region (state, province, prefecture, etc.) level accuracy.
3 Sub-region (county, municipality, etc.) level accuracy.
4 Town (city, village) level accuracy.
5 Post code (zip code) level accuracy.
6 Street level accuracy.
7 Intersection level accuracy.
8 Address level accuracy.
9 Premise (building name, property name, shopping center, etc.) level accuracy.

七度光 2024-09-08 15:58:19

以下是来自 geocoder真实状态答案:

您可以在地理编码函数中输出 status

myMap.geocoder.geocode( 
    { address: someAdress } ), 
    function ( responses, status ) { 
        console.log( status );
    }
);

当传递 status 时>,您可以切换这四个值:

    switch ( status )
    {
        case 'ROOFTOP' :
            var precision = 'precise';
            break;
        case 'RANGE_INTERPOLATED' :
            var precision = 'interpolated';
            break;
        case 'APPROXIMATE' :
            var precision = 'approximately';
            break;
        case 'ZERO_RESULTS' :
            var precision = 'no address';
            break;
    }

Here are the real status answers from geocoder:

You can output the status inside your geocoding function:

myMap.geocoder.geocode( 
    { address: someAdress } ), 
    function ( responses, status ) { 
        console.log( status );
    }
);

When passing the status, you can switch those four values:

    switch ( status )
    {
        case 'ROOFTOP' :
            var precision = 'precise';
            break;
        case 'RANGE_INTERPOLATED' :
            var precision = 'interpolated';
            break;
        case 'APPROXIMATE' :
            var precision = 'approximately';
            break;
        case 'ZERO_RESULTS' :
            var precision = 'no address';
            break;
    }
楠木可依 2024-09-08 15:58:19

@Pekka

我不知道你是否看到了,但 V3 不再包含准确性。不过似乎还有不同的方法。如果添加 address_component 元素的结果,您会得到类似的结果。免责声明:我对此不是 100% 确定,但看起来他们以这种方式包含了准确性。我目前正在做一些测试,这就是要走的路。

这里是一个例子:

我搜索:555 Pearl Street, Boulder

这里是地址级别精度的结果(8 级深度)。

        [address_component] => Array
            (
                [0] => SimpleXMLElement Object
                    (
                        [long_name] => 555
                        [short_name] => 555
                        [type] => street_number
                    )

                [1] => SimpleXMLElement Object
                    (
                        [long_name] => Pearl St
                        [short_name] => Pearl St
                        [type] => route
                    )

                [2] => SimpleXMLElement Object
                    (
                        [long_name] => Boulder
                        [short_name] => Boulder
                        [type] => Array
                            (
                                [0] => locality
                                [1] => political
                            )

                    )

                [3] => SimpleXMLElement Object
                    (
                        [long_name] => Boulder
                        [short_name] => Boulder
                        [type] => Array
                            (
                                [0] => administrative_area_level_3
                                [1] => political
                            )

                    )

                [4] => SimpleXMLElement Object
                    (
                        [long_name] => Boulder
                        [short_name] => Boulder
                        [type] => Array
                            (
                                [0] => administrative_area_level_2
                                [1] => political
                            )

                    )

                [5] => SimpleXMLElement Object
                    (
                        [long_name] => Colorado
                        [short_name] => CO
                        [type] => Array
                            (
                                [0] => administrative_area_level_1
                                [1] => political
                            )

                    )

                [6] => SimpleXMLElement Object
                    (
                        [long_name] => United States
                        [short_name] => US
                        [type] => Array
                            (
                                [0] => country
                                [1] => political
                            )

                    )

                [7] => SimpleXMLElement Object
                    (
                        [long_name] => 80302
                        [short_name] => 80302
                        [type] => postal_code
                    )

            )

@Pekka

I don't know if you saw, but V3 does not include accuracy anymore. It seems that there is a different way though. If you add the results of the address_component elements you get a similar result. Disclaimer: I am not 100% sure about this but it looks like that they included the accuracy this way. I am currently doing some testing is this the way to go.

Here an example:

I searched for: 555 Pearl Street, Boulder

Here the result with Address Level accuracy (8 levels deep).

        [address_component] => Array
            (
                [0] => SimpleXMLElement Object
                    (
                        [long_name] => 555
                        [short_name] => 555
                        [type] => street_number
                    )

                [1] => SimpleXMLElement Object
                    (
                        [long_name] => Pearl St
                        [short_name] => Pearl St
                        [type] => route
                    )

                [2] => SimpleXMLElement Object
                    (
                        [long_name] => Boulder
                        [short_name] => Boulder
                        [type] => Array
                            (
                                [0] => locality
                                [1] => political
                            )

                    )

                [3] => SimpleXMLElement Object
                    (
                        [long_name] => Boulder
                        [short_name] => Boulder
                        [type] => Array
                            (
                                [0] => administrative_area_level_3
                                [1] => political
                            )

                    )

                [4] => SimpleXMLElement Object
                    (
                        [long_name] => Boulder
                        [short_name] => Boulder
                        [type] => Array
                            (
                                [0] => administrative_area_level_2
                                [1] => political
                            )

                    )

                [5] => SimpleXMLElement Object
                    (
                        [long_name] => Colorado
                        [short_name] => CO
                        [type] => Array
                            (
                                [0] => administrative_area_level_1
                                [1] => political
                            )

                    )

                [6] => SimpleXMLElement Object
                    (
                        [long_name] => United States
                        [short_name] => US
                        [type] => Array
                            (
                                [0] => country
                                [1] => political
                            )

                    )

                [7] => SimpleXMLElement Object
                    (
                        [long_name] => 80302
                        [short_name] => 80302
                        [type] => postal_code
                    )

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