forked from FarmMaps/FarmMapsApiClient
fix uploading
This commit is contained in:
parent
c2515281d1
commit
a1696c38c7
@ -68,10 +68,7 @@ namespace FarmmapsApi.Services
|
||||
contentStream.ThrowIfNull(nameof(contentStream));
|
||||
|
||||
_streamLength = ContentStream.CanSeek ? ContentStream.Length : UnknownSize;
|
||||
|
||||
var twoMB = 2 * 0x100000;
|
||||
ChunkSize = twoMB;
|
||||
body.ChunkSize = ChunkSize;
|
||||
ChunkSize = 2 * 0x100000;
|
||||
Body = body;
|
||||
|
||||
Path = path;
|
||||
|
@ -41,7 +41,14 @@ namespace FarmmapsApi.Services
|
||||
{
|
||||
var startUpload = DateTime.UtcNow.AddSeconds(-3);
|
||||
var result = await _farmmapsApiService.UploadFile(filePath, root.Code, geoJsonString,
|
||||
progress => _logger.LogInformation($"Status: {progress.Status} - BytesSent: {progress.BytesSent}"));
|
||||
progress =>
|
||||
{
|
||||
_logger.LogInformation($"Status: {progress.Status} - BytesSent: {progress.BytesSent}");
|
||||
|
||||
if(progress.Status == UploadStatus.Failed && progress.Exception != null)
|
||||
_logger.LogError(progress.Exception.Message ?? "No further error");
|
||||
|
||||
});
|
||||
|
||||
if (result.Progress.Status == UploadStatus.Failed)
|
||||
return null;
|
||||
@ -68,13 +75,16 @@ namespace FarmmapsApi.Services
|
||||
public async Task<Item> ShapeToGeotiff(Item shapeItem, int resolution = 1, params string[] inputLayerNames)
|
||||
{
|
||||
var startUpload = DateTime.UtcNow.AddSeconds(-3);
|
||||
await RunAndWaitForTask(shapeItem, "vnd.farmmaps.task.shapetogeotiff", request =>
|
||||
var taskStatus = await RunAndWaitForTask(shapeItem, "vnd.farmmaps.task.shapetogeotiff", request =>
|
||||
{
|
||||
request.attributes["resolution"] = resolution.ToString();
|
||||
if(inputLayerNames.Length > 0)
|
||||
request.attributes["inputLayers"] = $"[{string.Join(",", inputLayerNames.Select(v => $"\"{v}\""))}]";
|
||||
});
|
||||
|
||||
if (taskStatus.State == ItemTaskState.Error)
|
||||
return null;
|
||||
|
||||
return await FindChildItemAsync(shapeItem.ParentCode, GEOTIFF_PROCESSED_ITEMTYPE, shapeItem.Name,
|
||||
i => i.Created >= startUpload &&
|
||||
i.Name.ToLower().Contains(shapeItem.Name.ToLower()));
|
||||
|
@ -143,14 +143,13 @@ namespace FarmmapsVRApoten
|
||||
_logger.LogInformation($"Converting shape to geotiff");
|
||||
|
||||
geotiffItem = await _generalService.ShapeToGeotiff(shapeItem);
|
||||
_logger.LogInformation($"ShapeToGeotiff_GeotiffItemcode: {geotiffItem.Code}");
|
||||
|
||||
|
||||
if (geotiffItem == null) {
|
||||
_logger.LogError("Something went wrong with shape to geotiff transformation");
|
||||
return;
|
||||
}
|
||||
|
||||
_logger.LogInformation($"ShapeToGeotiff_GeotiffItemcode: {geotiffItem.Code}");
|
||||
|
||||
_logger.LogInformation("Downloading geotiff file");
|
||||
await _farmmapsApiService.DownloadItemAsync(geotiffItem.Code,
|
||||
Path.Combine(DownloadFolder, $"VRApoten_inputGeotiff_{input.OutputFileName}.zip"));
|
||||
|
Loading…
Reference in New Issue
Block a user