I’m trying to use ST_AsMVT to respond to client tile requests with 
MVT-fromatted response.

From the client side I’m getting standard web mercator tile coordinates as z, 
x, y. To transfer these numbers to proper BBox, I’m using this Mapbox helper 
function for PostGIS (TileBBox):
https://github.com/mapbox/postgis-vt-util/blob/master/postgis-vt-util.sql#L541 
<https://github.com/mapbox/postgis-vt-util/blob/master/postgis-vt-util.sql#L541>
 
When I use it's output geometry as a BBox parameter for ST_AsMVT function, I 
get an error:

[XX000] ERROR: mvt_agg_init_context: bounds must be square

Both CRS of BBox and the input geometry is 3857.
ST_AsMVT runs without this error only when x and y are the same, e.g: 
ST_AsMVT('test’, TileBBox(10, 1279, 1279), 4096, 0, false, ‘geom’, q)...
In all other cases ST_AsMVT returns this error. 
I guess the returned BBox geometry is absolutely square only when x = y.

But how can I calculate the proper bounding box for each tile request? 
TileBBox function looks pretty straightforward. Looks like there are no errors 
in it.
_______________________________________________
postgis-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/postgis-users

Reply via email to