How can I get the details of Tile Count, Tile X, Tile Y without specifying the zoom level (or LevelOfDetails)?

This is with a link to the Google Tile Map or Bing Maps. Is it possible to get Tile Count, Tile X, Tile Y data without specifying the zoom level (or LevelOfDetails) with any internal calculations?

The client will provide only the coordinates P1 and P2 and ask for a tile map and associated box, etc.

Shilpa

+4
source share
3 answers

Each tile has 256 pixels by 256 pixels.

Scale level 0 - 1 tile. (1 x 1)

Scale level 1 - 4 tiles. (2 x 2)

Scale level 2 - 16 tiles. (4 x 4)

Level 3 image level is 64 fragments. (8 x 8)

Level 4 image level is 256 fragments (16 x 16)

For each zoom level, the x and y values ​​are doubled. According to the comment 88ad the formula for the number of tiles (2 ^ zoom x 2 ^ zoom).

Hope you can do the rest of the math with a magnification level of 18. To save space, ocean tiles are not stored. They are created in response to a request.

At a zoom level of 3, tiles are numbered from 0 to 7 in the x direction (longitude) and numbered from 0 to 7 in the y direction (latitude).

Tiles begin on the US side next to the International Date Line (-180 or +180 longitude). Tile 0.0 begins at approximately 70 Β° north latitude.

See the Mercator Projection article for more details on how a sphere maps to a plane. Calculations for converting longitude and latitude to x and y coordinates are provided in the Wikipedia article.

You can match any point of the Mercator projection with a set of tiles. A tile set is a tile set with a zoom level. You need to know the zoom level to find out which tile is set for access, and to calculate which tile in the tile set should be extracted and displayed.

This Google Mapping blog post provides a formula for converting (latitude, longitude, scaling) to (x, y, scaling), where x and y are a fragment from a scaling set.

+14
source

You might want to check the wiki for OSM file names. They are almost the same as google tiles, except for the direction of the y axis. A description with a lot of code examples is given here: http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames

+4
source

If you have a bounding box, you can use this python function to find the zoom level (or a similar function in your choice of programming language):

def level_dic(): ''' http://wiki.openstreetmap.org/wiki/Zoom_levels ''' data = {0: 360.0, 1: 180.0, 2: 90.0, 3: 45.0, 4: 22.5, 5: 11.25, 6: 5.625, 7: 2.813, 8: 1.406, 9: 0.703, 10: 0.352, 11: 0.176, 12: 0.088, 13: 0.044, 14: 0.022, 15: 0.011, 16: 0.005, 17: 0.003, 18: 0.001, 19: 0.0005} return data def getzoom(self): data = level_dic() # our presets a, b, c, d = bbox r = 3 dne = abs(round(float(c) - float(a), r)) # ne: North East point mylist = [round(i, r) for i in data.values()] + [dne] new = sorted(mylist, reverse=True) return new.index(dne) 

I used this link . The rest is simple. You need to use Slippy_map_tilenames .

+1
source

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


All Articles