Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CLGeocoder geocoding is hopelessly inaccurate

I have an App that does forward geocoding (get coordinates given address) to display a bunch of pins on an MKMapView. The app was developed well before iOS supported forward geocoding using CLGeocoder (first available in iOS 5). As such my app uses the Google Maps Geocoding API, which is generally very accurate. Given a full address with a street number it will generally give you the exact location of that address within a couple of metres.

I'm doing some updates to my App to support iOS 6 and decided to switch from using the Google API to using CLGeocoder provided the app was running on iOS 5 or above. However in my tests (all with addresses in Portugal, where I live) it is so inaccurate as to be totally unusable.

I'm using – geocodeAddressString:completionHandler: and, for example, given the address "Avenida da Liberdade 195, Lisboa, Portugal" it gives me an "Avenida da Liberdade" in the city of Sintra, not Lisboa (Lisbon). That's about 15km away from the real address. Avenida da Liberdade is one of the biggest and most well known avenues in Lisbon. The equivalent of, say, 5th Avenue in NYC. It's not some obscure little side street.

Is there anything I'm doing wrong to get such terrible accuracy? Are others having similar accuracy issues, especially with addresses outside the US?

For the time being it looks like I'll have to stick with the Google Maps API. Incidentally, I've been using the iOS 6 simulator and there the results are no better. Putting the same search string into the search box on the iOS 6 Maps app gives the same totally inaccurate results.

EDIT: added CLGeocodercode:

    CLGeocoder *fgeo = [[[CLGeocoder alloc] init] autorelease];
    NSLog(@"Geocoding for Address: %@\n", address);
    [fgeo geocodeAddressString:address completionHandler:^(NSArray *placemarks, NSError *error) {
        if (!error) {
            // do stuff with the placemarks

            for (CLPlacemark *placemark in placemarks) {
                NSLog(@"%@\n %.2f,%.2f",[placemark description], placemark.location.horizontalAccuracy, placemark.location.verticalAccuracy);
            }
        } else {
            NSLog(@"Geocoding error: %@", [error localizedDescription]);
        }
    }];

EDIT 2: I've discovered that if I use – geocodeAddressDictionary:completionHandler: and pass in an Address Dictionary with the street address, postal code (zip code) and as much detail as I can possibly provide, it gives me reasonably accurate coordinates, but still with an accuracy radius of more than 400m which is unacceptable.

like image 308
mluisbrown Avatar asked Jul 23 '12 14:07

mluisbrown


People also ask

Is reverse geocoding accurate?

Reverse geocoding results will be imprecise as well. Administrative area geocoding provides the lowest level of geocoding accuracy to connect an area with a location such as a state or province. It is not possible to connect state or provincial level coordinates to a specific address.

Does Google Maps use geocoding?

The Google Maps APIs have several services that you can use to convert addresses into coordinates - the Geocoding API, the Place Autocomplete service in Places API, and the Place Search service in Places API.

What is the difference between geocoding and reverse geocoding?

Geocoding is the process of transforming a street address or other description of a location into a (latitude, longitude) coordinate. Reverse geocoding is the process of transforming a (latitude, longitude) coordinate into a (partial) address.


1 Answers

Well, it would appear that yes, Apple's CLGeocoder is nothing like as accurate for forward geocoding (address -> coordinates) as the Google Maps Geocoding API, particularly outside of the USA. Using an Address Dictionary with all the fields filled out as fully as possible works a lot better than a simple address string, but it's still no where near good enough. Where Google will (usually) give you coordinates within 5-10m of the street number, Apple will give you coordinates somewhere in the right street, if you're lucky.

EDIT: Found Apple Developer Technical Note TN2289 which details Supported Countries for CLGeocoder. It would appear that Portugal is in its list of Partially Supported Regions, which it describes as:

The following are territories are not fully supported, either because coverage is more limited or for other reasons. For example a location may only be able to be geocoded to road level as opposed to a specific address point on that road.

Which matches my results with CLGeocoder in Portugal. I guess I'll just have to wait for improved coverage.

like image 193
mluisbrown Avatar answered Sep 25 '22 00:09

mluisbrown