[postgis-users] ST_AsMVT returns an error when calculating tile bbox from x, y, z

Björn Harrtell bjorn.harrtell at gmail.com
Sun Nov 27 08:12:22 PST 2016


I've now added changes to my asmvt branch to allow for non square bounds,
which I hope can resolve your issues.

/Björn

2016-11-26 9:59 GMT+01:00 Nikolai Bezdna <mofoyoda at gmail.com>:

> 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
>
> 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
> 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/20161127/0a14d165/attachment.html>


More information about the postgis-users mailing list