Adam Varhegyi
Adam Varhegyi

Reputation: 9904

How to add basic grids to GoogleMap Api v2

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:

enter image description here

Upvotes: 1

Views: 1288

Answers (1)

MaciejGórski
MaciejGórski

Reputation: 22232

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

Demo

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.

Upvotes: 1

Related Questions