Serving and Displaying Vector Tiles with PostgreSQL, Tegola, and OpenLayers: Hands-on Coding Workshop
07-15, 14:00–18:00 (Europe/Sarajevo), PA11

This workshop demonstrates a full workflow for serving and visualizing vector tiles using open-source tools. We will cover essential spatial data management in PostgreSQL/PostGIS, generating vector tiles through Tegola, and rendering them in a basic React application using OpenLayers. The primary focus is to provide a clear, end-to-end solution that participants can adapt to their own map-driven projects or organizational requirements.

The session begins by examining best practices for structuring and indexing geospatial data in PostgreSQL/PostGIS. Participants will learn how to organize tables, create spatial indexes, and leverage PostGIS functionalities for efficient queries. This foundational step ensures that performance is maintained when dynamically creating vector tiles, even for large datasets. The workshop will then guide attendees through Tegola’s setup, demonstrating how to map backend data to vector tile layers via a straightforward configuration. Techniques for defining multiple layers and handling geometry transformations will be covered, giving participants the tools needed to generate tiles on the fly.

Moving on to the frontend, we will build a basic React application that fetches and renders the Tegola-served vector tiles. With OpenLayers as the primary mapping library, the workshop will show how to set up data sources, bind them to interactive map components, and display or hide layers as needed. Through examples and best practices, participants will see how to manage typical mapping features, such as popup information or user-driven layer toggling, while maintaining performant and responsive applications. Although we will not go deeply into caching strategies, we will highlight how optimizing data loading and proper data structuring can provide a smoother user experience when dealing with numerous vector tiles.

A core theme of the workshop involves creating and managing map styles on the backend, which is particularly beneficial when multiple or frequently changing layers must be styled consistently. Attendees will learn how to define a Mapbox-style JSON document, store it in a centralized location, and leverage the ol-mapbox-style plugin in OpenLayers to apply these definitions automatically. This streamlined approach reduces repetitive work in the frontend and helps maintain style consistency across different projects or teams.

Throughout the workshop, real-world challenges and potential pitfalls will be discussed, including common performance considerations and troubleshooting strategies for vector tile pipelines. Participants will explore how to handle large datasets effectively, address geometry errors, and debug tile generation issues. These insights will equip attendees with practical techniques to ensure their mapping applications remain stable and efficient, even under demanding conditions.

This workshop is hands-on and code-oriented, giving participants a practical guide they can follow step by step. Sample datasets and code snippets will be supplied, helping attendees quickly understand core concepts and apply them in real-time. By combining PostgreSQL/PostGIS, Tegola, React, and OpenLayers, this workshop delivers a robust, open-source foundation for building modern, scalable web mapping applications. By the end of the session, attendees will have a working proof-of-concept application, along with the knowledge and confidence to integrate these techniques into future projects.


During this technically focused workshop, attendees will learn how to build a complete vector tile pipeline from spatial data management in a PostgreSQL/PostGIS environment to a fully functional web map interface built with React and OpenLayers.

  1. Data Preparation - We begin with best practices for storing and indexing geospatial data in PostgreSQL/PostGIS. This includes tips on data modeling, indexing strategies, and query optimizations for high-performance tile generation.

  2. Tegola Setup - Next, we install and configure Tegola, a vector tile server that interfaces with PostgreSQL. We’ll walk through creating a configuration file to define map layers, handling geometry transformations, and generating vector tiles on the fly. You’ll see how to manage multiple layers and styles using Tegola’s straightforward configuration syntax.

  3. Frontend Integration - We then move to building a React application that consumes the Tegola-served vector tiles. Using OpenLayers, attendees will learn how to set up vector tile sources and implement interactive map features (e.g., popup information, layer toggling etc.). We’ll discuss strategies for maintaining efficient loading times and smooth interactions in a production setup.

  4. Styling with ol-mapbox-style - A key focus will be on moving layer styling logic to the backend (important when working with large number of layers). We’ll demonstrate how to define a Mapbox-style JSON document and leverage the ol-mapbox-style plugin in OpenLayers to automatically apply that style. This approach simplifies collaboration and ensures consistent styling, eliminating repetitive frontend adjustments as data changes.

  5. Performance and Troubleshooting - We’ll address performance tuning, caching, and troubleshooting common issues in vector tile pipelines. You’ll learn how to optimize tile generation and serve large datasets effectively.

Throughout the workshop, attendees will follow a practical, step-by-step approach, resulting in a working proof-of-concept application by the end. Familiarity with PostgreSQL, React, and basic mapping concepts is recommended, but we’ll provide contextual guidance to ensure everyone can keep pace. The whole workshop (and code) will be provided using GitHub (or similar repository) for easier participation.


What topics do you plan to cover in your workshop?

Best practices for preparing and managing spatial data in PostgreSQL/PostGIS
Configuring Tegola to serve vector tiles on the fly
Building an interactive web mapping application with React and OpenLayers (including vector tile sources and basic performance considerations)
Backend-driven styling using Mapbox-style JSON documents and the ol-mapbox-style plugin for centralized style management

Level of the workshop

intermediate

Pre-requirements for attendees

Basic knowledge of working with OpenLayers and JavaScript is preferred. Backend will be presented using Python programming language but the workshop is aimed more towards covering basic principles which can later be easily applied to programming language of participant's choice.
Frontend will be presented in React but basic concepts shall also be easily be transferred to other popular JavaScript frameworks.

Coding knowledge required?

Some programming knowledge is preferred but basic concept can easily be applied to any language. This workshop is aimed towards explaining basic implementation expects.
Suggested knowledge:
Python - basic knowledge
JavaScript - Intermediate knowledge
React - Basic knowledge

Link to software source code repository

https://tegola.io/

M.Eng in Geodesy and Geoinformatics, with over 5 years of experience in full-stack software development, GIS, remote sensing and data science. I'm currently working as Lead Software developer. Due to my involvement in various LIST LABS projects, of which all include use of React, OpenLayers and Tegola, I gained sufficient knowledge to design and develop highly efficient algorithms and quality webapps.

Mag. Ing. Silv. specialized in Urban Forestry, Nature Conservation, and Environmental Protection. With over two years of experience in front-end web development, I bring expertise in creating dynamic and user-friendly web applications.
Currently, I am a Front-End Developer at LIST LABS, where I specialise in developing Web GIS applications for diverse projects. My technical stack includes React, Redux, TypeScript, and OpenLayers, enabling me to deliver efficient and scalable solutions that integrate geospatial data visualisation and interaction.