Playing with Python Rasterstats

This is code to get PctAg and PctUrb using NLCD 2006 for US Counties. First we’ll import some libraries. import pandas as pd import numpy as np import geopandas as gp Bring in US Counties using US Census counties shapefile counties = gp.GeoDataFrame.from_file('L:/Priv/CORFiles/Geospatial_Library/Data/RESOURCE/POLITICAL/BOUNDARIES/NATIONAL/Counties_Census_2010.shp') list(counties) counties.STATE_NAME.unique() counties = counties[(counties.STATE_NAME != 'Hawaii') & (counties.STATE_NAME != 'Alaska')] counties = counties[['FIPS','NAME','geometry']] counties.head() .dataframe thead tr:only-child th { text-align: right; } . [Read More]

GeoPandas Tutorial

This is an implementation of the excellent PostGIS / geopandas tutorial here using NHDPlus WBD polygons for PNW. All the ideas and methods are from this tutorial, simply implementing with a different dataset and in Oregon. %matplotlib inline import os import json import psycopg2 import matplotlib.pyplot as plt # The two statemens below are used mainly to set up a plotting # default style that's better than the default from matplotlib import seaborn as sns plt. [Read More]