TransWikia.com

How to query PostGIS for the XYZ tiles covered by features?

Geographic Information Systems Asked on December 25, 2020

I have a feature table in PostgreSQL and I need to calculate the XYZ tiles that the queried features encompass.

So my query would look something like this:

SELECT getTiles(geom, min_zoom, max_zoom)
FROM feature

And I want it to return a XYZ array for each tile:

[167,367,10],[159,368,10],[160,368,10],[161,368,10],[162,368,10]...

How can I calculate the tile XYZ values like this pseudocode getTiles? I’ve looked through the PostGIS documentation and Mapbox’s Postgis utils but haven’t found examples of this. I feel like such a function probably already exists in some applications.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP