Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Missing county in Google Maps geocoding API

I’ve noticed that a handful of zip codes are not returning a county. For example, 30601 (Athens, GA – county is Clarke) json result below. Normally I see county data returned with type administrative_area_level_2. This is missing from the response:

$url https://maps.googleapis.com/maps/api/geocode/json?address=30601&key=topsecretkey 

Array
(
    [results] => Array
        (
            [0] => Array
                (
                    [address_components] => Array
                        (
                            [0] => Array
                                (
                                    [long_name] => 30601
                                    [short_name] => 30601
                                    [types] => Array
                                        (
                                            [0] => postal_code
                                        )

                                )

                            [1] => Array
                                (
                                    [long_name] => Athens
                                    [short_name] => Athens
                                    [types] => Array
                                        (
                                            [0] => locality
                                            [1] => political
                                        )

                                )

                            [2] => Array
                                (
                                    [long_name] => Georgia
                                    [short_name] => GA
                                    [types] => Array
                                        (
                                            [0] => administrative_area_level_1
                                            [1] => political
                                        )

                                )

                            [3] => Array
                                (
                                    [long_name] => United States
                                    [short_name] => US
                                    [types] => Array
                                        (
                                            [0] => country
                                            [1] => political
                                        )

                                )

                        )

                    [formatted_address] => Athens, GA 30601, USA
                    [geometry] => Array
                        (
                            [bounds] => Array
                                (
                                    [northeast] => Array
                                        (
                                            [lat] => 34.0593981
                                            [lng] => -83.288826
                                        )

                                    [southwest] => Array
                                        (
                                            [lat] => 33.9479501
                                            [lng] => -83.405851
                                        )

                                )

                            [location] => Array
                                (
                                    [lat] => 34.006845
                                    [lng] => -83.3468784
                                )

                            [location_type] => APPROXIMATE
                            [viewport] => Array
                                (
                                    [northeast] => Array
                                        (
                                            [lat] => 34.0593981
                                            [lng] => -83.288826
                                        )

                                    [southwest] => Array
                                        (
                                            [lat] => 33.9479501
                                            [lng] => -83.405851
                                        )

                                )

                        )

                    [place_id] => ChIJocit0GgT9ogRTBKlRatQYFc
                    [types] => Array
                        (
                            [0] => postal_code
                        )

                )

        )

    [status] => OK
)

If I pass a different zip code, say 30083 (Stone Mountain, GA county DeKalb), the county (and administrative_area_level_2) is returned as expected.

Array
(
    [results] => Array
        (
            [0] => Array
                (
                    [address_components] => Array
                        (
                            [0] => Array
                                (
                                    [long_name] => 30083
                                    [short_name] => 30083
                                    [types] => Array
                                        (
                                            [0] => postal_code
                                        )

                                )

                            [1] => Array
                                (
                                    [long_name] => Stone Mountain
                                    [short_name] => Stone Mountain
                                    [types] => Array
                                        (
                                            [0] => locality
                                            [1] => political
                                        )

                                )

                            [2] => Array
                                (
                                    [long_name] => DeKalb County
                                    [short_name] => Dekalb County
                                    [types] => Array
                                        (
                                            [0] => administrative_area_level_2
                                            [1] => political
                                        )

                                )

                            [3] => Array
                                (
                                    [long_name] => Georgia
                                    [short_name] => GA
                                    [types] => Array
                                        (
                                            [0] => administrative_area_level_1
                                            [1] => political
                                        )

                                )

                            [4] => Array
                                (
                                    [long_name] => United States
                                    [short_name] => US
                                    [types] => Array
                                        (
                                            [0] => country
                                            [1] => political
                                        )

                                )

                        )

                    [formatted_address] => Stone Mountain, GA 30083, USA
                    [geometry] => Array
                        (
                            [bounds] => Array
                                (
                                    [northeast] => Array
                                        (
                                            [lat] => 33.8351599
                                            [lng] => -84.1243101
                                        )

                                    [southwest] => Array
                                        (
                                            [lat] => 33.7368448
                                            [lng] => -84.246361
                                        )

                                )

                            [location] => Array
                                (
                                    [lat] => 33.7994803
                                    [lng] => -84.1909841
                                )

                            [location_type] => APPROXIMATE
                            [viewport] => Array
                                (
                                    [northeast] => Array
                                        (
                                            [lat] => 33.8351599
                                            [lng] => -84.1243101
                                        )

                                    [southwest] => Array
                                        (
                                            [lat] => 33.7368448
                                            [lng] => -84.246361
                                        )

                                )

                        )

                    [place_id] => ChIJcxoG6teo9YgRwtQgWre-Trk
                    [postcode_localities] => Array
                        (
                            [0] => Pine Lake
                            [1] => Stone Mountain
                            [2] => Tucker
                            [3] => Wilshire
                        )

                    [types] => Array
                        (
                            [0] => postal_code
                        )

                )

        )

    [status] => OK
)

Am I doing anything wrong here? If no, is there a way to notify Google of this missing data?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Looking them up on Google Maps, 30601 goes outside of Clarke County, and thus with just the zip code it’s not possible to determine a county value. 30601 appears to include bits of Clarke, Madison, and Jackson counties.

30601 (note the areas in green at the top of the zip code near Sandy Creek Park):

enter image description here

Clarke County:

enter image description here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading