在我花大量时间学习/研究 KML 之前,你们能告诉我这个解决方案是否有效吗? (看起来我需要在某个时候学习它,但首先我有一个截止日期。)
背景 - 我需要在地图上绘制 1662 个点,分为 7 个类别。我想显示所有类别,以及过滤/仅显示用户选择的类别。
我的第一次尝试使用了 Google Maps API。我创建了 GeoPoints,将它们添加到 ItemizedOverlay,然后将 ItemizedOverlay 添加到地图。这对于一些点来说非常有效。 100分只用了3秒。当我达到 400 分时,事情真的开始变慢(比如 30 秒左右)。我把1662都加载完了,花了15分钟!
1)为什么需要这么长时间? API 是否会针对每个点调用 Google 地图?
2) 我发现 KML 作为一个可能的替代方案。 KML 的扩展能力如何?它能够绘制并加载 1600 多个点吗?如果没有,您能推荐另一种解决方案吗?
3)您建议我如何过滤我的类别?目前,我计划将每个类别加载到一个图层。我找到了隐藏/显示图层的参考,所以我将尝试这样做。这是一个好方法吗?
4)如何添加按钮?我可以/应该将它们添加到叠加层中吗?如果没有,是否可以在 MapView 中打开地图,然后使用 Android 按钮控制过滤/显示?
如果我的问题听起来很基本,我很抱歉。我会继续自己研究和学习。然而,我想知道我的解决方案是否有效,然后再浪费一周时间陷入另一个死胡同。
提前致谢! :)
Will you guys tell me whether or not this solution will work before I spend a lot of time learning/researching KML? (It looks like I need to learn it at some point, but I have a deadline to meet, first.)
Background - I need to plot 1662 points on a map that fall into 7 categories. I would like to show all, as well as filter/show only categories that the user chooses.
My first attempt at this used the Google Maps API. I created GeoPoints, added them to an ItemizedOverlay, and then added the ItemizedOverlay to the map. That works great for a few points. 100 points only took 3 seconds. By the time I got up to 400 points, things really started to slow down (like 30 seconds or so). I loaded all 1662, and it took 15 minutes!
1) Why does this take so long? Does the API make a call to Google Maps for each point?
2) I found KML as a possible alternative. How well does KML scale? Will it be able to plot and load 1600+ points? If not, can you recommend another solution?
3) How do you recommend I go about filtering my categories? Currently, I plan on loading each category to a layer. I found references to hiding/showing layers, so I'm going to try to do that. Is this a good approach?
4) How can I add buttons? Can/should I add them to an overlay? If not, is it possible to have the map open in a MapView and then control the filter/show with Android Buttons?
I'm sorry if my questions sound basic. I will continue researching and learning on my own. However, I want to know whether or not my solution will work at all before I waste another week going down another dead end.
Thanks in advance! :)
发布评论
评论(1)
我对 Android 一无所知,但我正在开发一个从 Java 应用程序生成 KML 输出的项目。我不确定使用 Android Java 时有什么样的限制,但如果可以的话,您应该尝试以下开源库:
JAK - KML 的 Java API
它将使 KML 创建变得相当容易。我无法回答您有关 Android 上可扩展性的问题,因为我没有这方面的经验。
I don't know anything about Android, but I am working on a project where I generate KML output from a Java application. I'm not sure what kind of constraints you have when working with Android Java, but if you can you should try the following open source library:
JAK - Java API for KML
It will make the KML creation fairly easy. I can't answer your question about scalability on Android since I have no experience with it.