solved merging in poten app

This commit is contained in:
Riepma
2021-04-07 11:10:47 +02:00
committed by Mark van der Wal
14 changed files with 27 additions and 840 deletions

View File

@@ -283,7 +283,7 @@ namespace FarmmapsApi.Services
/// <param name="progressCallback"></param>
/// <returns></returns>
/// <exception cref="FileNotFoundException"></exception>
public async Task<UploadResults> UploadFile(string filePath, string parentItemCode,
public async Task<UploadResults> UploadFile(string filePath, string parentItemCode, string geoJsonString,
Action<IUploadProgress> progressCallback = null)
{
if (!File.Exists(filePath))
@@ -300,7 +300,8 @@ namespace FarmmapsApi.Services
{
Name = Path.GetFileName(filePath),
ParentCode = parentItemCode,
Size = uploadStream.Length
Size = uploadStream.Length,
Geometry = JObject.Parse(geoJsonString)
};
using var httpClient = CreateConfigurableHttpClient(_httpClient);

View File

@@ -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,11 +108,13 @@ 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 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;
@@ -124,6 +126,7 @@ 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 (cropTypeName != null) taskmapRequest.attributes["cropTypeName"] = cropTypeName;