Skip to content

Instantly share code, notes, and snippets.

View debboutr's full-sized avatar
💭
...working on it...

Rick Debbout debboutr

💭
...working on it...
View GitHub Profile
@linwoodc3
linwoodc3 / shapefilereader.py
Last active September 23, 2017 00:12
Using Python 2 (doesn't work for 3), this function reads zipped shapefiles from the web or disk and convert it into a Python geodataframe (pandas dataframe with spatial features).
import geopandas as gpd
import numpy as np
import requests
import gdal
import fiona
import uuid
import re
# informaed by: https://gis.stackexchange.com/questions/225586/reading-raw-data-into-geopandas/225627
@grovduck
grovduck / get_rasterio_window_chunks.py
Last active November 15, 2017 21:32
[Rasterio chunks based on RAM] Script to return window address based on user-defined allowable RAM usage. This allows the user to do fewer reads on rasterio data. #rasterio #numpy
"""
This script returns window addresses based on user-defined maximum RAM
usage. It is similar to rasterio.block_windows but allows the user to
potentially do fewer reads on rasterio data.
"""
import rasterio
import numpy as np
@grovduck
grovduck / gdal_rat_to_pandas_df.py
Last active February 16, 2022 09:24
[RAT to pandas DF] Script for converting a GDAL RasterAttributeTable to a pandas DataFrame #pandas #gdal #rat
import sys
import pandas as pd
from osgeo import gdal
def rat_to_df(in_rat):
"""
Given a GDAL raster attribute table, convert to a pandas DataFrame
Parameters
<!DOCTYPE html>
<html>
<head>
<title>Leaflet Layers Control Example</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="//cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />
<script src="//cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
<style>
<!DOCTYPE html>
<html>
<head>
<title>Leaflet Layers Control Example</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="//cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />
<script src="//cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
<style>
@robinkraft
robinkraft / osgeo_compile.sh
Created June 24, 2014 01:41
compile and install GEOS, PROJ4 and GDAL from source on Ubuntu 12.0.4
# Compile/install GEOS. Taken from:
# http://grasswiki.osgeo.org/wiki/Compile_and_Install_Ubuntu#GEOS_2
cd /tmp
wget http://download.osgeo.org/geos/geos-3.4.2.tar.bz2
bunzip2 geos-3.4.2.tar.bz2
tar xvf geos-3.4.2.tar
cd geos-3.4.2