update poten; schaduw moet nu als attribute worden meegegeven
This commit is contained in:
parent
761221d936
commit
f71f072be7
@ -64,11 +64,12 @@ namespace FarmmapsApi.Services
|
||||
}
|
||||
|
||||
public async Task<Item> ShapeToGeotiff(Item shapeItem) {
|
||||
var startUpload = DateTime.UtcNow.AddSeconds(-3);
|
||||
await RunAndWaitForTask(shapeItem, "vnd.farmmaps.task.shapetogeotiff");
|
||||
|
||||
// the parent of the shape item is now the tiff item
|
||||
shapeItem = await _farmmapsApiService.GetItemAsync(shapeItem.Code);
|
||||
return await _farmmapsApiService.GetItemAsync(shapeItem.ParentCode);
|
||||
return await FindChildItemAsync(shapeItem.ParentCode, GEOTIFF_PROCESSED_ITEMTYPE, shapeItem.Name,
|
||||
i => i.Created >= startUpload &&
|
||||
i.Name.ToLower().Contains(shapeItem.Name.ToLower()));
|
||||
}
|
||||
|
||||
|
||||
|
@ -104,12 +104,13 @@ namespace FarmmapsNbs
|
||||
await PollTask(TimeSpan.FromSeconds(5), async (tokenSource) =>
|
||||
{
|
||||
var itemTaskStatus = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, itemTaskCode);
|
||||
_logger.LogInformation($"Calculating uptake map; status: {itemTaskStatus.State}");
|
||||
if (itemTaskStatus.IsFinished)
|
||||
tokenSource.Cancel();
|
||||
tokenSource.Cancel();
|
||||
});
|
||||
|
||||
var itemTask = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, itemTaskCode);
|
||||
if(itemTask.State == ItemTaskState.Error)
|
||||
if (itemTask.State == ItemTaskState.Error)
|
||||
{
|
||||
_logger.LogError($"Something went wrong with task execution: {itemTask.Message}");
|
||||
return null;
|
||||
@ -159,7 +160,7 @@ namespace FarmmapsNbs
|
||||
await PollTask(TimeSpan.FromSeconds(5), async (tokenSource) =>
|
||||
{
|
||||
var itemTaskStatus = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, itemTaskCode);
|
||||
|
||||
_logger.LogInformation($"Calculating application map; status: {itemTaskStatus.State}");
|
||||
if (itemTaskStatus.IsFinished)
|
||||
tokenSource.Cancel();
|
||||
});
|
||||
@ -175,7 +176,7 @@ namespace FarmmapsNbs
|
||||
|
||||
var itemName = $"VRANbs application";
|
||||
var applicationMapItem = await _generalService.FindChildItemAsync(cropfieldItem.Code,
|
||||
GEOTIFF_PROCESSED_ITEMTYPE, itemName,
|
||||
GEOTIFF_PROCESSED_ITEMTYPE, itemName,
|
||||
i => i.Updated >= itemTask.Finished.GetValueOrDefault(DateTime.UtcNow) &&
|
||||
i.Name.ToLower().Contains(itemName.ToLower()));
|
||||
if (applicationMapItem == null)
|
||||
|
BIN
FarmmapsPoten/Data/BBL-lutum.tif
Normal file
BIN
FarmmapsPoten/Data/BBL-lutum.tif
Normal file
Binary file not shown.
@ -157,7 +157,7 @@ namespace FarmmapsVRApoten
|
||||
|
||||
// INPUT IS NEEDED as GEOTIFF
|
||||
var applianceMapItem =
|
||||
await _potenService.CalculateApplicationMapAsync(cropfieldItem, geotiffItem, meanDensity, variation, countPerArea);
|
||||
await _potenService.CalculateApplicationMapAsync(cropfieldItem, geotiffItem, meanDensity, variation, countPerArea, useShadow);
|
||||
|
||||
if (applianceMapItem == null) {
|
||||
return;
|
||||
|
@ -1,46 +1,57 @@
|
||||
[
|
||||
{
|
||||
"File": "PlantingSampleDataLutum.zip",
|
||||
"OutputFileName": "20210216_vraPoten_SampleData",
|
||||
"FieldName": "lutum",
|
||||
"PlantingYear": 2020,
|
||||
"MeanDensity": "30",
|
||||
"Variation": "20",
|
||||
"UseShadow": false,
|
||||
"CountPerArea": true,
|
||||
"geometryJson": {
|
||||
"type": "Polygon",
|
||||
"coordinates": [
|
||||
[
|
||||
[ 5.66886041703652044, 52.52929999060298627 ],
|
||||
[ 5.6716230923214912, 52.52946316399909676 ],
|
||||
[ 5.67185376229668581, 52.5280565894154563 ],
|
||||
[ 5.66903207841337231, 52.52790646510525363 ],
|
||||
[ 5.66886041703652044, 52.52929999060298627 ]
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
"GenerateTaskmap": true,
|
||||
"CellWidth": "3",
|
||||
"CellHeight": "10",
|
||||
"Centered": "true",
|
||||
"StartPoint": {
|
||||
"type": "Point",
|
||||
//"coordinates": [ 5.669032078413372, 52.527906465105254 ] // 1
|
||||
//"coordinates": [ 5.668860417036520, 52.529299990602986 ] // 2
|
||||
//"coordinates": [ 5.671623092321491, 52.529463163999097 ] // 3
|
||||
"coordinates": [ 5.671853762296686, 52.528056589415456 ] // 4
|
||||
},
|
||||
"EndPoint": {
|
||||
"type": "Point",
|
||||
"coordinates": [ 5.669032078413372, 52.527906465105254 ] // 1
|
||||
//"coordinates": [ 5.668860417036520, 52.529299990602986 ] // 2
|
||||
//"coordinates": [ 5.671623092321491, 52.529463163999097 ] // 3
|
||||
//"coordinates": [ 5.671853762296686, 52.528056589415456 ] // 4
|
||||
} // if no angle
|
||||
|
||||
//"Angle": "317.0" // if no endpoint
|
||||
}
|
||||
"File": "BBL-lutum.tif",
|
||||
"OutputFileName": "BBL-poten_30_20_Shadow-True-v2_TifInput",
|
||||
"FieldName": "lutum",
|
||||
"PlantingYear": 2020,
|
||||
"MeanDensity": "30",
|
||||
"Variation": "20",
|
||||
"UseShadow": true,
|
||||
"CountPerArea": false,
|
||||
"geometryJson": {
|
||||
"type": "Polygon",
|
||||
"coordinates": [
|
||||
[
|
||||
[ 4.61098862747705418, 52.22974843124053734 ],
|
||||
[ 4.61338362824790682, 52.22993593073885421 ],
|
||||
[ 4.61949010053501397, 52.22667042162688489 ],
|
||||
[ 4.61954106663577324, 52.22670579437124871 ],
|
||||
[ 4.61953075937382085, 52.22671128094363269 ],
|
||||
[ 4.61954202811175296, 52.22670563321562298 ],
|
||||
[ 4.61901745087585081, 52.22634382962637289 ],
|
||||
[ 4.61812211075603685, 52.22571430401869463 ],
|
||||
[ 4.61736058962494678, 52.22611942369080396 ],
|
||||
[ 4.61464150409827134, 52.2275669988328346 ],
|
||||
[ 4.61407137489250019, 52.22787370291415243 ],
|
||||
[ 4.61242270952427802, 52.2287649864655279 ],
|
||||
[ 4.61261020576063618, 52.22887063061121182 ],
|
||||
[ 4.61256645484349015, 52.22889713517798072 ],
|
||||
[ 4.61229657126373027, 52.22904994233584119 ],
|
||||
[ 4.61207777596369262, 52.2291602791168188 ],
|
||||
[ 4.61174554282434013, 52.22933965721241378 ],
|
||||
[ 4.61169310584479941, 52.22934596082312453 ],
|
||||
[ 4.61143525446537428, 52.22949107699816551 ],
|
||||
[ 4.61100843013417183, 52.22973689585098356 ],
|
||||
[ 4.61098862747705418, 52.22974843124053734 ]
|
||||
]
|
||||
]
|
||||
},
|
||||
|
||||
"GenerateTaskmap": true,
|
||||
"CellWidth": "3",
|
||||
"CellHeight": "10",
|
||||
"Centered": "false",
|
||||
"StartPoint": {
|
||||
"type": "Point",
|
||||
"coordinates": [ 4.61812211075603685, 52.22571430401869463 ] // BBL
|
||||
},
|
||||
"EndPoint": {
|
||||
"type": "Point",
|
||||
"coordinates": [ 4.61242270952427802, 52.2287649864655279 ] // BBL
|
||||
} // if no angle
|
||||
|
||||
//"Angle": "317.0" // if no endpoint
|
||||
}
|
||||
|
||||
]
|
||||
|
@ -25,7 +25,7 @@ namespace FarmmapsVRApoten
|
||||
_generalService = generalService;
|
||||
}
|
||||
|
||||
public async Task<Item> CalculateApplicationMapAsync(Item cropfieldItem, Item inputItem, string meanDensity, string variation, bool countPerArea)
|
||||
public async Task<Item> CalculateApplicationMapAsync(Item cropfieldItem, Item inputItem, string meanDensity, string variation, bool countPerArea, bool useShadow)
|
||||
{
|
||||
var potenApplicationMapRequest = new TaskRequest() { TaskType = VRAPLANTING_TASK };
|
||||
if (inputItem != null) {potenApplicationMapRequest.attributes["inputCode"] = inputItem.Code; }
|
||||
@ -33,6 +33,7 @@ namespace FarmmapsVRApoten
|
||||
potenApplicationMapRequest.attributes["variation"] = variation;
|
||||
potenApplicationMapRequest.attributes["variation"] = variation;
|
||||
potenApplicationMapRequest.attributes["countPerArea"] = countPerArea.ToString();
|
||||
potenApplicationMapRequest.attributes["useShadow"] = countPerArea.ToString();
|
||||
|
||||
var taskCode = await _farmmapsApiService.QueueTaskAsync(cropfieldItem.Code, potenApplicationMapRequest);
|
||||
_logger.LogInformation($"itemTaskCode: {taskCode}");
|
||||
|
Loading…
Reference in New Issue
Block a user