from tempfile import tempdir import firebase_admin from firebase_admin import credentials from firebase_admin import db from find_s1_image2 import find_img_value import pandas as pd import statsmodels.api as sm import seaborn as sns sns.set() import time import json import numpy as np from sklearn.cluster import KMeans from find_study_area_values import find_study_area_values from make_area_estimate_image import make_area_estimate_image import json from sentinelhub import WebFeatureService, BBox, CRS, DataSource, MimeType, CRS, BBox, WmsRequest,DataCollection cred = credentials.Certificate('servicekey.json') import firebase_admin from firebase_admin import credentials from firebase_admin import firestore try: firebase_admin.initialize_app(cred, {'databaseURL': 'https://farmbase-b2f7e-31c0c.firebaseio.com/'}) except: print('fire running') db = firestore.client() gt_fields_dir = 'Downloads/Barkhedi.geojson' with open(gt_fields_dir) as f: gt_fields = json.load(f) farms_array = gt_fields["features"] for single_farm_obj in farms_array: geometry_obj = single_farm_obj["geometry"] points_obj = geometry_obj["coordinates"] properties_obj = single_farm_obj["properties"] village = properties_obj["villagee"] khasranum = properties_obj["khasranum"] main_obj = {} main_obj["Points"] = points_obj main_obj["Village"] = village main_obj["ID"] = khasranum #print(main_obj) v_id = round(time.time()*1000) v_id = str(v_id) db.collection(u'Villages_CI').document(v_id).set(main_obj) time.sleep(0.1) #break