Resolving Conflicts in Python: gdal, cartopy, and geopandas

This article does not have audio; reading the text will make it easier to understand the content.

Hello everyone!

Recently, I fell into a pit again.

Let me share the solution to get out of it.

Resolving Conflicts in Python: gdal, cartopy, and geopandasRecently, I have been working with digital elevation maps and installed the GDAL Python package, and then I started encountering various issues.GDAL is used for processing raster data and is very powerful.However, I found that my Jupyter Notebook could not run GDAL.This was the first pit I encountered.To facilitate debugging, I had to install Visual Studio Code.To be honest, I still prefer using Jupyter Notebook as it is more convenient for writing code and documentation.Visual Studio Code has better compatibility, but when I have new code to debug, I always have to create a new .py file, which is a bit cumbersome. Debugging ten pieces of code requires creating ten .py files, and file management is not very convenient.After setting up the debugging platform, I encountered issues with running geopandas and cartopy. They work fine when run separately, but not when used together with GDAL.Although the responses from Wenxin Yiyan always suggest that geopandas, cartopy, and GDAL can be used together, I couldn’t find a suitable explanation or solution online.Perhaps not many people use these three together.Unfortunately, I happened to encounter this issue.After countless experiments, I reasonably suspect that there might be conflicts between geopandas and GDAL on my machine, and cartopy might also conflict with GDAL, making them unsuitable for use together.To address this issue, I had to take a roundabout approach. My goal is to create an elevation map using geographic elevation data, overlay a geojson format boundary map on the elevation map, and add marker points.My solution is:Step 1: First, use GDAL to output the geographic elevation raster data as an image format elevation map (it must be a full image; if it has borders, the image can be processed again to remove the borders. This is important for minimizing distortion in the next step of map overlay).Step 2: Create a new .py file, use geopandas to read the geojson format boundary file for plotting, and then use cartopy to mark points on the map.I found online that rasterio might be more suitable for the Python ecosystem than GDAL. So if anyone needs it, you can try rasterio.I haven’t tried rasterio yet, so I can’t comment on it.

Thank you to those who managed to read this article to the end. Resolving Conflicts in Python: gdal, cartopy, and geopandas

This concludes the sharing for this time. Everyone is welcome to criticize, correct, and exchange learning!

Resolving Conflicts in Python: gdal, cartopy, and geopandas

Wishing everyone smooth sailing!

Let’s chat next time!

J.M. Jian Mi Jun

August 22, 2025

Previous articles:

About Python👇

Python: Drawing Mind Maps with Turtle

Drawing Mooncakes and National Flags with Python

Python Insights: Converting Unneeded Data to Null Values with Pandas

Python Pitfall Record: Plotting with Groupby + Time Series

Python Insights: Cartopy for Mapping – Spatial Interpolation Rendering and Whitening

Python Insights: Cartopy for Mapping – Plotting Section

Python Insights: Cartopy for Mapping – Installation Section

Python Pitfall Record: Plotting – Issues with Superscripts and Subscripts

Python Insights: Drawing Maps with Pyecharts

Python Pitfall Record: A Pit Caused by a Colon

Spanish Learning👇

Spanish: Learning Spanish with Pink Pig (Episode 16: Playing Store)

Spanish: Learning Spanish with Pink Pig (Episode 15: Is Going to the Gym Work or Play?)

Spanish: Learning Spanish with Pink Pig (Episode 14: Working Outside vs. Working from Home)

Spanish: Learning Spanish with Pink Pig (Episode 13: Diving Board at the Pool)

Spanish: Learning Spanish with Pink Pig (Episode 12: Saving the Watering Can)

Spanish: Learning Spanish with Pink Pig (Episode 11: Swimming)

Spanish: Learning Spanish with Pink Pig (Episode 10: Rainbow)

Spanish: Learning Spanish with Pink Pig (Episode 9: Eating Ice Cream)

Spanish: Learning Spanish with Pink Pig (Episode 8: Color Game While Traveling)

Spanish: Learning Spanish with Pink Pig (Episode 7: Blowing Bubbles)

Spanish: Learning Spanish with Pink Pig (Episode 6: Whistling)

Spanish: Learning Spanish with Pink Pig (Episode 5: Finding Chocolate Eggs)

Spanish: Learning Spanish with Pink Pig (Episode 4: Spring Chicks)

Spanish: Learning Spanish with Pink Pig (Episode 3: Chinese New Year)

Spanish: Learning Spanish with Pink Pig (Episode 2) – Building a Snowman

Spanish: Learning Spanish with Pink Pig (Episode 1: Winter Clothing)

Simple Spanish Episode 1: Kitchen Items

Simple Spanish Episode 2: Weather – Ventanita de la clase

Simple Spanish Episode 3: Autumn Otoño

Simple Spanish Episode 4: Buenos días

Simple Spanish Episode 5: Navidad Christmas

Simple Spanish Episode 6: Campana Christmas Story

Simple Spanish Episode 7: Invierno Winter

Notes on Family Financial Management👇

Calculating: How many years will it take for 10,000 yuan to double?

DIY Family Financial Basic Protection Configuration

DIY Family Financial Status Analysis

Family Financial Management: My “Five Accounts”

Learning Insights: A Small Study on Home Insurance

Learning Insights: A Small Study on Tenant Home Insurance

Learning Notes: Landlord Home Insurance

About Life👇

“I Miss You So Much” Recommended Yangshuo, so surprising!

Usage Insights on Small Life Items: Window Limiters

About Southern People Living in the North👇

Southern People in the North: Cold Resistance Record

Southern People in the North: Green Radishes

Southern People in the North: Ginkgo

About Travel👇

Autumn Farm Half-Day Tour: Digging Sweet Potatoes

Qingdao Travel Notes (1): Qingdao Zoo + Beer Museum

Qingdao Travel Notes (2): Climbing Laoshan

Qingdao Travel Notes (3): Winter Climbing Laoshan – Ju Feng Scenic Area

Travel Notes: Alcalá de Henares Ancient City in Spain

Travel Notes: Málaga in Spain

Travel Notes: Music Capital – Vienna, Austria (1)

Travel Notes: Music Capital – Vienna, Austria (2)

Travel Notes: Music Capital – Vienna, Austria (3)

About Experiences in Spain👇

Experiences in Spain: Bizarre Events in Spain – Occupying Rooms

Experiences in Spain: Messi’s Farewell to Barcelona

Experiences in Spain: Are Young People in Spain Worse Off than Their Parents?

Experiences in Spain: What Are the Well-Paying Professions in Spain?

Experiences in Spain: A Big Discussion on Meat Consumption in Spain

Experiences in Spain: January 6th Three Kings Day (Children’s Day in Spain)

Experiences in Spain: Did You Buy Christmas Lottery Tickets?

Experiences in Spain: Christmas Light Shows, Chocolate Calendars

Experiences in Spain: Spanish Constitution Day (December 6th)

Experiences in Spain: Is Y Dad’s Salary Only 1 Euro?

Experiences in Spain: November 9th Madrid Almudena Day (El Día de la Almudena)

Experiences in Spain: CHUFA Drink

Leave a Comment