I have seen a lot of talk about protobol buffers and vector tiles recently, which promises improved performance loading and rendering layers than just plain geojson. I’ve seen a lot of demos of the tech, but had trouble putting it all together. This is my first attempt at creating a server that will query PostGIS, serve vector tiles encoded into protobuf, and render them on a Leaflet map. Create a route to match the above URL. Create a node server with Express, and add a route similar to a standard tile layer: Use this bounding box to query PostGIS for the data we need for this tile. Convert the resulting rows into a single geojson feature collection. Finally, use vtile.getData() to get the protobuf-encoded buffer from the vector tile, pass it through zlib.deflate to compress, set the correct headers, and serve it. So far, this seems to load complex layers much faster than querying and returning the entire geojson for a bounding box, and has the advantage of sending actual vector data to the client, unlike a traditional tile layer. Source.