Skip to content

Instantly share code, notes, and snippets.

View rsmahabir's full-sized avatar

Islander rsmahabir

View GitHub Profile
@rsmahabir
rsmahabir / geopandas_convert_geometry_3D_2D.py
Created June 4, 2020 08:01 — forked from rmania/geopandas_convert_geometry_3D_2D.py
flatten geometry series (3D to 2D) in geopandas dataframe
# Often when reading in a ShapeFile from Basemap, you'll get: "ValueError: readshapefile can only handle 2D shape types"
# A trick can be to convert your geometry in your GeoPandas Dataframe and restoring the new flattened 2D geometry
# series back into a shapefile and try again.
# edit from http://stackoverflow.com/questions/33417764/basemap-readshapefile-valueerror
from shapely.geometry import Polygon, MultiPolygon, shape, Point
import geopandas as gp
def convert_3D_2D(geometry):
'''
@rsmahabir
rsmahabir / scraper.py
Created May 22, 2018 07:06 — forked from vchahun/scraper.py
Scrape links from Google News
We couldn’t find that file to show.
@rsmahabir
rsmahabir / ndvi.py
Created January 25, 2018 15:19 — forked from celoyd/ndvi.py
#!/usr/bin/env python
# ndvi.py red.tif nir.tif output-ndvi.tif
# Calculate NDVI (see Wikipedia). Assumes atmospheric correction.
# (Although I use it without all the time for quick experiments.)
import numpy as np
from sys import argv
from osgeo import gdal, gdalconst