How to Create GIS Reports and Maps Using ReportLab in Python
Geographic Information Systems (GIS) are extensively used to gather, analyze, display, and process spatial data. GIS experts often have to generate well-structured reports showing their analysis outcomes, which include, but are not limited to, maps, tables, charts, coordinates, and other relevant geographic information. The manual preparation of such reports may take a lot of time, especially when you are working with big data or with some projects that you will perform multiple times.
ReportLab is an advanced Python library that enables developers to create beautiful PDF files automatically. If you use GIS tools together with other libraries such as GeoPandas, Matplotlib, Rasterio, and Shapely, you can utilize ReportLab to create reports with geographic information.

What Is ReportLab in Python?
ReportLab is an open-source Python package that can be used for generating PDF reports from Python code. It contains the tools and options to create formatted text, tables, images, graphs, and custom document layouts as well.
Using ReportLab in GIS analysis is a great way to export data as a downloadable PDF report. Developers do not need to spend hours manually adding data and charts; instead, they can script the process and generate reports automatically through ReportLab.
The notable features associated with ReportLab are mentioned below:
Generation of PDFs: Create complex documents easily using Python.
Generation of tables: GIS attribute data, coordinates, or statistical summaries of any data analysis can be easily presented in tables.
Adding images: Reports can have GIS maps, satellite images, aerial photography, or any images, as per your need.
Formatting: Custom formatting, such as control over page size, margins, font, colour, document layout, among others, is possible with ReportLab.
Automate Reporting: Generate reports using some templates and then replace them with new spatial data, thus automating the generation of multiple GIS reports.
Install the Required Libraries
You can install the necessary libraries using pip:
pip install reportlab geopandas matplotlib shapely rasterio pandasAfter installation, import the required modules into your Python environment:
import geopandas as gpd
import matplotlib.pyplot as plt
import pandas as pd
from reportlab.lib.pagesizes import A4
from reportlab.platypus import (
SimpleDocTemplate,
Paragraph,
Spacer,
Image,
Table,
TableStyle
)
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.lib import colors
from reportlab.lib.units import inch
These modules provide the basic functionality required to process GIS datasets, create maps, and generate PDF reports.
Step 1: Load GIS Data Using GeoPandas
The first step is to load a geographic dataset that will be included in the PDF report.
GeoPandas supports common vector formats such as Shapefile, GeoJSON, and GeoPackage. It allows you to read geographic data and perform spatial operations using a familiar Pandas-style interface.
For this example, assume you have a Shapefile containing administrative boundaries.
import geopandas as gpd
# Load GIS data
gdf = gpd.read_file("districts.shp")
# Display the first five records
print(gdf.head())
# Check the coordinate reference system
print(gdf.crs)
# Display dataset information
print(gdf.info())
Explanation:
gpd.read_file() loads the geographic dataset.
gdf.head() displays the first five records.
gdf.crs identifies the coordinate reference system.
gdf.info() provides information about columns, data types, and records.
You can also load GeoJSON data using the same function:
gdf = gpd.read_file("districts.geojson")Once the data is loaded, you can use it to generate maps, calculate geographic measurements, and prepare attribute tables for your PDF report.
Step 2: Create a GIS Map Using Matplotlib
ReportLab can insert maps into PDF documents, but it does not provide dedicated GIS mapping functionality. Therefore, you can use Matplotlib to visualize spatial datasets and export the resulting maps as image files.
The following example creates a basic administrative boundary map.
import geopandas as gpd
import matplotlib.pyplot as plt
# Load spatial data
gdf = gpd.read_file("districts.shp")
# Create a map
fig, ax = plt.subplots(figsize=(10, 7))
gdf.plot(
ax=ax,
color="lightblue",
edgecolor="black",
linewidth=0.8
)
# Add map title
ax.set_title("Administrative District Map")
# Remove axis labels
ax.set_axis_off()
# Save the map as an image
plt.savefig(
"gis_map.png",
dpi=300,
bbox_inches="tight"
)
plt.close()
Explanation:
figsize controls the dimensions of the map.
gdf.plot() displays geographic features.
edgecolor defines boundary colors.
dpi=300 produces a high-resolution image.
bbox_inches="tight" reduces unnecessary whitespace.
plt.savefig() exports the map as a PNG image.
You can also create thematic maps by visualizing attribute values such as population density, land-use categories, elevation, or vegetation coverage.
For example:
gdf.plot(
column="population",
cmap="YlOrRd",
legend=True,
figsize=(10, 7)
)
plt.title("Population Distribution by District")
plt.axis("off")
plt.savefig("population_map.png", dpi=300, bbox_inches="tight")
plt.close()
This approach allows GIS professionals to generate maps based on different attributes in their spatial datasets.
Step 3: Create Attribute Tables for GIS Reports
GIS reports often include attribute tables containing information about geographic features.
For example, a land-use mapping report might contain:
District names
Land-use classifications
Geographic area
Population information
Geographic identifiers
You can use Pandas to extract the required columns and prepare the data for ReportLab.
import geopandas as gpd
# Load the dataset
gdf = gpd.read_file("districts.shp")
# Select required attributes
table_data = gdf[
["district_name", "land_use", "population"]
]
# Display the table
print(table_data.head())
To calculate area measurements, first project the dataset into an appropriate projected coordinate reference system. Area calculated directly from geographic coordinates is generally not suitable for accurate measurement.
# Reproject to a suitable projected CRS
projected_gdf = gdf.to_crs("EPSG:32643")
# Calculate area in square kilometers
projected_gdf["area_sq_km"] = (
projected_gdf.geometry.area / 1000000
)
print(projected_gdf[["district_name", "area_sq_km"]])
Important: EPSG:32643 is suitable for locations within UTM Zone 43N. Choose a projected CRS appropriate for your study area rather than using this EPSG code for every GIS project.
Step 4: Generate a PDF Report Using ReportLab
After creating the GIS map and preparing the attribute data, you can combine everything into a PDF document.
ReportLab provides SimpleDocTemplate, which helps organize PDF content using a flowable document structure.
The following example creates a basic GIS report containing a heading, introductory text, and a map.
from reportlab.lib.pagesizes import A4
from reportlab.platypus import (
SimpleDocTemplate,
Paragraph,
Spacer,
Image
)
from reportlab.lib.styles import getSampleStyleSheet
# Create a PDF document
pdf = SimpleDocTemplate(
"GIS_Report.pdf",
pagesize=A4
)
# Load document styles
styles = getSampleStyleSheet()
# Create document content
content = []
# Add report title
content.append(
Paragraph("GIS Spatial Analysis Report", styles["Title"])
)
content.append(Spacer(1, 20))
# Add introduction
content.append(
Paragraph(
"This report presents the results of a geographic "
"analysis of administrative districts.",
styles["BodyText"]
)
)
content.append(Spacer(1, 20))
# Insert GIS map
gis_image = Image(
"gis_map.png",
width=6 * inch,
height=4 * inch
)
content.append(gis_image)
# Generate PDF
pdf.build(content)
print("GIS PDF report generated successfully!")
How it works:
SimpleDocTemplate() creates the PDF document.
getSampleStyleSheet() provides predefined formatting styles.
Paragraph() adds formatted text.
Spacer() creates space between document elements.
Image() inserts the generated GIS map.
pdf.build() combines the elements and generates the final PDF.
The resulting PDF can be shared with clients, project managers, researchers, and other stakeholders.
Step 5: Add GIS Attribute Tables to the PDF
A professional GIS report should include both maps and supporting geographic information. ReportLab's Table component allows you to display attribute data in a structured format.
The following example adds district information to the PDF report.
from reportlab.platypus import Table, TableStyle
from reportlab.lib import colors
# Prepare table data
data = [
["District", "Land Use", "Population"],
["District A", "Agriculture", "25000"],
["District B", "Residential", "32000"],
["District C", "Industrial", "18000"],
]
# Create table
gis_table = Table(data)
# Apply formatting
gis_table.setStyle(
TableStyle([
("BACKGROUND", (0, 0), (-1, 0), colors.lightblue),
("TEXTCOLOR", (0, 0), (-1, 0), colors.black),
("GRID", (0, 0), (-1, -1), 0.5, colors.grey),
("ALIGN", (0, 0), (-1, -1), "CENTER"),
("PADDING", (0, 0), (-1, -1), 8),
])
)
# Add table to PDF content
content.append(Spacer(1, 20))
content.append(
Paragraph("GIS Attribute Information", styles["Heading2"])
)
content.append(gis_table)
# Generate updated report
pdf.build(content)
This example uses sample attribute values. In an actual GIS workflow, you can generate the table directly from a GeoDataFrame instead of manually entering records.
You can also customize table headings, borders, alignment, background colors, and cell spacing to improve readability.
Step 6: Include Satellite Imagery and Raster Maps
ReportLab can also be used to create reports containing raster-based GIS outputs, including satellite imagery, elevation models, and drone imagery.
For raster processing, Rasterio is a useful Python library. It allows you to read raster datasets and access their geographic metadata.
For example, you can open a GeoTIFF file and visualize it using Matplotlib.
import rasterio
import matplotlib.pyplot as plt
# Open raster dataset
with rasterio.open("satellite_image.tif") as src:
# Read the first raster band
raster_data = src.read(1)
# Display raster information
print("CRS:", src.crs)
print("Resolution:", src.res)
print("Bounds:", src.bounds)
# Create raster visualization
plt.figure(figsize=(10, 7))
plt.imshow(raster_data, cmap="gray")
plt.title("Satellite Imagery Visualization")
plt.axis("off")
# Save raster visualization
plt.savefig(
"satellite_map.png",
dpi=300,
bbox_inches="tight"
)
plt.close()
You can insert the resulting satellite_map.png into your ReportLab PDF using the same Image() method discussed earlier.
Practical applications include:
Satellite imagery interpretation reports.
Digital Elevation Model (DEM) visualization.
Digital Surface Model (DSM) analysis.
Drone-based land survey documentation.
Vegetation index and land-cover analysis.
Terrain and elevation mapping.
For multiband satellite imagery, you can also use Rasterio to read individual bands and create RGB composites before inserting them into the PDF.
Step 7: Automate GIS Report Generation
One of the biggest advantages of using ReportLab with Python is the ability to automate repetitive reporting tasks.
For example, a GIS organization may need to generate separate PDF reports for multiple districts, project locations, or survey areas.
Instead of creating each report manually, you can define a Python function that accepts geographic data and generates a PDF automatically.
Here is a basic example:
from reportlab.platypus import (
SimpleDocTemplate,
Paragraph,
Spacer,
Image
)
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.lib.pagesizes import A4
def create_gis_report(
district_name,
map_path,
output_pdf
):
# Create PDF document
pdf = SimpleDocTemplate(
output_pdf,
pagesize=A4
)
styles = getSampleStyleSheet()
content = []
# Add report heading
content.append(
Paragraph(
f"GIS Report: {district_name}",
styles["Title"]
)
)
content.append(Spacer(1, 20))
# Add description
content.append(
Paragraph(
f"Spatial analysis report for {district_name}.",
styles["BodyText"]
)
)
content.append(Spacer(1, 20))
# Insert map
content.append(
Image(
map_path,
width=6 * inch,
height=4 * inch
)
)
# Generate PDF
pdf.build(content)
print(f"Report generated: {output_pdf}")
You can call this function for different locations:
create_gis_report(
"District A",
"district_a_map.png",
"district_a_report.pdf"
)
create_gis_report(
"District B",
"district_b_map.png",
"district_b_report.pdf"
)
This workflow is useful for organizations that regularly prepare spatial analysis reports for multiple geographic locations.
Note: The example uses inch, so include from reportlab.lib.units import inch in your imports. For a complete reporting pipeline, you can also pass district-specific attribute tables, statistics, and map legends into the function.
Step 8: Best Practices for Creating GIS Reports with ReportLab
Creating a GIS PDF report involves more than just putting together maps and text. You also need to think about spatial accuracy, legibility of the document, and the way data is organized in your report.
There are some best practices to consider:
Use the correct coordinate reference system
Check which CRS the dataset is using before performing any spatial calculations. Use the proper projected CRS to allow for accurate distance and area measurements.
Export high-quality images of maps
Use a proper image resolution (for example, 300 DPI) when exporting maps for paper-based PDF reports. When exporting maps for a digital report (e.g., email or upload), find a balance between the image resolution and PDF file size.
Add map key and scale bar
There is a need to add map key and scale bar, and other necessary cartographic elements on thematic maps. It is easy to create these elements in Matplotlib before pasting them into ReportLab.
Tabulate attributes in a structured manner
Only necessary attributes relating to location should be included in attribute tables. Appropriate column names that have consistent units should be applied to attribute tables for clarity and readability.
Consistency in layout of a document
Use a pre-defined ReportLab style sheet that will have all necessary components, including the header, footer, and page numbers.
Validate geographic data
You should verify the integrity of geographic data in relation to missing geometries, invalid features, and attribute-related problems.
Optimize the size of the PDF document
When large satellite imagery or data is captured through drone survey, it would result in a huge PDF document size. You can adjust image sizes accordingly and avoid adding raster files of oversized size.
Step 9: Common Challenges When Using ReportLab for GIS
Although ReportLab is useful for automated PDF generation, there are some limitations to consider.
Challenge | Recommended approach |
Complex GIS map creation | Use GeoPandas and Matplotlib |
Large satellite imagery | Process and resize images using Rasterio |
Interactive maps | Use Folium or ipyleaflet for web-based maps |
Large attribute tables | Use ReportLab table formatting and pagination |
Geographic calculations | Use GeoPandas, Shapely, and suitable CRS transformations |
Multi-page reports | Use ReportLab page templates and flowables |
It is important to understand that ReportLab is primarily a PDF-generation library, not a dedicated GIS analysis or mapping application. It works best when combined with specialized geospatial libraries.
ReportLab is an amazing open-source Python library designed to help generate professional GIS reports automatically and create impressive PDF documents that contain spatial analysis outputs, maps, images, and tables.
By combining this library with GeoPandas, Matplotlib, Rasterio, Pandas, and Shapely, a GIS developer can easily build flexible reporting pipelines for satellite imaging analysis, aerial surveying, mapping land use, environmental monitoring, and planning urban areas.
Being able to automate report generation in PDF format is a huge benefit in organizations that regularly produce GIS reports for their clientele, researchers, and project beneficiaries.
As geospatial workflows continue to provide more data for processing in space, it becomes vital to use reporting frameworks in Python to ensure more efficiency, consistency, and improved data display during report creation.
To learn more about ReportLab and its geospatial capabilities, click here.
For more information or any questions regarding the LizardTech suite of products, please don't hesitate to contact us at:
Email: info@geowgs84.com
USA (HQ): (720) 702–4849
(A GeoWGS84 Corp Company)




Comments