CLGeocoder地理编码绝对不准确 [英] CLGeocoder geocoding is hopelessly inaccurate

查看:586
本文介绍了CLGeocoder地理编码绝对不准确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序可以进行前向地理编码(获取坐标给定地址),以便在 MKMapView 上显示一堆引脚。该应用程序是在iOS支持使用 <$ c $支持前向地理编码之前开发的。 c> CLGeocoder (首次在iOS 5中提供)。因此,我的应用使用 Google Maps Geocoding API ,这通常非常准确。如果有一个带有街道号码的完整地址,它通常会在几米之内为您提供该地址的确切位置。

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.

我正在对我的应用程序进行一些更新支持iOS 6并决定从使用Google API切换到使用 CLGeocoder ,前提是该应用程序在iOS 5或更高版本上运行。然而,在我的测试中(所有地址都在葡萄牙,我居住的地方)它是如此不准确,以至于完全无法使用。

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.

我正在使用 - geocodeAddressString:completionHandler: ,例如,给定地址Avenida da Liberdade 195,Lisboa,Portugal,它在辛特拉市给了我一个Avenida da Liberdade,而不是里斯本(里斯本)。距离真实地址约15公里。 Avenida da Liberdade是里斯本最大和最着名的大道之一。相当于纽约市的第五大道。这不是一些不起眼的小街道。

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?

目前看来我必须坚持使用Google Maps API。顺便说一下,我一直在使用iOS 6模拟器,结果并没有更好。将相同的搜索字符串放入iOS 6地图应用的搜索框中会产生完全不准确的结果。

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.

编辑已添加 CLGeocoder 代码:

    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]);
        }
    }];

编辑2 :我发现如果我使用 - geocodeAddressDictionary:completionHandler: 并传入一个地址字典,其中包含街道地址,邮政编码(邮政编码)以及我可能提供的详细信息,它合理地给了我准确的坐标,但仍然具有超过400米的精度半径,这是不可接受的。

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.

推荐答案

嗯,似乎是的, Apple的 CLGeocoder 与Google Maps Geocoding API(特别是在美国以外)的前向地理编码(地址 - >坐标)完全不同。使用地址字典,尽可能完整地填写所有字段比简单的地址字符串好很多,但它仍然没有足够好的地方。谷歌将(通常)在街道号码的5-10米范围内为您提供坐标,如果您幸运的话,Apple会在正确的街道某处给您坐标。

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.

编辑:
找到Apple开发人员技术说明TN2289 其中详细说明了 CLGeocoder 支持的国家/地区。似乎葡萄牙在其列表部分支持的区域,它描述为:

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.

哪些匹配我在葡萄牙的 CLGeocoder 的结果。我想我只需要等待改善覆盖率。

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

这篇关于CLGeocoder地理编码绝对不准确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆