[postgis-devel] ST_AsMVT

Paul Ramsey pramsey at cleverelephant.ca
Fri Sep 16 05:45:18 PDT 2016


Would be cooler if it just took in a ROW. :)
P

On Fri, Sep 16, 2016 at 4:27 AM, Björn Harrtell <bjorn.harrtell at gmail.com>
wrote:

> As a continuation of my work with ST_AsGeobuf (1) I've started work on
> St_AsMVT (2), which is a function intended to output a Mapbox Vector Tile
> (3).
>
> A feature of Mapbox Vector Tiles are that they can contain several layers
> of data within a tile, typically corresponding to a separate source schema.
> So I'm thinking about how to specify the parameters to ST_AsMVT to support
> fetching the data for a tile and this is my initial proposal:
>
> CREATE FUNCTION ST_AsMVT(query text, extent box2d, resolution double,
> buffer integer, pixelratio integer)
>
> The query parameter is expected to produce rows with a specific schema
> like follows:
>
> CREATE TABLE output
> (
>   layer text,
>   id bigint,
>   geom geometry,
>   attributes json
> )
>
> The above schema would allow unioning data from multiple tables with
> differing attributes (represented using the json datatype, alternatively it
> could be a hstore?). Note that it's up the the query to include geometries
> to be considered (usually extent + buffer * resolution).
>
> The extent parameter defines the geographic extent to be visible within
> the tile (i.e does not include buffer).
>
> The resolution parameter defines units per pixel used to translate
> geometric coordinates into tile coordinates.
>
> The buffer parameter defines how many pixels should be included outside
> visible tile coordinates until clipping the geometry. This is used to avoid
> border rendering artifacts.
>
> The pixelratio parameter optionally multiplies tile coordinate space to
> support hdpi displays. Default should probably be 1.
>
> 1) https://git.osgeo.org/gogs/postgis/postgis/pulls/4
> 2) https://git.osgeo.org/gogs/postgis/postgis/pulls/5
> 3) https://www.mapbox.com/vector-tiles/specification
>
> /Björn
>
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/postgis-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20160916/2abc31e8/attachment.html>


More information about the postgis-devel mailing list