Tile size effect on Android Maps TileProvider?

I play with TileOverlay in Android Maps v2, and I created my own TileProvider very similar to this one .

But there is something that strikes me as strange. No matter what number I pass to the Tile constructor, the image on the screen is always the same: from 4 to 9 tiles that divide the screen space evenly:

enter image description here

Of course, this is what you expect from reading the documentation :

The coordinates of the tiles are measured in the upper left (northwest) corner of the map. At the scaling level N, the x coordinate values ​​of the tiles vary from 0 to 2N - 1 and increase from west to east, and the y values ​​vary from 0 to 2N - 1 and increase from north to south.

But you can guess that there is actually such functionality from viewing the documentation of constructors p>

Creates a tile.

Options
width image width in pixels
height image height in pixels
data strong> A byte array containing image data. An image will be created from this data by calling decodeByteArray (byte [], int, int).

Therefore, I obviously misunderstood something. My personal guess is that the tiles should cover the entire β€œmap plate” and therefore cannot be shortened.

My goal is to make my tiles about 10dp screen. So again my question to you:

Can I implement this with TileOverlay , or am I eventually using custom Marker s?

+4
source share
1 answer

The size of the tile specified in the constructor is the size (each) of the bitmap fragment that you put on the map. This allows you to provide tiles with different densities for different screens, if you have such resources. It will not resize the image drawn on the map. The physical size of the map tile is determined by the zoom level, where the zoom level 0 is one tile covering the whole world, 1 - 2x2 tiles, etc. This is part of the open web map standard for map fragments, not specific to Google.

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

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

+1
source

Source: https://habr.com/ru/post/1485419/


All Articles