improved shapetogeotiff method
This commit is contained in:
		| @@ -66,10 +66,15 @@ namespace FarmmapsApi.Services | |||||||
|                      i.Name.ToLower().Contains(itemName.ToLower())); ; |                      i.Name.ToLower().Contains(itemName.ToLower())); ; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         public async Task<Item> ShapeToGeotiff(Item shapeItem) |         public async Task<Item> ShapeToGeotiff(Item shapeItem, int resolution = 1, params string[] inputLayerNames) | ||||||
|         { |         { | ||||||
|             var startUpload = DateTime.UtcNow.AddSeconds(-3); |             var startUpload = DateTime.UtcNow.AddSeconds(-3); | ||||||
|             await RunAndWaitForTask(shapeItem, "vnd.farmmaps.task.shapetogeotiff"); |             await RunAndWaitForTask(shapeItem, "vnd.farmmaps.task.shapetogeotiff", request => | ||||||
|  |             { | ||||||
|  |                 request.attributes["resolution"] = resolution.ToString(); | ||||||
|  |                 if(inputLayerNames.Length > 0) | ||||||
|  |                     request.attributes["inputLayers"] = $"[{string.Join(",", inputLayerNames)}]"; | ||||||
|  |             }); | ||||||
|  |  | ||||||
|             return await FindChildItemAsync(shapeItem.ParentCode, GEOTIFF_PROCESSED_ITEMTYPE, shapeItem.Name, |             return await FindChildItemAsync(shapeItem.ParentCode, GEOTIFF_PROCESSED_ITEMTYPE, shapeItem.Name, | ||||||
|                 i => i.Created >= startUpload && |                 i => i.Created >= startUpload && | ||||||
|   | |||||||
| @@ -200,7 +200,7 @@ namespace FarmmapsNbs | |||||||
|                 } |                 } | ||||||
|  |  | ||||||
|                 _logger.LogInformation($"Converting shape to geotiff"); |                 _logger.LogInformation($"Converting shape to geotiff"); | ||||||
|                 geotiffItem = await _generalService.ShapeToGeotiff(shapeItem); |                 geotiffItem = await _generalService.ShapeToGeotiff(shapeItem, 1, input.InputLayerName); | ||||||
|                 if (geotiffItem == null) |                 if (geotiffItem == null) | ||||||
|                 { |                 { | ||||||
|                     _logger.LogError("Something went wrong with shape to geotiff transformation"); |                     _logger.LogError("Something went wrong with shape to geotiff transformation"); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user