forked from FarmMaps/FarmMapsApiClient
		
	Added project FarmmapsBulkSatDownload
This commit is contained in:
		
							
								
								
									
										18
									
								
								FarmmapsBulkSatDownload/Models/BulkSatDownloadInput.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								FarmmapsBulkSatDownload/Models/BulkSatDownloadInput.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
			
		||||
using System;
 | 
			
		||||
using Newtonsoft.Json.Linq;
 | 
			
		||||
 | 
			
		||||
namespace FarmmapsBulkSatDownload.Models
 | 
			
		||||
{
 | 
			
		||||
    public class BulkSatDownloadInput
 | 
			
		||||
    {
 | 
			
		||||
        public bool UseCreatedCropfield { get; set; }
 | 
			
		||||
        public string fieldName { get; set; }
 | 
			
		||||
        public string DownloadFolder { get; set; }
 | 
			
		||||
        public string cropName { get; set; }
 | 
			
		||||
        public int cropYear { get; set; }
 | 
			
		||||
        public int fieldID { get; set; }
 | 
			
		||||
        public DateTime lastdownloadedimagedate { get; set; }
 | 
			
		||||
        public JObject GeometryJson { get; set; }
 | 
			
		||||
        //public string fieldName { get { return string.Format($"{cropName}_fld{fieldID}"); } }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										47
									
								
								FarmmapsBulkSatDownload/Models/DB.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								FarmmapsBulkSatDownload/Models/DB.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,47 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using Npgsql;
 | 
			
		||||
 | 
			
		||||
namespace FarmmapsApi.Services
 | 
			
		||||
{
 | 
			
		||||
    public class DB
 | 
			
		||||
    {
 | 
			
		||||
        public string Database;
 | 
			
		||||
        public string User;
 | 
			
		||||
        public string Password;
 | 
			
		||||
        public string Host;
 | 
			
		||||
 | 
			
		||||
        public string GetConnectionString()
 | 
			
		||||
        {
 | 
			
		||||
            NpgsqlConnectionStringBuilder sb = new NpgsqlConnectionStringBuilder();
 | 
			
		||||
            sb.Database = Database;
 | 
			
		||||
            sb.Host = Host;
 | 
			
		||||
            sb.Username = User;
 | 
			
		||||
            sb.Password = Password;
 | 
			
		||||
            sb.Port = 5432;
 | 
			
		||||
 | 
			
		||||
            return sb.ConnectionString;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public int ExecuteNonQuery(string sql)
 | 
			
		||||
        {
 | 
			
		||||
            using (NpgsqlConnection conn = new NpgsqlConnection(GetConnectionString()))
 | 
			
		||||
            {
 | 
			
		||||
                conn.Open();
 | 
			
		||||
                NpgsqlCommand command = conn.CreateCommand();
 | 
			
		||||
                command.CommandText = sql;
 | 
			
		||||
                int r = command.ExecuteNonQuery();
 | 
			
		||||
                return r;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public NpgsqlConnection CreateConnection()
 | 
			
		||||
        {
 | 
			
		||||
            NpgsqlConnection conn = new NpgsqlConnection(GetConnectionString());
 | 
			
		||||
            conn.Open();
 | 
			
		||||
            return conn;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										28
									
								
								FarmmapsBulkSatDownload/Models/GroenmonitorTable.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								FarmmapsBulkSatDownload/Models/GroenmonitorTable.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,28 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Text;
 | 
			
		||||
 | 
			
		||||
namespace FarmmapsBulkSatDownload.Models
 | 
			
		||||
{
 | 
			
		||||
    public class GroenmonitorTable
 | 
			
		||||
    {
 | 
			
		||||
        //public string parceltablename; //PO20190605: parceltablename added as a field (=column) in the GroenmonitorTable. The GroenmonitorTable contains data from multiple parceltables
 | 
			
		||||
        public int parcelid;
 | 
			
		||||
        public string date;
 | 
			
		||||
        public string source;
 | 
			
		||||
        public int wdvi_pixelcount; //count of pixels with data
 | 
			
		||||
        public double wdvi_max;
 | 
			
		||||
        public double wdvi_mean;
 | 
			
		||||
        public double wdvi_min;
 | 
			
		||||
        public double wdvi_stdev;
 | 
			
		||||
        public double wdvi_median;
 | 
			
		||||
        public double wdvi_p90;
 | 
			
		||||
        public int ndvi_pixelcount; //count of pixels with data
 | 
			
		||||
        public double ndvi_max;
 | 
			
		||||
        public double ndvi_mean;
 | 
			
		||||
        public double ndvi_min;
 | 
			
		||||
        public double ndvi_stdev;
 | 
			
		||||
        public double ndvi_median;
 | 
			
		||||
        public double ndvi_p90;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										11
									
								
								FarmmapsBulkSatDownload/Models/Settings.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								FarmmapsBulkSatDownload/Models/Settings.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
namespace FarmmapsBulkSatDownload
 | 
			
		||||
{
 | 
			
		||||
    public class Settings
 | 
			
		||||
    {
 | 
			
		||||
        public string CropfieldItemCode { get; set; }
 | 
			
		||||
        public string SatelliteTaskCode { get; set; }
 | 
			
		||||
        public string VanDerSatTaskCode { get; set; }
 | 
			
		||||
        public string WatBalTaskCode { get; set; }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user