1use tile_grid::{extent_wgs84_to_merc, Extent, Grid, GridIterator, Origin, Unit};
2
3pub fn google_mercator() -> Grid {
4 Grid::new(
5 256,
6 256,
7 Extent {
8 minx: -20037508.342789248,
9 miny: -20037508.342789248,
10 maxx: 20037508.342789248,
11 maxy: 20037508.342789248,
12 },
13 3857,
14 Unit::Meters,
15 vec![
16 156543.033928041,
17 78271.5169640205,
18 39135.75848201025,
19 19567.879241005125,
20 9783.939620502562,
21 4891.969810251281,
22 2445.9849051256406,
23 1222.9924525628203,
24 611.4962262814101,
25 305.7481131407051,
26 152.87405657035254,
27 76.43702828517627,
28 38.218514142588134,
29 19.109257071294067,
30 9.554628535647034,
31 4.777314267823517,
32 2.3886571339117584,
33 1.1943285669558792,
34 0.5971642834779396,
35 0.2985821417389698,
36 0.1492910708694849,
37 0.07464553543474245,
38 0.037322767717371225,
39 ],
40 Origin::TopLeft,
41 )
42}
43
44pub fn tile_coordinates_bavaria(grid: &Grid, zoom: u8) -> Vec<(u8, u32, u32)> {
56 let tile_limits = grid.tile_limits(
57 extent_wgs84_to_merc(&Extent {
58 minx: 8.9771580802,
59 miny: 47.2703623267,
60 maxx: 13.8350427083,
61 maxy: 50.5644529365,
62 }),
63 0,
64 );
65
66 GridIterator::new(zoom, zoom, tile_limits).collect()
67}