在搜索与谷歌Android地图API的位置 [英] Searching for locations with Google Maps API for Android

查看:171
本文介绍了在搜索与谷歌Android地图API的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想提出一个Android应用程序存储300万的城市标志在MongoDB中。根据当前的谷歌地图上看,我做一个地理空间框查询蒙戈得到屏幕上当前视图中的所有标记。

如果用户想要改变视图,他/她也可以执行对一个城市的文本搜索,这将查询横跨标记集合三个名称字段和显示结果。我目前使用的Mongo此但由于它的命名是不是在所有运作良好公约(区分独立搜索速度慢,正常的搜索速度快,但如果不准确的用户忘记利用/大写字母错误)。

是否可以搜索与谷歌的地图服务地图?我不希望找到餐厅或书店,只有城市。

如果我想搜索洛杉矶为例,我希望在地图要带我去洛杉矶,没有显示出任何谷歌的标志,并且让我的标记加载正常。

是否有可能只提取谷歌地图搜索功能,而无需多余的地方数据库?是否有可能得到他们的建议框中键入搜索时,这样如果有两大洛杉矶我那被告知工作?


解决方案

  

是否可以搜索与谷歌的地图服务地图?


没有,它不支持搜索。


  

是否有可能只提取谷歌的搜索功能
  地图没有多余的地方数据库?


不从谷歌地图,但看 地理codeR 类。你可以通过一个字符串的位置,并取回列表地址那场比赛。你必须要经过自己的结果拉出纬度/经度。然后,您可以移动或动画的地图,请你
使用<一个href=\"https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/GoogleMap#animateCamera%28com.google.android.gms.maps.CameraUpdate%29\"相对=nofollow> animateCamera 或<一个href=\"https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/GoogleMap#moveCamera%28com.google.android.gms.maps.CameraUpdate%29\"相对=nofollow> moveCamera

I am making an Android app that stores 3 million city markers in MongoDB. Depending on the current google map view, I make a geospatial box query to Mongo to get all markers within the current view on the screen.

If the user wants to change the view, he/she can also perform a text search for a city and this will query three name fields across the markers collection and show the results. I currently use Mongo for this but due to naming conventions it is not working well at all (case-independent search is slow, normal search is fast but inaccurate if user forgets to capitalize/capitalizes wrong letter).

Is it possible to search the map with Google's map service? I don't want to find restaurants or bookstores, only cities.

If I would search for "los angeles" for example, I expect the map to take me to Los Angeles, not show any google markers, and let my markers load normally.

Is it possible to only extract the search functionality from google maps without the excess places database? Is it possible to get their suggestion box working when typing a search so that if there's two Los Angeles I can be informed of that?

解决方案

Is it possible to search the map with Google's map service?

No, it does not support searching.

Is it possible to only extract the search functionality from google maps without the excess places database?

Not from Google Maps, but look at the Geocoder class. You can pass a String location and get back a list of Address that match. You will have to go through the results yourself to pull out the lat/lng. Then you can move or animate the map as you please using animateCamera or moveCamera.

这篇关于在搜索与谷歌Android地图API的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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