Geocoder getFromLocationName 未找到地址
如果我正在搜索营业地点,Geocoder getFromLocationName 不会返回任何内容。以下是我到目前为止的发现:
- 杂货店、商业建筑 ->没有结果
- 学校 ->查找结果,但仅返回纬度和经度。我必须进行反向地理编码才能根据坐标获取地址,但地址不准确。
- 完整地址->和学校一样,只返回经纬度
- 医院和药房->返回纬度和经度
我已经在具有 Google 地图的 1.6、2.1 和 2.2 设备上对此进行了测试。
我试图查找 SDK 上是否有任何限制解释,但除了:
反转的细节量 地理编码位置描述可能 有所不同,例如其中可能包含 最近的完整街道地址 建筑物,而另一个可能包含 只有城市名称和邮政编码。这 Geocoder 类需要后端 不包含在其中的服务 核心安卓框架。地理编码器 查询方法将返回空 列出是否没有后端服务 平台 (http://developer.android.com/reference/android/location/Geocoder .html)
[更新] 因此,经过数夜的研究,我似乎无法使其发挥作用 - 谷歌根本不会给我结果。关于 android 开发者的一些讨论指出了一个事实,即 Google 导航出现时 getFromBusinessName 被省略了。所以我开始假设谷歌正在撤回他们的一些地理编码服务。
我总是可以创建一个使用 Google Geocoder API 的网页,但它仅限于 2500 个 api 调用 - 而且我认为它不合法(笑)。那么我有什么选择呢?
Geocoder getFromLocationName is not returning anything if I'm searching for business places. Here are my finding so far:
- grocery places, commercial buildings -> no result
- schools -> finding results, but only returning Latitude and Longitude. I have to do reverse geocoding in order to get the address based on the coordinates, but the address wouldn't be accurate.
- complete address -> same as school, only returning Latitude and Longitude
- hospital and pharmacy -> returning Latitude and Longitude
I've tested this on 1.6, 2.1 and 2.2 devices that has Google Maps.
I'm trying to find if there's a limitation explained somewhere on the SDK, but there is none except:
The amount of detail in a reverse
geocoded location description may
vary, for example one might contain
the full street address of the closest
building, while another might contain
only a city name and postal code. The
Geocoder class requires a backend
service that is not included in the
core android framework. The Geocoder
query methods will return an empty
list if there no backend service in
the platform
(http://developer.android.com/reference/android/location/Geocoder.html)
[update]
So after nights of research, I can't seems to make it work - Google simply wont give me the result. Some discussion on android-developers points a fact that getFromBusinessName was omitted when Google Navigation came out. So I'm starting to assume that Google is pulling back some of their geocoding service.
I can always create a webpage that use Google Geocoder API, but its limited to 2500 api call - and I dont think it will be legal (lol). So what are my alternatives here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我遇到了同样的问题。我发现,如果我包含企业/场所名称,地理编码 API 通常不会返回任何结果,但如果缺少它,纬度/经度可能会不太准确。
我实施了一个务实的解决方案:
1. 使用包含商家/场所名称的字符串调用 API
2.如果失败,请第二次调用它,不带企业/场所名称,只带地址。
我还没有看到没有返回位置的情况,所以这似乎是一个不错的妥协,因为这意味着我至少得到了位置数据,如果有时不太准确,并且通过线程调用可以减轻第二次 API 调用的成本。
I've hit the same problem. I'm finding that the geocoding API often returns no results if I include the business/venue name, but by missing it off, the lat/long can be much less accurate.
I've implemented a pragmatic solution:
1. Call the API with a string including the business/venue name
2. If it fails, call it a second time without the business/venue name, just the address
I've yet to see a case where no location is returned, so it seems a decent compromise as it means I do at least get location data, if sometimes less accurate, and the cost of a second API call is mitigated with threaded calls.
我找不到回复按钮,但和大家一样,我刚刚遇到了同样的问题。我还没有尝试过,但听起来很可靠。潜在的解决方法位于此处:
使用 Google Maps API 获取地址业务
快乐编码:)
编辑:忘记该链接并查看此链接:http://code.google.com/apis/maps/documentation/places/
I couldn't find the button to reply but, like you all, I have just run into the same problem. I haven't tried it yet but it sounds pretty solid. A potential workaround is located here:
Using Google Maps API to get Address of Business
Happy coding :)
Edit: Forget that link and check this one out: http://code.google.com/apis/maps/documentation/places/
尝试这种方法:
1)使用Geocoder将经纬度转换为地址
2) 对Whitepages(或类似服务)进行API 调用,特别是reverse_address 方法,它将为您获取所提及地址的公司名称。
Try this approach:
1) Use Geocoder to convert latitude-longitude to address
2) Make an API call to Whitepages (or similar service), specifically the reverse_address method which will get you business name for the address mentioned.