This repo includes a Python 3 script and Jupyter Notebook that read in sample data from a shapefile and CSV to demonstrate basic geospatial operations with Geopandas. With Geopandas, you can script and automate many operations that are commonly found in GIS software.
Click the green Code button and choose Download ZIP to download the examples, or clone the repo if you're familiar with GitHub. If you just want to preview the content, click on the ipynb notebook file to view it.
-
Install Python 3 (either directly from python.org or via a distribution like Anaconda)
-
If they are not already prepacked with your distribution, use pip install or your distribution's package handler to install the following modules: Pandas, Geopandas, and Shapely
-
Plotting coordinates and transforming projections requires familiarity with EPSG codes, which are unique identifiers for coordinate reference systems.
-
Read a shapefile into a geodataframe
-
Read a CSV with coordinate data into a geodataframe and convert the coordinates into point geometry
-
Obtain the coordinate reference system (CRS) from each file, and transform the map projection
-
Generate lines from point geometry based on point sequence and shared categories
-
Perform a spatial join between points and polygons, assigning each point the attributes of the polygon that it intersects
-
Create a basic plot with several layers
-
Export geodataframes out as shapefiles