forked from FarmMaps/FarmMapsApiClient
improved shapetogeotiff method
This commit is contained in:
parent
61985f9079
commit
6a3baeb8ad
@ -66,10 +66,15 @@ namespace FarmmapsApi.Services
|
||||
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);
|
||||
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,
|
||||
i => i.Created >= startUpload &&
|
||||
|
@ -200,7 +200,7 @@ namespace FarmmapsNbs
|
||||
}
|
||||
|
||||
_logger.LogInformation($"Converting shape to geotiff");
|
||||
geotiffItem = await _generalService.ShapeToGeotiff(shapeItem);
|
||||
geotiffItem = await _generalService.ShapeToGeotiff(shapeItem, 1, input.InputLayerName);
|
||||
if (geotiffItem == null)
|
||||
{
|
||||
_logger.LogError("Something went wrong with shape to geotiff transformation");
|
||||
|
Loading…
Reference in New Issue
Block a user