Skip to content

Instantly share code, notes, and snippets.

View krishnaglodha's full-sized avatar
🖥️
Making sense outta location

Krishna Lodha krishnaglodha

🖥️
Making sense outta location
View GitHub Profile
@krishnaglodha
krishnaglodha / find.py
Created April 4, 2024 04:51
Find all features in each files based on lat , long
### This file will require you to give path of folder in which all GeoJSONs are present
## Author : Krishnaglodha@gmail.com
## !pip install geopandas
###
import os
import geopandas as gpd
from shapely.geometry import Point
import json
@krishnaglodha
krishnaglodha / push-data-to-existing-pg-table.sh
Created February 13, 2024 05:42
Send GeoJSON to existing postgis table
#!/bin/bash
# Set the variables
PGHOST=""
PGDATABASE=""
PGUSER=""
PGPASSWORD=""
PGPORT=""
TABLE_NAME=""
GEOJSON_FILE=""
@krishnaglodha
krishnaglodha / requirements.txt
Last active January 29, 2024 05:27
Getting Satellite date based on stac
GDAL==3.4.3
odc-stac==0.3.8
pystac-client==0.7.5
rasterio==1.3.9
numpy==1.26.3
@krishnaglodha
krishnaglodha / download.py
Last active April 3, 2024 17:34
New Sentinel Data downloader using python
from datetime import date, timedelta
import requests
import pandas as pd
import geopandas as gpd
from shapely.geometry import shape
copernicus_user = os.getenv("copernicus_user") # copernicus User
copernicus_password = os.getenv("copernicus_password") # copernicus Password
ft = "POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))" # WKT Representation of BBOX
data_collection = "SENTINEL-2" # Sentinel satellite
@krishnaglodha
krishnaglodha / gdal.sh
Created November 18, 2023 09:14
Install GDAL
sudo add-apt-repository ppa:ubuntugis/ppa && sudo apt-get update
sudo apt-get update
sudo apt-get install gdal-bin
sudo apt-get install libgdal-dev
export CPLUS_INCLUDE_PATH=/usr/include/gdal
export C_INCLUDE_PATH=/usr/include/gdal
pip install GDAL
@krishnaglodha
krishnaglodha / pg.sh
Created September 27, 2023 04:36
PostGIS Installation on ubuntu
#!/bin/bash
# Add the PostgreSQL APT repository for the latest version
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
# Import the repository signing key
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
# Update the package list
sudo apt update
@krishnaglodha
krishnaglodha / GS.sh
Last active September 27, 2023 04:09
Install Geoserver and make service with single File
#!/bin/bash
# Update system packages
sudo apt-get update
# Install Java Runtime Environment (JRE)
sudo apt-get install -y openjdk-11-jre
# Install Unzip
sudo apt install -y unzip
@krishnaglodha
krishnaglodha / insertion.py
Created July 10, 2023 04:32
Insertion Sort Algorithm in python
# input value
array = [5,2,4,6,1,3,7]
# start loop from 1st index ( considering the 0th index value is already sorted
for index in range(1,len(array)):
j = index
# loop to compare current value with it's left neighbor value
while array[j-1] > array[j] and j > 0 :
# if left value is bigger, swap both values
array[j-1],array[j] = array[j], array[j-1]
# reduce j by 1 to now deal with lefter value
@krishnaglodha
krishnaglodha / gs-cluster.yml
Created March 30, 2023 07:46
Gist of cluster configuration of geoserver
geobroker:
image: rmohr/activemq:5.15.9
restart: on-failure
healthcheck:
test: curl --fail -s http://localhost:8161 || exit 1
interval: 20s
timeout: 10s
retries: 10
networks:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>GeoServer</display-name>
<context-param>
<param-name>serviceStrategy</param-name>
<!-- Meaning of the different values :
PARTIAL-BUFFER2