[postgis-devel] ST_AsMVT

Paul Norman penorman at mac.com
Fri Sep 16 14:35:50 PDT 2016


On 9/16/2016 4:27 AM, Björn Harrtell wrote:
> CREATE FUNCTION ST_AsMVT(query text, extent box2d, resolution double, 
> buffer integer, pixelratio integer)

As an interface I propose taking in a row or similar instead of a query. 
Anything that takes SQL as text can be a problem.

For the other parameters I recommend name text, bounds box2d, extent 
integer DEFAULT 4096, buffer integer DEFAULT 0, clip_geoms bool DEFAULT 
true.

name is the required name of the layer.

bounds is the area which corresponds to the unbuffered area of the 
vector tile, and will typically be the area of an xyz tile.

Extent is the extent for the vector tile, as specified in the spec.

Buffer is how far to go out for geometries to include as well as used in 
clipping.

clip_geoms is if geometries should be clipped at the buffered extent or 
not. It's valid to include a geom that goes beyond the buffered extent, 
but this is not normally done for rendering.

For a return type, I'd go with bytea, being the binary data for the 
layer. Don't apply gzip compression, it's not part of the vector tile 
itself.

Thanks to the properties of mapbox vector tiles, you can then build a 
multi-layer tile by concatenating the results of multiple ST_AsMVT calls
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20160916/10af2071/attachment.html>


More information about the postgis-devel mailing list