import os from datetime import datetime import ee import json import geemap import numpy as np import geemap.foliumap as gee_folium import leafmap.foliumap as leaf_folium import streamlit as st import pandas as pd import geopandas as gpd from shapely.ops import transform from functools import reduce import plotly.express as px import branca.colormap as cm import folium import pyproj from io import StringIO, BytesIO import requests import kml2geojson def force_stop(): show_credits() st.stop() def one_time_setup(): credentials_path = os.path.expanduser("~/.config/earthengine/credentials") if os.path.exists(credentials_path): pass # Earth Engine credentials already exist elif "EE" in os.environ: # write the credentials to the file ee_credentials = os.environ.get("EE") os.makedirs(os.path.dirname(credentials_path), exist_ok=True) with open(credentials_path, "w") as f: f.write(ee_credentials) else: raise ValueError( f"Earth Engine credentials not found at {credentials_path} or in the environment variable 'EE'" ) ee.Initialize() def show_credits(): # Add credits st.write( """
Developed by Sustainability Lab, IIT Gandhinagar
Supported by Gujarat Forest Department