forked from FarmMaps/FarmMapsApiClient
added field polygon to data upload
This commit is contained in:
@@ -37,9 +37,9 @@ namespace FarmmapsApi.Services
|
||||
return await _farmmapsApiService.CreateItemAsync(cropfieldItemRequest);
|
||||
}
|
||||
|
||||
public async Task<Item> UploadDataAsync(UserRoot root, string itemType, string filePath, string itemName) {
|
||||
public async Task<Item> UploadDataAsync(UserRoot root, string itemType, string filePath, string itemName, string fieldGeomJson = null) {
|
||||
var startUpload = DateTime.UtcNow.AddSeconds(-3);
|
||||
var result = await _farmmapsApiService.UploadFile(filePath, root.Code,
|
||||
var result = await _farmmapsApiService.UploadFile(filePath, root.Code, fieldGeomJson,
|
||||
progress => _logger.LogInformation($"Status: {progress.Status} - BytesSent: {progress.BytesSent}"));
|
||||
|
||||
if (result.Progress.Status == UploadStatus.Failed)
|
||||
@@ -50,9 +50,9 @@ namespace FarmmapsApi.Services
|
||||
i.Name.ToLower().Contains(itemName.ToLower()));
|
||||
}
|
||||
|
||||
public async Task<Item> UploadZipWithShapeAsync(UserRoot root, string filePath, string itemName) {
|
||||
public async Task<Item> UploadZipWithShapeAsync(UserRoot root, string filePath, string itemName, string fieldGeomJson = null) {
|
||||
var startUpload = DateTime.UtcNow;
|
||||
var result = await _farmmapsApiService.UploadFile(filePath, root.Code,
|
||||
var result = await _farmmapsApiService.UploadFile(filePath, root.Code, fieldGeomJson,
|
||||
progress => _logger.LogInformation($"Status: {progress.Status} - BytesSent: {progress.BytesSent}"));
|
||||
|
||||
if (result.Progress.Status == UploadStatus.Failed)
|
||||
@@ -108,7 +108,7 @@ 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 cellWidth, string cellHeight, string startPoint, string centered = "false", string endPoint = null, string angle = null, string precision = null)
|
||||
{
|
||||
var taskmapRequest = new TaskRequest { TaskType = TASKMAP_TASK };
|
||||
taskmapRequest.attributes["inputCode"] = tiffItem.Code;
|
||||
@@ -119,6 +119,7 @@ namespace FarmmapsApi.Services
|
||||
taskmapRequest.attributes["centered"] = centered;
|
||||
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;
|
||||
|
||||
string itemTaskCode = await _farmmapsApiService.QueueTaskAsync(cropfieldItem.Code, taskmapRequest);
|
||||
|
||||
|
Reference in New Issue
Block a user