
Build a User Profile Page using FastAPI + Next.js! | Flight Booking Engine Day 35
Nehemiah Kamolu
Join this channel to get access to the perks: https://www.youtube.com/channel/UCCV3Wo1EDp--JZTwf0TcFpg/join Learn how to build a high-performance vector tile API from PostGIS using FastAPI, serve tiles with uvicorn, and visualize them in MapLibre. This hands-on tutorial walks through installing dependencies, writing the vector tile endpoint, enabling CORS, and testing the result with a MapLibre web map. If you want more control than pg_tileserv or need a lightweight custom tile API — this is for you. 🔧 What you’ll learn • How to query PostGIS and return Mapbox Vector Tiles (MVT) • Implementing a vector tile endpoint in FastAPI • Running the API with uvicorn and enabling CORS • Visualizing tiles with a MapLibre map in the browser • Practical comparison to pg_tileserv and when to use a custom API ⏱️ Timestamps 0:00 Intro and previous method (pg_tileserv) 1:27 Installing dependencies 2:36 Write the API for vector tile 7:24 Main body of API (creating endpoint for vector tile) 11:54 Create MapLibre map for visualizing vector tile 13:15 Start the FastAPI server using uvicorn 14:36 Enable CORS in API 16:00 Outro / next steps 📁 Code & resources https://github.com/iamtekson/maplibre-tutorials/tree/main/vector_tiles 📌 Notes & tips • Use `ST_AsMVT` / `ST_AsMVTGeom` in PostGIS to generate MVT bytes server-side for best performance. • Return `Response(content=tile_bytes, media_type="application/x-protobuf")` (FastAPI) and set `Content-Encoding` if compressed. • Enable proper CORS and cache headers for production to avoid browser errors and improve client performance. • Consider pg_tileserv for plug-and-play needs; build custom FastAPI when you need logic, auth, or integration. 👍 If this helped — Like, Subscribe, and leave a comment with what dataset you used (or want to use)! #PostGIS #FastAPI #VectorTiles #MapLibre ---------------------------------------------------------------------------------------- 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 Big Rock - Take the Lead by Kevin MacLeod is licensed under a Creative Commons Attribution 4.0 license. https://creativecommons.org/licenses/by/4.0