Plotting Shape files using Google Colab and Earth Engine

I like to use QGIS to examine shapefiles, but sometimes I use a computer that does not have it installed. Below are some notes about plotting shapefiles using web interfaces I can access on most computers: Google Colab and Earth Engine.

Ashwani Dhankhar’s article “Mapping with Matplotlib, Pandas, Geopandas and Basemap in Python” shows how to plot a shapefile on a basemap in Google Colab. Below is code in Google Colab to do this. Following that, is a note about Google Earth Engine.

# !apt-get install libgeos-3.6.2 (I am not sure if this is needed)
!apt-get install libgeos-dev
!pip install
!pip install geopandas
!pip install contextily

Restart the runtime.

import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
import geopandas as gpd
import pandas as pd
import contextily as ctx

The shapefile I want to view (amuqall.shp) is on my Google drive. I wanted to view its geographic extent on a basemap.

# Change crs to one compatible with basemap
amuquall_df = amuquall_df.to_crs(epsg=3857)
ax = amuquall_df.plot(figsize=(20, 20), alpha=0.5, edgecolor='k')