forked from FarmMaps/FarmMapsApiClient
Compare commits
No commits in common. "d5f715ef925f2d24998e2b920be2f6643762c4fe" and "93469b605c97350368271a22f39b32295b641294" have entirely different histories.
d5f715ef92
...
93469b605c
@ -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, string geoJsonString,
|
||||
public async Task<UploadResults> UploadFile(string filePath, string parentItemCode,
|
||||
Action<IUploadProgress> progressCallback = null)
|
||||
{
|
||||
if (!File.Exists(filePath))
|
||||
@ -300,8 +300,7 @@ namespace FarmmapsApi.Services
|
||||
{
|
||||
Name = Path.GetFileName(filePath),
|
||||
ParentCode = parentItemCode,
|
||||
Size = uploadStream.Length,
|
||||
Geometry = JObject.Parse(geoJsonString)
|
||||
Size = uploadStream.Length
|
||||
};
|
||||
|
||||
using var httpClient = CreateConfigurableHttpClient(_httpClient);
|
||||
|
@ -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, string fieldGeomJson = null) {
|
||||
public async Task<Item> UploadDataAsync(UserRoot root, string itemType, string filePath, string itemName) {
|
||||
var startUpload = DateTime.UtcNow.AddSeconds(-3);
|
||||
var result = await _farmmapsApiService.UploadFile(filePath, root.Code, fieldGeomJson,
|
||||
var result = await _farmmapsApiService.UploadFile(filePath, root.Code,
|
||||
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, string fieldGeomJson = null) {
|
||||
public async Task<Item> UploadZipWithShapeAsync(UserRoot root, string filePath, string itemName) {
|
||||
var startUpload = DateTime.UtcNow;
|
||||
var result = await _farmmapsApiService.UploadFile(filePath, root.Code, fieldGeomJson,
|
||||
var result = await _farmmapsApiService.UploadFile(filePath, root.Code,
|
||||
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, string precision = 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)
|
||||
{
|
||||
var taskmapRequest = new TaskRequest { TaskType = TASKMAP_TASK };
|
||||
taskmapRequest.attributes["inputCode"] = tiffItem.Code;
|
||||
@ -119,7 +119,6 @@ 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);
|
||||
|
||||
|
@ -176,7 +176,7 @@ namespace FarmmapsVRApoten
|
||||
//GEOTIFF TO Taskmap
|
||||
_logger.LogInformation($"Converting geotiff to taskmap");
|
||||
var taskmap = await _generalService.CreateTaskmap(cropfieldItem, applianceMapItem, input.CellWidth, input.CellHeight, input.StartPoint.ToString(Formatting.None),
|
||||
input.Centered, input.EndPoint.ToString(Formatting.None), input.Angle, input.Precision);
|
||||
input.Centered, input.EndPoint.ToString(Formatting.None), input.Angle);
|
||||
if (taskmap == null)
|
||||
{
|
||||
_logger.LogError("Something went wrong with geotiff to taskmap transformation");
|
||||
|
Loading…
Reference in New Issue
Block a user