Upload Shapefile to PostgreSQL with Python & GeoPandas
Learn how to upload shapefiles into PostgreSQL (PostGIS) using Python and GeoPandas in this full tutorial. 🚀

GeoDev
1.9K views • Oct 20, 2025

About this video
Join this channel to get access to the perks:
https://www.youtube.com/channel/UCCV3Wo1EDp--JZTwf0TcFpg/join
Learn how to upload a shapefile into a PostgreSQL/PostGIS database using Python and GeoPandas. This step-by-step tutorial shows you how to read a shapefile, prepare CRS, convert geometry, and write spatial data to PostgreSQL using GeoPandas’ to_postgis() or psycopg2/SQLAlchemy methods. Perfect for GIS analysts, data engineers and developers working with spatial data.
What you’ll learn:
1. Read shapefiles with GeoPandas (gpd.read_file)
2. Convert geometry and attribute types for PostgreSQL/PostGIS
3. Save to PostGIS using GeoDataFrame.to_postgis() OR using psycopg2/SQLAlchemy
4. How to verify data in Postgres (example SQL queries)
timestamps:
0:00 Intro
0:18 Ways to upload shapefile to postgresql
1:41 Steps to follow
2:22 Create extension for PostGIS
4:10 Create venv and install python dependencies
6:06 Write script to upload shapefile to postgis
8:30 Run the script
9:05 Visualize the data in Pgadmin
10:06 Outro
Tutorial code: https://github.com/iamtekson/maplibre-tutorials/blob/main/vector_tiles/upload_shp.py
If you found this helpful, please LIKE, SUBSCRIBE and hit the 🔔 to get more GIS + Python tutorials. Have a shapefile that fails to upload? Paste the error in the comments and I’ll help troubleshoot.
----------------------------------------------------------------------------------------
Here are some playlists that you might be interested in:
----------------------------------------------------------------------------------------
- End to End deep learning using GEE dataset: https://www.youtube.com/playlist?list=PLyWyQBSWLw1NKHAzW9WI2_9Sga52_rvMt
- Deep Learning for Satellite Imagery: https://www.youtube.com/playlist?list=PLyWyQBSWLw1MGjBAFaO62JMacKHT6_lvs
- Machine learning from the basic: https://youtube.com/playlist?list=PLyWyQBSWLw1OFQepDgqap9dOSlF_pvOp8
- Historical Imagery Processing: https://www.youtube.com/playlist?list=PLyWyQBSWLw1PBhi9ywkotd_gz2lXFyvSG
- Leaflet from basic to advance: https://youtube.com/playlist?list=PLyWyQBSWLw1NH1wsA0wkSMTlQ45P0AqCj
- GeoServer with leaflet web-GIS: https://youtube.com/playlist?list=PLyWyQBSWLw1OS7HojnpX6aogfm7LtF39S
- GeoDjango project: https://youtube.com/playlist?list=PLyWyQBSWLw1OUfqcPzO6AceuGpC5gr-_n
- geoserver-rest: https://youtube.com/playlist?list=PLyWyQBSWLw1NQJhO0Stf9Wsadm3xh0psF
- GIS training in Nepali: https://youtube.com/playlist?list=PLyWyQBSWLw1OFygrHN_uSHExoPG12lfwZ
- LULC map production: https://youtube.com/playlist?list=PLyWyQBSWLw1PdIQ9ZN6YvfgKrhO9Ub7HI
- Geospatial analysis with python: https://youtube.com/playlist?list=PLyWyQBSWLw1OF3RGVWToPkqe_pfx4TcPW
- GeoNode from basic to advance: https://youtube.com/playlist?list=PLyWyQBSWLw1Nrc-JDMr6_OEbF4h2hCxPL
--------------------------------------------------------------------------------------------------------------
Check out my discounted courses at the following link:
--------------------------------------------------------------------------------------------------------------
1. "Geospatial data analysis with python": https://www.udemy.com/course/geospatial-data-analysis-with-python/?referralCode=5B58238C5392672D17B7
2. "Web GIS Development 2021": https://www.udemy.com/course/web-gis-development-2021/?referralCode=488F271341990F62FD05
3. "Web mapping and Web-GIS from Dev to Deploy 2021: GeoDjango": https://www.udemy.com/course/web-mapping-and-web-gis-from-dev-to-deploy-2021-geodjango/?couponCode=WEBGIS2
4. "Introduction to Web Mapping and Web GIS 2020: GeoDjango": https://www.udemy.com/course/introduction-to-web-mapping-and-web-gis-2020-geodjango/?couponCode=WEBGIS2
5. Deep Learning Application for Earth Observation: https://www.udemy.com/course/deep-learning-application-for-earth-observation/?referralCode=B4655A8A918826871A40
6. Geospatial Data Analysis with Python: https://www.udemy.com/course/geospatial-data-analysis-with-python/?referralCode=5B58238C5392672D17B7
---------------------------------------------------------------------------------------------------
Follow me on GitHub: https://github.com/iamtekson
Follow me on Twitter: https://twitter.com/iamtekson
Follow me on Instagram: https://instagram.com/iamtekson
Join Facebook group: https://www.facebook.com/groups/1049524025731229
-----------------------------------------------------------------------------------------------------
#PostGIS #GeoPandas #Python #GIS #SpatialData #PostgreSQL #Shapefile #Geospatial
https://www.youtube.com/channel/UCCV3Wo1EDp--JZTwf0TcFpg/join
Learn how to upload a shapefile into a PostgreSQL/PostGIS database using Python and GeoPandas. This step-by-step tutorial shows you how to read a shapefile, prepare CRS, convert geometry, and write spatial data to PostgreSQL using GeoPandas’ to_postgis() or psycopg2/SQLAlchemy methods. Perfect for GIS analysts, data engineers and developers working with spatial data.
What you’ll learn:
1. Read shapefiles with GeoPandas (gpd.read_file)
2. Convert geometry and attribute types for PostgreSQL/PostGIS
3. Save to PostGIS using GeoDataFrame.to_postgis() OR using psycopg2/SQLAlchemy
4. How to verify data in Postgres (example SQL queries)
timestamps:
0:00 Intro
0:18 Ways to upload shapefile to postgresql
1:41 Steps to follow
2:22 Create extension for PostGIS
4:10 Create venv and install python dependencies
6:06 Write script to upload shapefile to postgis
8:30 Run the script
9:05 Visualize the data in Pgadmin
10:06 Outro
Tutorial code: https://github.com/iamtekson/maplibre-tutorials/blob/main/vector_tiles/upload_shp.py
If you found this helpful, please LIKE, SUBSCRIBE and hit the 🔔 to get more GIS + Python tutorials. Have a shapefile that fails to upload? Paste the error in the comments and I’ll help troubleshoot.
----------------------------------------------------------------------------------------
Here are some playlists that you might be interested in:
----------------------------------------------------------------------------------------
- End to End deep learning using GEE dataset: https://www.youtube.com/playlist?list=PLyWyQBSWLw1NKHAzW9WI2_9Sga52_rvMt
- Deep Learning for Satellite Imagery: https://www.youtube.com/playlist?list=PLyWyQBSWLw1MGjBAFaO62JMacKHT6_lvs
- Machine learning from the basic: https://youtube.com/playlist?list=PLyWyQBSWLw1OFQepDgqap9dOSlF_pvOp8
- Historical Imagery Processing: https://www.youtube.com/playlist?list=PLyWyQBSWLw1PBhi9ywkotd_gz2lXFyvSG
- Leaflet from basic to advance: https://youtube.com/playlist?list=PLyWyQBSWLw1NH1wsA0wkSMTlQ45P0AqCj
- GeoServer with leaflet web-GIS: https://youtube.com/playlist?list=PLyWyQBSWLw1OS7HojnpX6aogfm7LtF39S
- GeoDjango project: https://youtube.com/playlist?list=PLyWyQBSWLw1OUfqcPzO6AceuGpC5gr-_n
- geoserver-rest: https://youtube.com/playlist?list=PLyWyQBSWLw1NQJhO0Stf9Wsadm3xh0psF
- GIS training in Nepali: https://youtube.com/playlist?list=PLyWyQBSWLw1OFygrHN_uSHExoPG12lfwZ
- LULC map production: https://youtube.com/playlist?list=PLyWyQBSWLw1PdIQ9ZN6YvfgKrhO9Ub7HI
- Geospatial analysis with python: https://youtube.com/playlist?list=PLyWyQBSWLw1OF3RGVWToPkqe_pfx4TcPW
- GeoNode from basic to advance: https://youtube.com/playlist?list=PLyWyQBSWLw1Nrc-JDMr6_OEbF4h2hCxPL
--------------------------------------------------------------------------------------------------------------
Check out my discounted courses at the following link:
--------------------------------------------------------------------------------------------------------------
1. "Geospatial data analysis with python": https://www.udemy.com/course/geospatial-data-analysis-with-python/?referralCode=5B58238C5392672D17B7
2. "Web GIS Development 2021": https://www.udemy.com/course/web-gis-development-2021/?referralCode=488F271341990F62FD05
3. "Web mapping and Web-GIS from Dev to Deploy 2021: GeoDjango": https://www.udemy.com/course/web-mapping-and-web-gis-from-dev-to-deploy-2021-geodjango/?couponCode=WEBGIS2
4. "Introduction to Web Mapping and Web GIS 2020: GeoDjango": https://www.udemy.com/course/introduction-to-web-mapping-and-web-gis-2020-geodjango/?couponCode=WEBGIS2
5. Deep Learning Application for Earth Observation: https://www.udemy.com/course/deep-learning-application-for-earth-observation/?referralCode=B4655A8A918826871A40
6. Geospatial Data Analysis with Python: https://www.udemy.com/course/geospatial-data-analysis-with-python/?referralCode=5B58238C5392672D17B7
---------------------------------------------------------------------------------------------------
Follow me on GitHub: https://github.com/iamtekson
Follow me on Twitter: https://twitter.com/iamtekson
Follow me on Instagram: https://instagram.com/iamtekson
Join Facebook group: https://www.facebook.com/groups/1049524025731229
-----------------------------------------------------------------------------------------------------
#PostGIS #GeoPandas #Python #GIS #SpatialData #PostgreSQL #Shapefile #Geospatial
Tags and Topics
Browse our collection to discover more content in these categories.
Video Information
Views
1.9K
Likes
47
Duration
10:34
Published
Oct 20, 2025
User Reviews
4.5
(1) Related Trending Topics
LIVE TRENDSRelated trending topics. Click any trend to explore more videos.
No specific trending topics match this video yet.
Explore All Trends