forked from FarmMaps/FarmMapsApiClient
ISOXML to taskmap
This commit is contained in:
@@ -108,18 +108,32 @@ namespace FarmmapsApi.Services
|
||||
}
|
||||
|
||||
// Create taskmap based on width, height and direction
|
||||
public async Task<Item> CreateTaskmap(Item cropfieldItem, Item tiffItem, string cellWidth, string cellHeight, string startPoint, string centered = "false", string endPoint = null, string angle = null)
|
||||
public async Task<Item> CreateTaskmap(Item cropfieldItem, Item tiffItem, string outputType, string cellWidth, string cellHeight,
|
||||
string startPoint, string ddiCode = "0001", string centered = "false", string endPoint = null, string angle = null,
|
||||
string cropTypeName = null, string costumerName = null, string ProductGroupName = null, string productName = null,
|
||||
string resolution = null, string unitScale = null, string maximumClasses = null)
|
||||
|
||||
{
|
||||
var taskmapRequest = new TaskRequest { TaskType = TASKMAP_TASK };
|
||||
taskmapRequest.attributes["inputCode"] = tiffItem.Code;
|
||||
taskmapRequest.attributes["operation"] = "shape"; // Currently onlye "shape" supported, if ISOXML is supported this should be an input
|
||||
taskmapRequest.attributes["operation"] = outputType; // Currently onlye "shape" supported, if ISOXML is supported this should be an input
|
||||
taskmapRequest.attributes["cellWidth"] = cellWidth; //metres
|
||||
taskmapRequest.attributes["cellHeight"] = cellHeight; //metres
|
||||
taskmapRequest.attributes["startPoint"] = startPoint; // Coordinates WGS84
|
||||
taskmapRequest.attributes["centered"] = centered;
|
||||
if (outputType == "isoxml") taskmapRequest.attributes["ddiCode"] = ddiCode; // ddi is obligatory for isoxml, if not given set to 0001
|
||||
if (angle == null) taskmapRequest.attributes["endPoint"] = endPoint; // Coordinates WGS84
|
||||
if (endPoint == null) taskmapRequest.attributes["angle"] = angle; // degrees between 0.0 and 360.0
|
||||
|
||||
// Optional attributes
|
||||
if (cropTypeName != null) taskmapRequest.attributes["cropTypeName"] = cropTypeName;
|
||||
if (costumerName != null) taskmapRequest.attributes["costumerName"] = costumerName;
|
||||
if (ProductGroupName != null) taskmapRequest.attributes["ProductGroupName"] = ProductGroupName;
|
||||
if (productName != null) taskmapRequest.attributes["productName"] = productName;
|
||||
if (resolution != null) taskmapRequest.attributes["resolution"] = resolution;
|
||||
if (unitScale != null) taskmapRequest.attributes["unitScale"] = unitScale;
|
||||
if (maximumClasses != null) taskmapRequest.attributes["maximumClasses"] = maximumClasses; // Can be used for shapefile too
|
||||
|
||||
string itemTaskCode = await _farmmapsApiService.QueueTaskAsync(cropfieldItem.Code, taskmapRequest);
|
||||
|
||||
await PollTask(TimeSpan.FromSeconds(5), async (tokenSource) => {
|
||||
|
Reference in New Issue
Block a user