- linux/shell commands used
- to process data downloaded from https://www.hydrosheds.org/
- clipping it to a rectangle around India to reduce to India data
- converting to .geojsonl
- creating .mbtiles using tippecanoe
- publishing on an TileServerGL instance
""" | |
Program by Nikhil VJ, https://nikhilvj.co.in | |
Based on solution worked out at https://gis.stackexchange.com/questions/475398/extract-features-in-lat-long-co-ordinates-from-vector-tile-layer-pbf-file-pytho | |
License: Creative Commons Zero v1.0 Universal, ref: https://choosealicense.com/licenses/cc0-1.0/ | |
What this does: | |
- Given any vector tile layer in .pbf format, and a poylgon or similar shape, | |
- Extracts all the data from the vector tile layer falling over that shape, | |
- And save it to local disk as a .gpkg shapefile which you can further use | |
- If the vector tile layer had multiple layers, then .gpkg will have all those layers |
# Grouping lat-long locations geo-spatially into N clusters | |
from sklearn.cluster import KMeans | |
import pandas as pd | |
def clusterPoints(df1, N=10, cluster_column='cluster', lat_column='lat', lon_column='lon'): | |
kmeans = KMeans(n_clusters=N, random_state=None, n_init='auto') | |
df1[cluster_column] = kmeans.fit_predict(df1[[lat_column, lon_column]].values) + 1 | |
# +1 so that 0,1,2,3..N-1 becomes 1,2,3..N | |
return |
MINLAT = 21.0762 | |
MAXLAT = 21.2057 | |
MINLON = 78.9929 | |
MAXLON = 79.1738 | |
DATA_FILE = '3bd_buildings.csv' | |
OUTPUT_CSV = 'nagpur.csv' | |
import json, os |
# by Nikhil VJ, https://nikhilvj.co.in , https://github.com/answerquest | |
# generic SMTP emailing function in Python, using SSL | |
# will take values from these env params: | |
# EMAIL_SERVER : SMTP server url | |
# EMAIL_PORT : SMTP port num (must be the SSL port) | |
# EMAIL_SENDER : Email account whose SMTP login you're using | |
# EMAIL_PW : SMTP password of the email account (likely same as regular password used to login to that account) | |
# tested and works well with BigRock.in hosting account's email accounts. | |
# ..and with Google workspace account IF you enable "allow less secure apps". |
// India_Outline_Map.js | |
// Official India international boundary shapefile downloaded from https://surveyofindia.gov.in/pages/outline-maps-of-india | |
// and converted to EPSG4326 (lat-longs), 5-decimal resolution, geojson format by https://gist.github.com/answerquest | |
// All copyright / ownership belongs to source Govt of India website | |
// NOTE: I wanted to put this in a .geojson file, but when Github shows its preview... guess what the background map is displaying! :P | |
// Hence, if you want to get this as a .geojson shapefile, | |
// please copy-paste the part from first { to last } to a text file | |
// and name it as India.geojson |
SOI Village Boundaries import to PostGreSQL DB and gather in .geojsonl |
SOI Toponyms data import to postgresql DB, csv making |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset=utf-8 /> | |
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui' /> | |
<title>Leaflet location picker</title> | |
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" | |
integrity="sha512-Rksm5RenBEKSKFjgI3a41vrjkw4EVPlJ3+OiI65vTjIdo9brlAacEuKOiQ5OFh7cOI1bkDwLqdLw3Zg0cRJAAQ==" | |
crossorigin=""/> |