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]