This lesson is still being designed and assembled (Pre-Alpha version)

Geospatial Python: Glossary

Key Points

Intro to Raster Data in Python
  • The GeoTIFF file format includes metadata about the raster data.

  • To plot raster data with the earthpy package, we need to read in the image as a numpy array.

  • rasterio stores CRS information as a CRS object that can be converted to an EPSG code or PROJ4 string.

  • The GeoTIFF file may or may not store the correct no data value(s). We can find the correct value(s) in the raster’s external metadata or by plotting the raster.

Plot Raster Data in Python
  • Continuous data ranges can be grouped into categories using mutate() and cut().

  • Use earthpy.plot_bands() and the cmap argument to change the colo schemey.

  • Layer rasters on top of one another by using the alpha argument

Reproject Raster Data in Python
  • In order to plot two raster data sets together, they must be in the same CRS.

  • Use the rasterio.warp.reproject() function to convert between CRSs.

Raster Calculations in Python
  • Rasters can be computed on using mathematical functions.

  • Rasters can be read as numpy arrays, a fast data structure for matrix computations

  • The rasterio.io.Dataset.write() method can be used to write raster data to a file.

Work With Multi-Band Rasters in Python
  • A single raster file can contain multiple bands or layers.

  • Use the earthpy.stack() function to load all bands spread across individual files into Python

  • Individual bands within a stack can be accessed, analyzed, and visualized using the same functions as single bands.

Open and Plot Shapefiles in Python
  • Shapefile metadata include geometry type, CRS, and extent.

  • Load spatial objects into Python with the geopandas.read_file() method.

  • Spatial objects can be plotted directly with geopandas.GeoDataFrame.plot().

Explore and Plot by Shapefile Attributes
  • A GeoDataFrame in geopandas is similar to standard pandas data frames and can be manipulated using the same functions.

  • Almost any feature of a plot can be customized using the various functions and options in the matplotlib package.

Plot Multiple Shapefiles with Geopandas
  • Use the matplotlib.pyplot.axis object to add multiple layers to a plot.

  • Multi-layered plots can combine raster and vector datasets.

Intro to Raster Data in Python
  • In order to plot two vector data sets together, they must be in the same CRS.

  • Use the GeoDataFrame.to_crs() method to convert between CRSs.

Convert from .csv to a Shapefile in Python
  • Know the projection (if any) of your point data prior to converting to a spatial object.

Manipulate Raster Data in Python
Intro to Raster Data in Python
  • The GeoTIFF file format includes metadata about the raster data.

  • To plot raster data with the earthpy package, we need to read in the image as a numpy array.

  • rasterio stores CRS information in the PROJ4 dict format.

  • Be careful when dealing with missing or bad data values.

Create Publication-quality Graphics
Derive Values from Raster Time Series

Glossary

FIXME