forked from FarmMaps/FarmMapsApiClient
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) {
|
public async Task<Item> ShapeToGeotiff(Item shapeItem) {
|
||||||
|
var startUpload = DateTime.UtcNow.AddSeconds(-3);
|
||||||
await RunAndWaitForTask(shapeItem, "vnd.farmmaps.task.shapetogeotiff");
|
await RunAndWaitForTask(shapeItem, "vnd.farmmaps.task.shapetogeotiff");
|
||||||
|
|
||||||
// the parent of the shape item is now the tiff item
|
return await FindChildItemAsync(shapeItem.ParentCode, GEOTIFF_PROCESSED_ITEMTYPE, shapeItem.Name,
|
||||||
shapeItem = await _farmmapsApiService.GetItemAsync(shapeItem.Code);
|
i => i.Created >= startUpload &&
|
||||||
return await _farmmapsApiService.GetItemAsync(shapeItem.ParentCode);
|
i.Name.ToLower().Contains(shapeItem.Name.ToLower()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -104,6 +104,7 @@ namespace FarmmapsNbs
|
|||||||
await PollTask(TimeSpan.FromSeconds(5), async (tokenSource) =>
|
await PollTask(TimeSpan.FromSeconds(5), async (tokenSource) =>
|
||||||
{
|
{
|
||||||
var itemTaskStatus = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, itemTaskCode);
|
var itemTaskStatus = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, itemTaskCode);
|
||||||
|
_logger.LogInformation($"Calculating uptake map; status: {itemTaskStatus.State}");
|
||||||
if (itemTaskStatus.IsFinished)
|
if (itemTaskStatus.IsFinished)
|
||||||
tokenSource.Cancel();
|
tokenSource.Cancel();
|
||||||
});
|
});
|
||||||
@ -159,7 +160,7 @@ namespace FarmmapsNbs
|
|||||||
await PollTask(TimeSpan.FromSeconds(5), async (tokenSource) =>
|
await PollTask(TimeSpan.FromSeconds(5), async (tokenSource) =>
|
||||||
{
|
{
|
||||||
var itemTaskStatus = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, itemTaskCode);
|
var itemTaskStatus = await _farmmapsApiService.GetTaskStatusAsync(cropfieldItem.Code, itemTaskCode);
|
||||||
|
_logger.LogInformation($"Calculating application map; status: {itemTaskStatus.State}");
|
||||||
if (itemTaskStatus.IsFinished)
|
if (itemTaskStatus.IsFinished)
|
||||||
tokenSource.Cancel();
|
tokenSource.Cancel();
|
||||||
});
|
});
|
||||||
|
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
|
// INPUT IS NEEDED as GEOTIFF
|
||||||
var applianceMapItem =
|
var applianceMapItem =
|
||||||
await _potenService.CalculateApplicationMapAsync(cropfieldItem, geotiffItem, meanDensity, variation, countPerArea);
|
await _potenService.CalculateApplicationMapAsync(cropfieldItem, geotiffItem, meanDensity, variation, countPerArea, useShadow);
|
||||||
|
|
||||||
if (applianceMapItem == null) {
|
if (applianceMapItem == null) {
|
||||||
return;
|
return;
|
||||||
|
@ -1,22 +1,39 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"File": "PlantingSampleDataLutum.zip",
|
|
||||||
"OutputFileName": "20210216_vraPoten_SampleData",
|
"File": "BBL-lutum.tif",
|
||||||
|
"OutputFileName": "BBL-poten_30_20_Shadow-True-v2_TifInput",
|
||||||
"FieldName": "lutum",
|
"FieldName": "lutum",
|
||||||
"PlantingYear": 2020,
|
"PlantingYear": 2020,
|
||||||
"MeanDensity": "30",
|
"MeanDensity": "30",
|
||||||
"Variation": "20",
|
"Variation": "20",
|
||||||
"UseShadow": false,
|
"UseShadow": true,
|
||||||
"CountPerArea": true,
|
"CountPerArea": false,
|
||||||
"geometryJson": {
|
"geometryJson": {
|
||||||
"type": "Polygon",
|
"type": "Polygon",
|
||||||
"coordinates": [
|
"coordinates": [
|
||||||
[
|
[
|
||||||
[ 5.66886041703652044, 52.52929999060298627 ],
|
[ 4.61098862747705418, 52.22974843124053734 ],
|
||||||
[ 5.6716230923214912, 52.52946316399909676 ],
|
[ 4.61338362824790682, 52.22993593073885421 ],
|
||||||
[ 5.67185376229668581, 52.5280565894154563 ],
|
[ 4.61949010053501397, 52.22667042162688489 ],
|
||||||
[ 5.66903207841337231, 52.52790646510525363 ],
|
[ 4.61954106663577324, 52.22670579437124871 ],
|
||||||
[ 5.66886041703652044, 52.52929999060298627 ]
|
[ 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 ]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -24,20 +41,14 @@
|
|||||||
"GenerateTaskmap": true,
|
"GenerateTaskmap": true,
|
||||||
"CellWidth": "3",
|
"CellWidth": "3",
|
||||||
"CellHeight": "10",
|
"CellHeight": "10",
|
||||||
"Centered": "true",
|
"Centered": "false",
|
||||||
"StartPoint": {
|
"StartPoint": {
|
||||||
"type": "Point",
|
"type": "Point",
|
||||||
//"coordinates": [ 5.669032078413372, 52.527906465105254 ] // 1
|
"coordinates": [ 4.61812211075603685, 52.22571430401869463 ] // BBL
|
||||||
//"coordinates": [ 5.668860417036520, 52.529299990602986 ] // 2
|
|
||||||
//"coordinates": [ 5.671623092321491, 52.529463163999097 ] // 3
|
|
||||||
"coordinates": [ 5.671853762296686, 52.528056589415456 ] // 4
|
|
||||||
},
|
},
|
||||||
"EndPoint": {
|
"EndPoint": {
|
||||||
"type": "Point",
|
"type": "Point",
|
||||||
"coordinates": [ 5.669032078413372, 52.527906465105254 ] // 1
|
"coordinates": [ 4.61242270952427802, 52.2287649864655279 ] // BBL
|
||||||
//"coordinates": [ 5.668860417036520, 52.529299990602986 ] // 2
|
|
||||||
//"coordinates": [ 5.671623092321491, 52.529463163999097 ] // 3
|
|
||||||
//"coordinates": [ 5.671853762296686, 52.528056589415456 ] // 4
|
|
||||||
} // if no angle
|
} // if no angle
|
||||||
|
|
||||||
//"Angle": "317.0" // if no endpoint
|
//"Angle": "317.0" // if no endpoint
|
||||||
|
@ -25,7 +25,7 @@ namespace FarmmapsVRApoten
|
|||||||
_generalService = generalService;
|
_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 };
|
var potenApplicationMapRequest = new TaskRequest() { TaskType = VRAPLANTING_TASK };
|
||||||
if (inputItem != null) {potenApplicationMapRequest.attributes["inputCode"] = inputItem.Code; }
|
if (inputItem != null) {potenApplicationMapRequest.attributes["inputCode"] = inputItem.Code; }
|
||||||
@ -33,6 +33,7 @@ namespace FarmmapsVRApoten
|
|||||||
potenApplicationMapRequest.attributes["variation"] = variation;
|
potenApplicationMapRequest.attributes["variation"] = variation;
|
||||||
potenApplicationMapRequest.attributes["variation"] = variation;
|
potenApplicationMapRequest.attributes["variation"] = variation;
|
||||||
potenApplicationMapRequest.attributes["countPerArea"] = countPerArea.ToString();
|
potenApplicationMapRequest.attributes["countPerArea"] = countPerArea.ToString();
|
||||||
|
potenApplicationMapRequest.attributes["useShadow"] = countPerArea.ToString();
|
||||||
|
|
||||||
var taskCode = await _farmmapsApiService.QueueTaskAsync(cropfieldItem.Code, potenApplicationMapRequest);
|
var taskCode = await _farmmapsApiService.QueueTaskAsync(cropfieldItem.Code, potenApplicationMapRequest);
|
||||||
_logger.LogInformation($"itemTaskCode: {taskCode}");
|
_logger.LogInformation($"itemTaskCode: {taskCode}");
|
||||||
|
Loading…
Reference in New Issue
Block a user