Closed mapsgeek closed 1 year ago
As far as I can tell, a multi-layer pbf tile is just two or more pbf's concatenated together. You can get two same-grid pbf's of different layers, do a cat file1 file2 > file3
on the command line, drag file3 on top of QGIS, and it'll add and draw both as separate layers. So...I think it's simple concatenation.
I imagine you could write some middleware piece that fetches all the pbf's you want, concats them, and sends a single tile back. I don't think that is going to buy you a whole lot. You're saving a little on http handshake overhead, but that's way down on the list of performance bottlenecks. Tile generation time and size over the wire will probably stay about the same.
You could try taking the often-changing layers of the same geometry type, make a view and mvt that. So if you have 20 point layers that change a lot, make a single view with all of them unioned with qualifying column(s) so you know what's what. Do that for points, lines, and polys, and at least you'll have it down to max 3 on-the-fly tile requests instead of however many you have going now.
i experimented with openmaptiles and using your videos as reference, there's a tool there called postserve
that instead of generating tiles it serves live from postgis as a tilejson and i tested with small area monaco
as an extract on a 6gb ram / 6 cores ubuntu virtual machine and it's quite good average 70-80ms per tile, this is quoting from openmaptiles quickstart
postserve
* memory ( >= 3Gb )
* for small extracts 3Gb-8Gb RAM
* for big extracts ( Europe, Planet) > 8-32 Gb
so i think if i followed your approach by adding my own data layer it will live on the PostgreSQL database and can be edited directly from there, the only uncertainty is that i do need to serve the whole planet and it will be hit with millions of requests and not sure how large is the machine needed would be.
i also found this project martin, it exposes an end point that accepts multiple tables but i haven't tested it yet and i think that openmaptiles would be more optimized since it serves each table at its respected zoom level vs serving tiles for the layers all at once which i found tegola can takes as a config file with zoom levels for each layer but your own data, still not sure about OSM i'm not good at following written docs or guides, if at any time you would make a video experimenting with these new options specially tegola that looks promising it would be a great source of info.
This might help: Multi-layer PostGIS MVT
The problem I'm working through is to have reasonable options without having an insane URL. Like if you wanted 5 layers with filters, you'd have to send a filter argument that looks something like ?filter=<args 1>;<args 2>;
This is not an issue but kind of need help with ideas, i have a scenario that requires serving multiple layers as a stacked pbf tile, currently the mvt endpoint accepts only one table for the query, i wonder if the query can be tweaked to serve OSM data along side other layers. i do understand that there are options out there for serving OSM but in my case i have to bake other layers that ( changed too much ) in the same tile, so i can't do mbtiles from openmaptiles