Mapping GIS Data on a Basemap by Contextily in Colab

PropTech@ecyY
5 min readJun 29, 2021

Nowadays many online apps are map-based applications, such as Uber, how to map GIS data on a basemap is an important knowledge in developing apps. Very often, data providers would only provide GIS data with coordinates or polygons’ coordinates, and a basemap is required to be layered (matched) to show a map. Depending on different purposes, various types of basemap are used. For example, Open Street Maps are more commonly used to show spatial relationships by roads and streets, Stamen Terrain Maps are better for showing contours and land use patterns. This article shows how to map GIS data on different basemaps by using Contextily in Colab.

We have already discussed how to map by geopandas in colab before (Yiu, 2021), but it is based on the maps provided by geopandas’ datasets and cannot be changed. Here we show how to download GIS data from a public website and then map them on a basemap.

  1. The first step is always installing software, here we install geopandas and contextily.
# plot GIS data on different basemaps by geopandas and contextily
# see https://colab.research.google.com/github/bwsi-hadr/03-Intro-to-GIS/blob/master/03_Intro_to_GIS.ipynb#scrollTo=aOtbuNGUTB7k
!pip install geopandas
!pip install contextily
import geopandas as gpd
import contextily as ctx # for basemaps

2. Then we collect a shape file (.shp) of the locations of HOS courts in Hong Kong provided by ESRI. The website is called “Open Geo-Spatial Data…

--

--

No responses yet