Skip to content

Instantly share code, notes, and snippets.

View reachsumit's full-sized avatar
😃

Sumit Kumar reachsumit

😃
View GitHub Profile
@reachsumit
reachsumit / centroids.py
Created December 20, 2017 06:08
Calculate district-wise mean centroids
import pandas as pd
from shapely.geometry import MultiPoint
# read the csv file containing borderline longitudes and latitudes for all Indian districts
df = pd.read_csv(r"C:\Users\sam\IndiaMap\Ind_adm2_Points.csv")
district = ""
geoList = []
result_df = pd.DataFrame(data=None,columns=['State','District','Latitude','Longitude'])
@reachsumit
reachsumit / scraper.py
Created December 20, 2017 06:34
Scraping population data for each Indian district
from bs4 import BeautifulSoup as bs
import requests
# Base url for scraping
res=requests.get('http://www.citypopulation.de/India.html')
# delicious soup
soup= bs(res.text,'lxml')
# path to the required links
allLinks = soup.select('ul li a')
# keep only the links with full district data
@reachsumit
reachsumit / weighted_mean.py
Last active June 24, 2018 21:54
calculating weighted means for each state based on district coordinates
import pandas as pd
input_df = pd.read_csv(r"merged.csv")
state = ""
weights = []
x_numerator = []
y_numerator = []
results = pd.DataFrame(data=None,columns=['State','Longitude','Latitude'])
for index,x in input_df.iterrows():
from scipy.io import loadmat
# Load label information
matrix = loadmat("../cars_annos.mat")
# create as many directories as the number of classes in dataset (196)
import os
for idx in range(matrix['class_names'].shape[1]):
os.makedirs("./"+str(idx+1))
@reachsumit
reachsumit / AOI.csv
Last active June 24, 2018 21:54
A comparison of AOIs in Spacenet dataset
We can make this file beautiful and searchable if this error is corrected: It looks like row 6 should actually have 9 columns, instead of 8 in line 5.
Area of Interest, Satellite, Location, Panchromatic Resolution, Area of Raster (Sq Km), Building Labels (Polygons), Road Labels(LineString), Training Data, Test Data
AOI_1, WorldView-2, Rio de Janeiro, 50 cm, 2544, 4082529, N/A, 3-band Mosiac = 2.3 GB | 8-band Mosiac = 6.5 GB | Vectors = 0.18 GB | Point of interest = 31 GB, N/A
AOI_2, WorldView-3, Vegas, 30 cm, 216, 151367, 3685 km, Roads: 25 GB of 400mx400m tiles | Buildings: 23 GB of 200mx200m tiles, Roads: 8.1 GB of 400mx400m tiles | Buildings: 7.9 GB of 200mx200m tiles
AOI_3, WorldView-3, Paris, 30 cm, 1030, 23816, 425 km, Roads: 5.6 GB of 400mx400m tiles | Buildings: 5.3 GB of 200mx200m tiles, Roads: 1.9 GB of 400mx400m tiles | Buildings: 1.8 GB of 200mx200m tiles
AOI_4, WorldView-3, Shanghai, 30 cm, 1000, 92015, 3537 km, Roads: 25 GB of 400mx400m tiles | Buildings: 23.4 GB of 200mx200m tiles, Roads: 8.1 GB of 400mx400m tiles | Buildings: 7.7 GB of 200mx200m tiles
AOI_5, WorldView-3, Khartoum, 30 cm, 765, 710960, 1030 km, Roads: 25 GB of 400mx400m tiles
@reachsumit
reachsumit / AOI_1.geojson
Created February 5, 2018 04:54
Spacenet AOI_1 description
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@reachsumit
reachsumit / AOI_2.geojson
Created February 5, 2018 04:57
SpaceNet AOI_2 boundary
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@reachsumit
reachsumit / AOI_3.geojson
Last active June 24, 2018 21:54
SpaceNet AOI_3 boundary
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@reachsumit
reachsumit / AOI_4.geojson
Created February 5, 2018 21:13
SpaceNet AOI_4 boundary
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@reachsumit
reachsumit / AOI_5.geojson
Created February 5, 2018 21:14
SpaceNet AOI_5 boundary
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.