File tree Expand file tree Collapse file tree 2 files changed +6
-26
lines changed Expand file tree Collapse file tree 2 files changed +6
-26
lines changed Original file line number Diff line number Diff line change 15
15
16
16
namespace inf {
17
17
18
- constexpr const uint16_t TILE_SIZE = 256 ;
19
-
20
18
// An XYZ web mercator tile
21
19
class Tile
22
20
{
@@ -189,26 +187,8 @@ class Tile
189
187
int32_t _z = 0 ;
190
188
};
191
189
192
- // returns the 0 based index of the tile in the given extent
193
- // tiles are row major, 0 is the top left tile
194
- inline std::optional<uint32_t > tile_index (const Tile& tile, const inf::GeoMetadata& meta) noexcept
195
- {
196
- std::optional<uint32_t > result;
197
-
198
- auto upperLeft = crs::lat_lon_to_web_mercator (tile.center ());
199
-
200
- if (meta.is_on_map (upperLeft)) {
201
- const auto tilesPerRow = inf::truncate<uint32_t >(meta.cols / TILE_SIZE);
202
-
203
- auto cell = meta.convert_point_to_cell (upperLeft);
204
- cell.r /= TILE_SIZE;
205
- cell.c /= TILE_SIZE;
206
- result = cell.r * tilesPerRow + cell.c ;
207
- }
208
-
209
- return result;
210
- }
211
-
212
190
GeoMetadata create_xyz_tile_aligned_extent (const inf::GeoMetadata& extent);
191
+ double pixel_size_at_zoom_level (uint32_t zoomLevel) noexcept ;
192
+ uint32_t zoom_level_for_pixel_size (double pixelSize, bool preferHigher) noexcept ;
213
193
214
194
}
Original file line number Diff line number Diff line change 6
6
7
7
namespace inf {
8
8
9
- #ifdef INFRA_GDAL_ENABLED
10
- static double pixel_size_at_zoom_level (uint32_t zoomLevel) noexcept
9
+ constexpr const uint16_t TILE_SIZE = 256 ;
10
+
11
+ double pixel_size_at_zoom_level (uint32_t zoomLevel) noexcept
11
12
{
12
13
const auto tilesPerRow = std::pow (2 , zoomLevel);
13
14
const auto metersPerTile = constants::EARTH_CIRCUMFERENCE_M / tilesPerRow;
14
15
15
16
return metersPerTile / TILE_SIZE;
16
17
}
17
18
18
- static uint32_t zoom_level_for_pixel_size (double pixelSize, bool preferHigher) noexcept
19
+ uint32_t zoom_level_for_pixel_size (double pixelSize, bool preferHigher) noexcept
19
20
{
20
21
uint32_t zoomLevel = 20 ;
21
22
while (zoomLevel > 0 ) {
@@ -33,7 +34,6 @@ static uint32_t zoom_level_for_pixel_size(double pixelSize, bool preferHigher) n
33
34
34
35
return zoomLevel;
35
36
}
36
- #endif
37
37
38
38
GeoMetadata create_xyz_tile_aligned_extent (const inf::GeoMetadata& extent)
39
39
{
You can’t perform that action at this time.
0 commit comments