forked from FarmMaps/FarmMapsApiClient
WIP NBS uploads json
This commit is contained in:
@@ -15,6 +15,7 @@ namespace FarmmapsNbs
|
||||
public class NbsApplication : IApplication
|
||||
{
|
||||
private const string DownloadFolder = "Downloads";
|
||||
private const string GEOJSON_ITEMTYPE = "vnd.farmmaps.itemtype.geojson";
|
||||
|
||||
private readonly ILogger<NbsApplication> _logger;
|
||||
private readonly FarmmapsApiService _farmmapsApiService;
|
||||
@@ -77,12 +78,15 @@ namespace FarmmapsNbs
|
||||
var cropfieldItem = await _generalService.CreateCropfieldItemAsync(myDriveRoot.Code,
|
||||
$"VRA NBS cropfield {input.OutputFileName}", plantingDate.Year, input.GeometryJson.ToString(Formatting.None));
|
||||
|
||||
var dataPath = Path.Combine("Data", input.ZippedShapeFile);
|
||||
var shapeItem =
|
||||
await _generalService.UploadZipWithShapeAsync(uploadedRoot, dataPath, Path.GetFileNameWithoutExtension(input.ZippedShapeFile));
|
||||
var isGeoJson = input.File.Contains("json");
|
||||
var dataPath = Path.Combine("Data", input.File);
|
||||
var shapeItem = isGeoJson ?
|
||||
await _generalService.UploadDataAsync(uploadedRoot, GEOJSON_ITEMTYPE, dataPath, Path.GetFileNameWithoutExtension(input.File)):
|
||||
await _generalService.UploadZipWithShapeAsync(uploadedRoot, dataPath, Path.GetFileNameWithoutExtension(input.File));
|
||||
|
||||
if (shapeItem == null)
|
||||
{
|
||||
_logger.LogError("Could not find shape item");
|
||||
_logger.LogError("Could not find item for uploaded data");
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user