如何向GoogleMap Api v2添加基本网格 [英] How to add basic grids to GoogleMap Api v2

查看:179
本文介绍了如何向GoogleMap Api v2添加基本网格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将基本网格添加到我的GoogleMap中,该网格曾经在地图上使用. 我阅读了文档,但没有找到任何有帮助的方法,也许 TileOverlay GroundOverlay 可以达到目的,但我没有找到任何示例或教程,甚至在官方中也没有样本.

I would like to add the basic grids to my GoogleMap that use to be on maps. I read the docs but didnt found anything that could help, maybe the TileOverlay or GroundOverlay can do the trick, but i didnt found any examples or tutorials, not even in the official samples.

有人可以建议我一些可行的方法吗?

Can anybody suggest me some ways that could work ?

E D I T:

是的,我想要这样的网格线:

Yes i would like gridlines like this:

推荐答案

似乎我有一个完全可以做到这一点的代码.我仅将其用于调试,但此处为:

Seems like I have a code that does exactly that. I used it only for debugging, but here it is: DebugHelper.java.

一些注意事项:

  • you will also have to copy SphericalMercator.java
  • change IGoogleMap to original GoogleMap and IProjection to Projection
  • clusterSize parameter is in degrees, so you will have to change it depending on the zoom
  • finally: call drawDebugGrid in onCameraChange.

如果您希望看到它的实际效果,可以运行 Android的演示地图扩展.您需要查看网格的唯一更改是在

If you want to see it in action, you may run the demo of Android Maps Extensions. The only change you need to make to see grid is setting DEBUG_GRID to true on one of the first lines in GridClusteringStrategy.java.

这篇关于如何向GoogleMap Api v2添加基本网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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