forked from FarmMaps/FarmMapsApiClient
		
	added 2 more inputs
This commit is contained in:
		
							
								
								
									
										
											BIN
										
									
								
								FarmmapsZonering/Data/data_lowres_9001.tiff
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								FarmmapsZonering/Data/data_lowres_9001.tiff
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								FarmmapsZonering/Data/data_times_two_4326.tiff
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								FarmmapsZonering/Data/data_times_two_4326.tiff
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							@@ -73,27 +73,36 @@ namespace FarmmapsZonering
 | 
				
			|||||||
                _logger.LogInformation("Cropfield already exists trying to get");
 | 
					                _logger.LogInformation("Cropfield already exists trying to get");
 | 
				
			||||||
                cropfieldItem = await _farmmapsApiService.GetItemAsync(_settings.CropfieldItemCode);
 | 
					                cropfieldItem = await _farmmapsApiService.GetItemAsync(_settings.CropfieldItemCode);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					            
 | 
				
			||||||
            var inputFileName = "neo_ndvi-reglone-low-weed.tif";
 | 
					            var inputOneItem = await _generalService.UploadDataAsync(uploadedRoot, GEOTIFF_PROCESSED_ITEMTYPE,  
 | 
				
			||||||
            var dataPath = Path.Combine("Data", inputFileName);
 | 
					                Path.Combine("Data", "data_9001.tif"),"data_9001");
 | 
				
			||||||
            var geotiffItem = await _generalService.UploadDataAsync(uploadedRoot, GEOTIFF_PROCESSED_ITEMTYPE, dataPath,
 | 
					            if (inputOneItem == null) {
 | 
				
			||||||
                Path.GetFileNameWithoutExtension(inputFileName));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            if (geotiffItem == null) {
 | 
					 | 
				
			||||||
                _logger.LogError("Could not find item for uploaded data");
 | 
					                _logger.LogError("Could not find item for uploaded data");
 | 
				
			||||||
                return;
 | 
					                return;
 | 
				
			||||||
            } 
 | 
					            }
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
            var outputItem = await _zoneringService.CreateApplicationMapAsync(cropfieldItem, "[0] * 2", new Output()
 | 
					            var inputTwoItem = await _generalService.UploadDataAsync(uploadedRoot, GEOTIFF_PROCESSED_ITEMTYPE, 
 | 
				
			||||||
            {
 | 
					                Path.Combine("Data", "data_times_two_4326.tiff"), "data_times_two_4326");
 | 
				
			||||||
                Name = "times_2_zonering",
 | 
					            if (inputTwoItem == null) {
 | 
				
			||||||
                Unit = "n/kg",
 | 
					                _logger.LogError("Could not find item for uploaded data");
 | 
				
			||||||
                Quantity = "Nitrogen"
 | 
					                return;
 | 
				
			||||||
            }, new InputParameter()
 | 
					            }
 | 
				
			||||||
            {
 | 
					
 | 
				
			||||||
                ItemCode = geotiffItem.Code,
 | 
					            var outputItem = await _zoneringService.CreateApplicationMapAsync(cropfieldItem, "[0] + [1]", new Output()
 | 
				
			||||||
                LayerName = geotiffItem.Data["layers"][0]["name"].ToString()
 | 
					                {
 | 
				
			||||||
            });
 | 
					                    Name = "add",
 | 
				
			||||||
 | 
					                    Unit = "n/kg",
 | 
				
			||||||
 | 
					                    Quantity = "Nitrogen"
 | 
				
			||||||
 | 
					                }, new InputParameter()
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    ItemCode = inputOneItem.Code,
 | 
				
			||||||
 | 
					                    LayerName = inputOneItem.Data["layers"][0]["name"].ToString()
 | 
				
			||||||
 | 
					                },
 | 
				
			||||||
 | 
					                new InputParameter()
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    ItemCode = inputTwoItem.Code,
 | 
				
			||||||
 | 
					                    LayerName = inputTwoItem.Data["layers"][0]["name"].ToString()
 | 
				
			||||||
 | 
					                });
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
            _logger.LogInformation("Downloading output");
 | 
					            _logger.LogInformation("Downloading output");
 | 
				
			||||||
            await _farmmapsApiService.DownloadItemAsync(outputItem.Code,
 | 
					            await _farmmapsApiService.DownloadItemAsync(outputItem.Code,
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user