forked from FarmMaps/FarmMapsApiClient
Added option to generate ISOXML taskmap, added missing Nbs data
This commit is contained in:
@@ -8,6 +8,7 @@ namespace FarmmapsApiSamples
|
||||
public const string GEOTIFF_PROCESSED_ITEMTYPE = "vnd.farmmaps.itemtype.geotiff.processed";
|
||||
public const string CROPFIELD_ITEMTYPE = "vnd.farmmaps.itemtype.cropfield";
|
||||
public const string SHAPE_PROCESSED_ITEMTYPE = "vnd.farmmaps.itemtype.shape.processed";
|
||||
public const string ISOXML_PROCESSED_ITEMTYPE = "vnd.farmmaps.itemtype.iso11783.taskdata.processed";
|
||||
public const string SHAPE_ITEMTYPE = "vnd.farmmaps.itemtype.shape";
|
||||
public const string GEOJSON_ITEMTYPE = "vnd.farmmaps.itemtype.geojson";
|
||||
public const string BLIGHT_ITEMTYPE = "vnd.farmmaps.itemtype.blight";
|
||||
|
@@ -110,7 +110,7 @@ namespace FarmmapsApi.Services
|
||||
// Create taskmap based on width, height and direction
|
||||
|
||||
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 startPoint, string ddiCode = "0001", string centered = "false", string endPoint = null, string angle = null, string precision = null,
|
||||
string cropTypeName = null, string costumerName = null, string ProductGroupName = null, string productName = null,
|
||||
string resolution = null, string unitScale = null, string maximumClasses = null)
|
||||
|
||||
@@ -126,9 +126,10 @@ namespace FarmmapsApi.Services
|
||||
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
|
||||
//taskmapRequest.attributes["precision"] = precision;
|
||||
|
||||
|
||||
// Optional attributes
|
||||
if (precision != null) taskmapRequest.attributes["precision"] = precision;
|
||||
if (cropTypeName != null) taskmapRequest.attributes["cropTypeName"] = cropTypeName;
|
||||
if (costumerName != null) taskmapRequest.attributes["costumerName"] = costumerName;
|
||||
if (ProductGroupName != null) taskmapRequest.attributes["ProductGroupName"] = ProductGroupName;
|
||||
@@ -155,11 +156,24 @@ namespace FarmmapsApi.Services
|
||||
|
||||
//the taskmap is a child of the input tiff
|
||||
var itemName = "Taskmap";
|
||||
var taskMapItem = await FindChildItemAsync(tiffItem.ParentCode,
|
||||
Item taskMapItem = null;
|
||||
if (outputType == "isoxml") {taskMapItem = await FindChildItemAsync(tiffItem.ParentCode,
|
||||
ISOXML_PROCESSED_ITEMTYPE, itemName);
|
||||
}
|
||||
else if (outputType== "shape") {
|
||||
taskMapItem = await FindChildItemAsync(tiffItem.ParentCode,
|
||||
SHAPE_PROCESSED_ITEMTYPE, itemName);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogError("OutputType not specified, could not determine if output should be shape or ISOXML");
|
||||
taskMapItem = null;
|
||||
}
|
||||
|
||||
|
||||
if (taskMapItem == null)
|
||||
{
|
||||
_logger.LogError("Could not find the shape taskmap as a child item under the input");
|
||||
_logger.LogError("Could not find the shape/isoxml taskmap as a child item under the input");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user