mirror of
https://github.com/azaion/satellite-provider.git
synced 2026-04-22 07:16:39 +00:00
change how tiles are stored
This commit is contained in:
@@ -27,7 +27,7 @@ public class GoogleMapsDownloaderV2
|
||||
|
||||
private readonly ILogger<GoogleMapsDownloaderV2> _logger;
|
||||
private readonly string _apiKey;
|
||||
private readonly string _tilesDirectory;
|
||||
private readonly StorageConfig _storageConfig;
|
||||
private readonly IHttpClientFactory _httpClientFactory;
|
||||
|
||||
public GoogleMapsDownloaderV2(
|
||||
@@ -38,7 +38,7 @@ public class GoogleMapsDownloaderV2
|
||||
{
|
||||
_logger = logger;
|
||||
_apiKey = mapConfig.Value.ApiKey;
|
||||
_tilesDirectory = storageConfig.Value.TilesDirectory;
|
||||
_storageConfig = storageConfig.Value;
|
||||
_httpClientFactory = httpClientFactory;
|
||||
}
|
||||
|
||||
@@ -98,11 +98,11 @@ public class GoogleMapsDownloaderV2
|
||||
var server = 0;
|
||||
var url = string.Format(TILE_URL_TEMPLATE, server, tileX, tileY, zoomLevel, sessionToken);
|
||||
|
||||
Directory.CreateDirectory(_tilesDirectory);
|
||||
|
||||
var timestamp = DateTime.UtcNow.ToString("yyyyMMddHHmmss");
|
||||
var fileName = $"tile_{zoomLevel}_{tileX}_{tileY}_{timestamp}.jpg";
|
||||
var filePath = Path.Combine(_tilesDirectory, fileName);
|
||||
var subdirectory = _storageConfig.GetTileSubdirectoryPath(zoomLevel, tileX, tileY);
|
||||
Directory.CreateDirectory(subdirectory);
|
||||
|
||||
var filePath = _storageConfig.GetTileFilePath(zoomLevel, tileX, tileY, timestamp);
|
||||
|
||||
var imageBytes = await ExecuteWithRetryAsync(async () =>
|
||||
{
|
||||
@@ -278,11 +278,11 @@ public class GoogleMapsDownloaderV2
|
||||
var server = (x + y) % 4;
|
||||
var url = string.Format(TILE_URL_TEMPLATE, server, x, y, zoomLevel, sessionToken);
|
||||
|
||||
Directory.CreateDirectory(_tilesDirectory);
|
||||
|
||||
var timestamp = DateTime.UtcNow.ToString("yyyyMMddHHmmss");
|
||||
var fileName = $"tile_{zoomLevel}_{x}_{y}_{timestamp}.jpg";
|
||||
var filePath = Path.Combine(_tilesDirectory, fileName);
|
||||
var subdirectory = _storageConfig.GetTileSubdirectoryPath(zoomLevel, x, y);
|
||||
Directory.CreateDirectory(subdirectory);
|
||||
|
||||
var filePath = _storageConfig.GetTileFilePath(zoomLevel, x, y, timestamp);
|
||||
|
||||
var imageBytes = await ExecuteWithRetryAsync(async () =>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user