如何在Google Map Geocoder V3中获得相同的准确性 [英] How to get the equivalent of the accuracy in Google Map Geocoder V3

查看:146
本文介绍了如何在Google Map Geocoder V3中获得相同的准确性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从Google获取地理编码,而我曾经使用API​​的V2进行编码。
Google向json发送了一个非常好的信息,准确性,参考如下: http://code.google.com/intl/fr-FR/apis/maps/documentation/javascript/v2/reference.html#GGeoAddressAccuracy



在V3中,Google似乎没有向我发送完全相同的信息。有一个adresse_component数组,如果精度更好,但看起来更大,但不完全一样。
例如,我对街道号码有一个请求准确性,数组的大小为8.
另一个查询是路由的准确性,所以准确性较差,但数组仍然是8号大小,因为有一行'sublocality',它没有出现在第一个例子中。



好的,Google会发送一个数据'types',其中'best ' 准确性。这些类型在这里: http://代码。 google.com/intl/fr-FR/apis/maps/documentation/geocoding/#Types
但是,没有真正的订单,如果我不希望结果比postal_code更好,我有没有线索如何做到这一点。



那么,我怎么能得到这个V2精确度的等价物,而没有一些愚蠢和可怕的代码? b

解决方案

好的, location type ,这并不是很糟糕:
$ b


location_type存储有关指定位置的附加数据。目前支持
以下值:

ROOFTOP表示返回的结果是一个精确的地理编码,我们将位置信息精确到街道地址精度。 b
$ b

RANGE_INTERPOLATED表示返回的结果反映了在两个精确
点(如交点)之间插入的
近似值(通常在道路上) 。当屋顶地址解析不可用于街道地址时,插值结果通常为


GEOMETRIC_CENTER表示返回的结果是多边形(例如街道)或
等结果的几何
中心

APPROXIMATE表示返回的结果是
的近似值。


我测试location_type是否与近似值不同,并给出了一些好的结果。


I want to get geocode from google, and I used to do it with the V2 of the API. Google send in the json a pretty good information, the accuracy, reference here : http://code.google.com/intl/fr-FR/apis/maps/documentation/javascript/v2/reference.html#GGeoAddressAccuracy

In V3, Google doesn't seem to send me exactly the same information. There is the array "adresse_component", which seem bigger if the accuracy is better, but not exactly. For example, I have a request accuracy to the street number, the array is of size 8. Another query is accuracy to the route, so less accuracy, but the array is still of size 8, as there is a row 'sublocality', which not appear in the first case.

Ok, for a result, Google send a data 'types', which have the 'best' accuracy. This types are here : http://code.google.com/intl/fr-FR/apis/maps/documentation/geocoding/#Types But, there is no real order, and if I wan't the result better than postal_code, I have no clue to how to do that.

So, how can I get this equivalent of the V2 accuracy, whithout some dumb and horrible code ?

解决方案

Well, there is the location type, which is not so bad :

location_type stores additional data about the specified location. The following values are currently supported:

"ROOFTOP" indicates that the returned result is a precise geocode for which we have location information accurate down to street address precision.

"RANGE_INTERPOLATED" indicates that the returned result reflects an approximation (usually on a road) interpolated between two precise points (such as intersections). Interpolated results are generally returned when rooftop geocodes are unavailable for a street address.

"GEOMETRIC_CENTER" indicates that the returned result is the geometric center of a result such as a polyline (for example, a street) or polygon (region)."

"APPROXIMATE" indicates that the returned result is approximate.

I test if the location_type is different of approximate, and it gives some good results.

这篇关于如何在Google Map Geocoder V3中获得相同的准确性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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