How to add basic grids to GoogleMap Api v2

怎甘沉沦 提交于 2019-12-02 13:05:54

问题


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:


回答1:


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

Some notes:

  • 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.

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.



来源:https://stackoverflow.com/questions/16211783/how-to-add-basic-grids-to-googlemap-api-v2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!