Merge remote-tracking branch 'upstream/master'
This commit is contained in:
		| @@ -283,7 +283,8 @@ 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, | ||||
|             string geoJsonString = null, | ||||
|             Action<IUploadProgress> progressCallback = null) | ||||
|         { | ||||
|             if (!File.Exists(filePath)) | ||||
| @@ -301,7 +302,7 @@ namespace FarmmapsApi.Services | ||||
|                 Name = Path.GetFileName(filePath), | ||||
|                 ParentCode = parentItemCode, | ||||
|                 Size = uploadStream.Length, | ||||
|                 Geometry = JObject.Parse(geoJsonString) | ||||
|                 Geometry = string.IsNullOrEmpty(geoJsonString) ? null : JObject.Parse(geoJsonString) | ||||
|             }; | ||||
|  | ||||
|             using var httpClient = CreateConfigurableHttpClient(_httpClient); | ||||
|   | ||||
| @@ -51,7 +51,8 @@ namespace FarmmapsApi.Services | ||||
|                      i.Name.ToLower().Contains(itemName.ToLower())); | ||||
|         } | ||||
|  | ||||
|         public async Task<Item> UploadZipWithShapeAsync(UserRoot root, string filePath, string itemName, string geoJsonString = null) { | ||||
|         public async Task<Item> UploadZipWithShapeAsync(UserRoot root, string filePath, string itemName, string geoJsonString = null) | ||||
|         { | ||||
|             var startUpload = DateTime.UtcNow.AddSeconds(-3); | ||||
|             var result = await _farmmapsApiService.UploadFile(filePath, root.Code, geoJsonString, | ||||
|                 progress => _logger.LogInformation($"Status: {progress.Status} - BytesSent: {progress.BytesSent}")); | ||||
| @@ -64,7 +65,8 @@ namespace FarmmapsApi.Services | ||||
|                      i.Name.ToLower().Contains(itemName.ToLower())); ; | ||||
|         } | ||||
|  | ||||
|         public async Task<Item> ShapeToGeotiff(Item shapeItem) { | ||||
|         public async Task<Item> ShapeToGeotiff(Item shapeItem) | ||||
|         { | ||||
|             var startUpload = DateTime.UtcNow.AddSeconds(-3); | ||||
|             await RunAndWaitForTask(shapeItem, "vnd.farmmaps.task.shapetogeotiff"); | ||||
|  | ||||
| @@ -74,9 +76,9 @@ namespace FarmmapsApi.Services | ||||
|         } | ||||
|  | ||||
|  | ||||
|         public async Task<Item> GeotiffToShape(Item tiffItem) { | ||||
|             var taskmapRequest = new TaskRequest { TaskType = TASKMAP_TASK }; | ||||
|              | ||||
|         public async Task<Item> GeotiffToShape(Item tiffItem) | ||||
|         { | ||||
|             var taskmapRequest = new TaskRequest {TaskType = TASKMAP_TASK}; | ||||
|             taskmapRequest.attributes["cellWidth"] = "3"; | ||||
|             taskmapRequest.attributes["cellHeight"] = "1"; | ||||
|             taskmapRequest.attributes["angle"] = "0"; | ||||
| @@ -163,6 +165,7 @@ namespace FarmmapsApi.Services | ||||
|             } | ||||
|             else if (outputType== "shape") { | ||||
|             taskMapItem = await FindChildItemAsync(tiffItem.ParentCode, | ||||
|  | ||||
|                 SHAPE_PROCESSED_ITEMTYPE, itemName); | ||||
|             } | ||||
|             else | ||||
|   | ||||
		Reference in New Issue
	
	Block a user