4

I have been playing around with the TileOverlay in Android Maps v2 and I have built a custom TileProvider very very similar to this one

But there is something that strikes me as odd. No matter which number I pass on to the Tile constructor, the image on the screen is always the same - 4 to 9 Tiles sharing the screen space evenly, like this:

enter image description here

Of course this is something you would expect from reading the documentation:

The coordinates of the tiles are measured from the top left (northwest) corner of the map. At zoom level N, the x values of the tile coordinates range from 0 to 2N - 1 and increase from west to east and the y values range from 0 to 2N - 1 and increase from north to south.

But you might guess that there is in fact such a functionality from looking at the Constructors documentation

Constructs a Tile.

Parameters
width the width of the image in pixels
height the height of the image in pixels
data A byte array containing the image data. The image will be created from this data by calling decodeByteArray(byte[], int, int).

So obviously I misunderstood something here. My personal guess is that the tiles have to cover an entire "Map Tile" and can therefore not be shrunken

My goal would be to make my tiles about 10dp of the screen. Therefore again my question to you:

Can I realize this with TileOverlay or will I end up using custom Markers?

Community
  • 1
  • 1
avalancha
  • 1,457
  • 1
  • 22
  • 41

1 Answers1

2

The size of the tile specified in the constructor is the size of (every) bitmap tile you are supplying to the map. This allows you to provide tiles at different densities for different screens if you have such resources. It will not change the size of the image that is drawn on the map. The physical size of a map tile is defined by the zoom level, where a zoom level of 0 is a single tile covering the entire world, 1 is 2x2 tiles, etc. This is part of an open web map standard for map tiles, not defined by Google.

API docs: https://developers.google.com/maps/documentation/android/tileoverlay

Ref: http://www.maptiler.org/google-maps-coordinates-tile-bounds-projection/

rockgecko
  • 4,127
  • 2
  • 18
  • 31
  • This is the correct answer. It's really nice to get one instead of a workaround months after the question. +1 – avalancha Jan 06 '15 at 11:12
  • This answer is correct, for Android (which is what is being discussed here). I decided to add this comment to point Google's inconsistency since on the iOS SDK, they actually pull higher zoom level tiles to account for the higher pixel density of the device, resulting in a map matching the resolution of the device. It would be nice if they kept the SDKs consistent... – lbarbosa Apr 11 '23 at 13:39