GeoPandas data structures

  • GeoSeries
  • GeoDataFrame

GepPandas geometric objects

  • Points/Multi-points
  • Lines/Multi-lines
  • Polygons/Multi-polygons

Reading & Writing Files


In [1]:
!dir


 Volume in drive C is Windows
 Volume Serial Number is 80C8-563F

 Directory of C:\Workspace\Gits\environ859\07_DataWrangling\Geopandas

11/17/2017  08:50 AM    <DIR>          .
11/17/2017  08:50 AM    <DIR>          ..
11/17/2017  08:45 AM    <DIR>          .ipynb_checkpoints
11/15/2017  11:29 AM             3,116 0-Intro-to-Geopandas.ipynb
10/03/2017  11:54 AM            26,566 1-CreateUsageTable.ipynb
10/26/2017  01:03 PM            15,250 2-CreateSupplyTable.ipynb
10/26/2017  12:26 PM            29,284 3-SummarizeTidyTables.ipynb
10/03/2017  11:54 AM             4,471 4-LouisianaOnline.ipynb
10/03/2017  11:54 AM             6,554 CreateStatePSUT.ipynb
10/26/2017  12:46 PM             4,262 CreateStateSupplyTable.ipynb
11/14/2017  09:21 AM             8,060 GeopandasDemo.ipynb
11/14/2017  09:21 AM         2,671,462 leaflet.pdf
11/14/2017  09:21 AM         1,745,049 sf_crime_mapping_final.ipynb
              10 File(s)      4,514,074 bytes
               3 Dir(s)  329,281,138,688 bytes free

In [ ]:
#import the package
import geopandas as gpd

In [ ]:
#enable plots to appear in the notebook
%matplotlib inline

In [ ]:
#read in the HUC12.shp feature class
gdf = gpd.read_file('../Data/HUC12.shp')

In [ ]:
#How many features in the dataset?
len(gdf)

In [ ]:
#show the data types in this dataset
gdf.dtypes

In [ ]:
#examine the attributes for the first feature
gdf.iloc[0]

In [ ]:
#show the first 5 values in the geometry field
gdf['geometry'][0:5]

In [ ]:
#show just the first value
gdf['geometry'][0]

In [ ]:
#Plotting
gdf.plot(column='HUC_8',
         cmap='Paired',
         categorical=True,
         figsize=(14,18)
        );

In [ ]:
#Dissolving
cols = []
huc8 =