[postgis-users] Calculating tiles intersecting a geometry

Imre Samu pella.samu at gmail.com
Sat Sep 10 05:45:41 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
>Has anyone done this before?

AS I know osm2vectortiles project[1]  using a traversing quadtree[2] based
solution for detecting changed tiles:

[1]  on http://osm2vectortiles.org/docs/     Academic Material  ->  Bachelor
thesis PDF
 and search for   : "5.4 calculate changed tiles"  ->    PostgreSQL
Implementation
 github:  -> "CREATE OR REPLACE FUNCTION overlapping_tiles("
 https://github.com/osm2vectortiles/osm2vectortiles/blob/master/
src/import-sql/functions.sql#L1

[2]  http://javisantana.com/2014/10/22/traversing-quadtree.html



> ... outside of postgis  ...

The Mapbox Tile-Cover [ "generate the minimum number of tiles to cover a
geojson geometry" ]
is implemented is JavaScript [ https://github.com/mapbox/tile-cover ]
so maybe it can be call via  PostgreSQL PL/v8







2016-09-10 2:35 GMT+02:00 Paul Norman <penorman at mac.com>:

> 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?
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/postgis-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20160910/d98f654f/attachment.html>


More information about the postgis-users mailing list