[postgis-users] Calculating tiles intersecting a geometry

Paul Norman penorman at mac.com
Fri Sep 9 17:35:22 PDT 2016


I want to calculate GMaps tile numbers that intersect a geometry in a 
range of zooms, and was looking for any prior work along these lines. 
What I need is a function which takes geom, minimum zoom, and maximum 
zoom and returns a set of z,x,y which intersect the geometry.

My initial naive idea is to write a recursive query which starts at 
minzoom, finds intersecting tiles, then for each intersecting tile finds 
intersecting tiles at zoom z+1 until maxzoom is reached.

Implementations of this idea outside of postgis are 
https://github.com/openstreetmap/osm2pgsql/blob/master/expire-tiles.cpp 
and 
https://github.com/openstreetmap/chef/blob/master/cookbooks/tile/files/default/ruby/expire.rb

Has anyone done this before?


More information about the postgis-users mailing list