Return full state with placemark.administrativeArea using reverseGeocodeLocation
Asked Answered
T

0

6

First time doing geolocation lookup and I'd like to return where the user is currently. Not on a map, but retrieve state information and give them options within the app due to their location.

When I use the reverseGeocodeLocation lookup I see that it's finding tons of data... which is great. Specifically, I'd like the full state name instead of the abbreviation (i.e. California vs. CA).

Only problem is that when the NSLog for placemark.administrativeArea only shows the abbreviation "CA".

Looking at the Dev Docs it says:
"If the placemark location is Apple’s headquarters, for example, the value for this property would be the string "CA" or "California".

I see California when I dump the entire placemark into the log. This must be a stupid question... what the heck am I doing wrong?

Thanks in advance!

    structuredAddress: Apple Inc.<GEOMapItemStorage: 0x7a680f70> {
    placeData =     {
        component =         (
                        {
                "cache_control" = CACHEABLE;
                "start_index" = 0;
                status = "STATUS_SUCCESS";
                ttl = 15768000;
                type = "COMPONENT_TYPE_HOURS";
                "values_available" = 0;
                version = 7;
                "version_domain" =                 (
                    apple,
                    revgeo,
                    US
                );
            },
                        {
                "cache_control" = CACHEABLE;
                "start_index" = 0;
                status = "STATUS_SUCCESS";
                ttl = 15768000;
                type = "COMPONENT_TYPE_RATING";
                "values_available" = 0;
                version = 7;
                "version_domain" =                 (
                    apple,
                    revgeo,
                    US
                );
            },
                        {
                "cache_control" = CACHEABLE;
                "start_index" = 0;
                status = "STATUS_SUCCESS";
                ttl = 15768000;
                type = "COMPONENT_TYPE_FLYOVER";
                "values_available" = 0;
                version = 7;
                "version_domain" =                 (
                    apple,
                    revgeo,
                    US
                );
            },
                        {
                "cache_control" = CACHEABLE;
                "start_index" = 0;
                status = "STATUS_SUCCESS";
                ttl = 15768000;
                type = "COMPONENT_TYPE_BOUNDS";
                value =                 (
                                        {
                        bounds =                         {
                            "map_region" =                             {
                                eastLng = "-122.0278321145097";
                                northLat = "37.33399909402007";
                                southLat = "37.33029506903731";
                                westLng = "-122.0347313625158";
                            };
                        };
                    }
                );
                "values_available" = 1;
                version = 7;
                "version_domain" =                 (
                    apple,
                    revgeo,
                    US
                );
            },
                        {
                "cache_control" = CACHEABLE;
                "start_index" = 0;
                status = "STATUS_SUCCESS";
                ttl = 15768000;
                type = "COMPONENT_TYPE_ROAD_ACCESS_INFO";
                "values_available" = 0;
                version = 7;
                "version_domain" =                 (
                    apple,
                    revgeo,
                    US
                );
            },
                        {
                "cache_control" = CACHEABLE;
                "start_index" = 0;
                status = "STATUS_SUCCESS";
                ttl = 15768000;
                type = "COMPONENT_TYPE_PLACE_INFO";
                value =                 (
                                        {
                        "place_info" =                         {
                            center =                             {
                                lat = "37.3320289";
                                lng = "-122.029566";
                            };
                            timezone =                             {
                                identifier = "America/Los_Angeles";
                            };
                        };
                    }
                );
                "values_available" = 1;
                version = 7;
                "version_domain" =                 (
                    apple,
                    revgeo,
                    US
                );
            },
                        {
                "cache_control" = CACHEABLE;
                "start_index" = 0;
                status = "STATUS_SUCCESS";
                ttl = 15768000;
                type = "COMPONENT_TYPE_ENTITY";
                value =                 (
                                        {
                        entity =                         {
                            name =                             (
                                                                {
                                    locale = "en_US";
                                    "string_value" = "Apple Inc.";
                                },
                                                                {
                                    locale = en;
                                    "string_value" = "Apple Inc.";
                                }
                            );
                            type = AOI;
                        };
                    }
                );
                "values_available" = 1;
                version = 7;
                "version_domain" =                 (
                    apple,
                    revgeo,
                    US
                );
            },
                        {
                "cache_control" = CACHEABLE;
                "start_index" = 0;
                status = "STATUS_SUCCESS";
                ttl = 15768000;
                type = "COMPONENT_TYPE_ADDRESS";
                value =                 (
                                        {
                        address =                         {
                            "localized_address" =                             (
                                                                {
                                    address =                                     {
                                        formattedAddressLine =                                         (
                                            "Apple Inc.",
                                            "Cupertino, CA  95014",
                                            "United States"
                                        );
                                        structuredAddress =                                         {
                                            administrativeArea = California;
                                            administrativeAreaCode = CA;
                                            areaOfInterest =                                             (
                                                "Apple Inc."
                                            );
                                            country = "United States";
                                            countryCode = US;
                                            dependentLocality =                                             (
                                                Cupertino,
                                                "Bay Area"
                                            );
                                            geoId =                                             (
                                            );
                                            locality = Cupertino;
                                            postCode = 95014;
                                            subAdministrativeArea = "Santa Clara";
                                            subLocality = "Bay Area";
                                        };
                                    };
                                    locale = "en_US";
                                },
                                                                {
                                    address =                                     {
                                        formattedAddressLine =                                         (
                                            "Apple Inc.",
                                            "Cupertino, CA  95014",
                                            "United States"
                                        );
                                        structuredAddress =                                         {
                                            administrativeArea = California;
                                            administrativeAreaCode = CA;
                                            areaOfInterest =                                             (
                                                "Apple Inc."
                                            );
                                            country = "United States";
                                            countryCode = US;
                                            dependentLocality =                                             (
                                                Cupertino,
                                                "Bay Area"
                                            );
                                            geoId =                                             (
                                            );
                                            locality = Cupertino;
                                            postCode = 95014;
                                            subAdministrativeArea = "Santa Clara";
                                            subLocality = "Bay Area";
                                        };
                                    };
                                    locale = en;
                                }
                            );
                        };
                    }
                );
                "values_available" = 1;
                version = 7;
                "version_domain" =                 (
                    apple,
                    revgeo,
                    US
                );
            },
                        {
                "cache_control" = CACHEABLE;
                "start_index" = 0;
                status = "STATUS_SUCCESS";
                ttl = 15768000;
                type = "COMPONENT_TYPE_AMENITIES";
                "values_available" = 0;
                version = 7;
                "version_domain" =                 (
                    apple,
                    revgeo,
                    US
                );
            },
                        {
                "cache_control" = CACHEABLE;
                "start_index" = 0;
                status = "STATUS_SUCCESS";
                ttl = 15768000;
                type = "COMPONENT_TYPE_STYLE_ATTRIBUTES";
                "values_available" = 0;
                version = 7;
                "version_domain" =                 (
                    apple,
                    revgeo,
                    US
                );
            }
        );
        "result_provider_id" = 7618;
        status = "STATUS_SUCCESS";
    };
}
Tennant answered 2/4, 2015 at 13:10 Comment(2)
Something similar was already asked. [Check this out][1] [1]: #11108924Alimony
Thanks Pablo. I saw something similar to that yesterday when I was digging around, might have even been that same article. I noticed it was geared toward < iOS 7 since it used to return the full name. I was about to try something like that (but reversed like the last commenter...). Before I went down that path, I was curious if there was something I was doing wrong since the Apple Docs. seemed to say I could get what I wanted from the .administrativeArea. If that's the case, it's pretty dumb that the data is there, but we just can't get at it without some screwing around.Tennant

© 2022 - 2024 — McMap. All rights reserved.