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

Nikolai Bezdna mofoyoda at gmail.com
Mon Nov 28 13:38:17 PST 2016


Bjorn, thanks for a quick fix!
Now it doesn't throw this error.
Can you please clarify some questions:

1. How do I concatenate st_asmvt output from different tables? I’ve never
concatenated binary data in postgres (only strings) and if that really
works, looks like some kind of magic :)
My goal is to have multiple layers in a tile, like Mapnik MVT output. I
guess this is the most common case.

2. What names are given to layers in the generated tile? Are they
configurable? (I.e. if my input comes from a function, not a table or a
view).

3. Does st_asmvt do any internal filtering and/or simplification of the
input geometries?
It’d be great if it doesn’t, because I’d like to have control on this
process with SQL. So I send rows with filtered and simplified geometry to
st_asmvt and it just does tile encoding.

4. Are there any tools to check the contents of the tile? Maybe node module
with a decoder or smth.

Cheers,
Nick


> Date: Sun, 27 Nov 2016 17:12:22 +0100
> From: Björn Harrtell <bjorn.harrtell at gmail.com>
> To: PostGIS Users Discussion <postgis-users at lists.osgeo.org>
> Subject: Re: [postgis-users] ST_AsMVT returns an error when
>         calculating tile bbox from x, y, z
> Message-ID:
>         <CANhDX=a42GQTDf6b6qo3u4w0k8=qOPOgfsBuRvEF6gxu3+Ex+w at mail.
> gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> 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.
> >
> > _______________________________________________
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20161129/05636446/attachment.html>


More information about the postgis-users mailing list