11

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?

Mogsdad
  • 44,709
  • 21
  • 151
  • 275
Pekka
  • 442,112
  • 142
  • 972
  • 1,088

3 Answers3

12

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.

Ky -
  • 30,724
  • 51
  • 192
  • 308
John Himmelman
  • 21,504
  • 22
  • 65
  • 80
4

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;
    }
kaiser
  • 21,817
  • 17
  • 90
  • 110
  • Is this based on version 3? – Y_Y Dec 12 '12 at 16:33
  • 2
    I see., for some reason I thought ROOFTOP, RANGE_INTERPOLATED, APPROXIMATE, and *ZERO_RESULTS* were part of the location_type returned by the results or (from your code) responses.?. Are those also included in the status field? – Y_Y Dec 12 '12 at 16:47
  • 1
    Hi Actually status shows OK, ZERO_RESULTS, OVER_QUERY_LIMIT, REQUEST_DENIED, INVALID_REQUEST, UNKNOWN_ERROR as per API docs. In V3, it is the location_type which shows ROOFTOP.... – Anand Sep 17 '14 at 04:40
  • You will also get a location_type of GEOMETRIC_CENTER if you just supply an address as a road with no number say. – Matthew Jun 04 '19 at 02:55
2

@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
                    )

            )
Paedda
  • 149
  • 3
  • 1
    Cheers @Paedda. I noticed that `accuracy` has gone in V3. It seems to have been replaced by a new value in the `geometrics` section (or whatever it was called, a different branch in the same XML output, I don't have the data handy) saying `ROOFTOP` when the address is perfectly encoded, and a range of other values when it's not exact, and the address components you quote. – Pekka May 24 '10 at 19:01
  • Yeah its the 'location_type' member of the geometry section. – dodgy_coder Feb 12 '13 at 08:22