如何让 Android 用户在 Google 地图上搜索我创建的最近的兴趣点?
我想在 Google 地图(或其他)等地图解决方案上标记全球历史“兴趣点”。
我将创建一个 Android 应用程序,我希望能够为用户提供搜索和定位当前位置周围最近的此类“兴趣点”的能力。
我应该使用 Google 地图还是 OSM 等其他工具吗?
我应该如何在 Google 或其他地方标记它们?
(a) 我也希望能够用图片标记这些地方,
(b) 我也想以通用格式将它们存储在我的末尾,以防万一!
Android 应用程序应如何搜索最近的此类点?
据我了解,当我提供 KML 文件 (http://code.google.com/apis/kml/documentation/kmlSearch.html) 时,Google 地图可以显示自己的地图并覆盖我的数据。可以在“Android 应用程序内”显示吗? (即,我知道它可以在网页上显示,但它可以在本机应用程序中显示吗?)
I want to mark historical 'points of interest' across the globe on a mapping solution such as Google Maps (or something else).
I'll be getting an Android app created in which I want to be able to provide the users the ability to search for and locate the nearest such 'point of interests' around their current location.
Should I be using Google Maps or something else like OSM?
How should I be marking them on Google or elsewhere?
(a) I want to be able to mark these places with pictures as well and
(b) I want to store them at my end in a generic format as well, just in case!
How should the Android app search for the closest such points?
As I understand, Google Maps can show its own map overlaid with my data when I provide a KML file (http://code.google.com/apis/kml/documentation/kmlSearch.html). Can that be shown "within an Android app"? (ie, I know it can be shown on a webpage, but can it be shown in a native app?)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我建议使用谷歌地图。原因是谷歌地图经常更新,部分
osm 的地图不是最新的。
可能会将此标记存储在您自己的名为 point_of_interest 的数据存储中。
信息窗口也是一种特殊的覆盖层,用于显示内容
(通常是文本或图像)在给定的地图顶部的弹出气球内
地点。请阅读此处了解更多信息。
您的 Android 应用程序应检测当前用户位置并发送信息
例如服务器的纬度和经度。因此要进行搜索的查询
对于兴趣点由服务器完成并处理数据并发送
返回到用户 Android 应用程序。例如,查询类似于
select * from point_of_interest 其中距离 < 10公里限制 5;
是的,请阅读此链接
I will suggest google maps. Reason is google maps is updated often and part
of the maps from osm is not as latest.
Probably store this marking in your own datastore called point_of_interest.
The info window is also a special kind of overlay for displaying content
(usually text or images) within a popup balloon on top of a map at a given
location. read here for more information.
your android app should detect current user location and send the information
such as latitude and longitude to your server. Hence the query to search
for point of interest is done by the server and process the data and send
back to user android app. For example, the query would be something like
select * from point_of_interest where distance < 10km limit 5;
yes, read this link
好的,对于我为客户构建的应用程序,我们有类似的要求。基本上,我需要显示当前位置 200 英里范围内的感兴趣位置。这对我有用的方式是,我获取当前位置并向他们的服务器发出 Web 服务调用,他们在服务器上进行地理计算并向我返回结果列表。
我会让 Android 应用程序只使用 MapView,然后使用 Overlays 在地图上显示图标。使用 kml 显示项目的问题是用户无法单击它们,因此它们没有交互性。如果您选择使用 kml 进行操作,此项目中提供了一些示例代码: https://github.com /sunlightlabs/国会
Ok, for an app I built for a customer, we had a similar requirement. Basically, I needed to display the locations of interest withing 200miles of my current location. The way this worked for me was that I took my current location and made a Web Services call to their servers where they did the Geographic calculation and returned a list of results to me.
I would have the Android app just use the MapView and then user Overlays to display icons on the map. The problem with displaying the items using kml is that they will not be clickable by the user so their will be no interactivity. If you do choose to do it with kml, there is some example code located in this project: https://github.com/sunlightlabs/congress
我更喜欢谷歌地图。谷歌地图SDK看起来不错,而且sdk性能也很好。我不知道有哪个 SDK 具有类似于
OSMMapView
的功能,可以提供与 google 地图相同的性能和功能(请纠正我)。但 OSM 可以像谷歌地图一样具有视觉吸引力。 Cloudmade 有大量不同样式的 OSM 数据。如果您想显示 Google 地图,则必须使用 Android SDK 附带的地图库。
您可以在 Google 地图顶部显示任何视图。即使用 github 上的 mapviewballoons。
如果您想要显示大量 POI,那么您绝对应该使用空间索引来保存数据。因此最近邻搜索速度很快。一种解决方案是使用 sqlite R*Trees。我没有在 android 上使用它们,它们不能开箱即用,你必须自己构建 sqlite-android (请参阅 这个问题)。或者使用Perst,或者...
如果您的数据很少,适合手机内存,您可以使用 Quadtree 。搜索时这甚至比数据库更快。当你用谷歌搜索时,你会发现很多例子。您可以将数据存储为 xml、json,甚至可以使用 java
Serialized
接口序列化整个四叉树。这个问题太宽泛了,有很多可能性。一些随机的想法:
创建一个通过 HTTP 响应边界框搜索的服务器,并将 POI 存储在四叉树中。
通过应用程序提供您的所有 POI。作为数据库、xml、json 或序列化四叉树。
我没有在 Android 上使用 kml 的经验。
I prefer google maps. Google maps SDK looks good and the sdk performs well. I don't know a SDK that has something like a
OSMMapView
that offers the same performance and features like google maps does (please correct me). But OSM can be as visual appealing as google maps. Cloudmade has tons of different styles for OSM data.If you want to display maps by google, you have to use the Maps Library that ships with the Android SDK.
You can display any Views on top of the google maps. I.e. use mapviewballoons on github.
If you have lots of POIs that you want to display you should definitely persist you data with a spatial index. So that nearest neighbour searches are fast. One solution would be to use sqlite R*Trees. I did not use them on android and they work not out of the box you have to build sqlite-android yourself (see this question). Or use Perst, or ...
If you have few data, that fits into the phone memory you can use a Quadtree. This would be even faster than the db when searching it. You will find lots of examples when you google it. You could store the data as xml, json or even serialize the whole quadtree with the java
Serializable
interface.There are tons of possibillities this question is way too broad. Some random ideas:
Create a server that responds to bounding box searches over HTTP and store the POIs in a Quadtree.
Deliver all your POIs with the app. As database, xml, json or a serialized Quadtree.
I don't have experience with kml on Android.