<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">A row parameter will be tricky to code, but worth it, I think. You’ll probably have to hunt through the pgsql source to find one to work off of, but you’ll learn a lot about pgsql internals in the process.<div class=""><br class=""></div><div class="">P.<br class=""><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Sep 16, 2016, at 3:29 PM, Björn Harrtell <<a href="mailto:bjorn.harrtell@gmail.com" class="">bjorn.harrtell@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_extra"><div class="gmail_quote">2016-09-16 23:35 GMT+02:00 Paul Norman<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:penorman@mac.com" target="_blank" class="">penorman@mac.com</a>></span>:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div bgcolor="#FFFFFF" class=""><span class="gmail-"><br class=""><div class="">On 9/16/2016 4:27 AM, Björn Harrtell wrote:<br class=""></div><blockquote type="cite" class="">CREATE FUNCTION ST_AsMVT(query text, extent <span class="">box2d, resolution double, buffer integer, pixelratio integer</span>)</blockquote><br class=""></span>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.</div></blockquote><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div bgcolor="#FFFFFF" class=""><br class="">For the other parameters I recommend name text, bounds box2d, extent integer DEFAULT 4096, buffer integer DEFAULT 0, clip_geoms bool DEFAULT true.<br class=""><br class="">name is the required name of the layer.<br class=""><br class="">bounds is the area which corresponds to the unbuffered area of the vector tile, and will typically be the area of an xyz tile.<br class=""><br class="">Extent is the extent for the vector tile, as specified in the spec.<br class=""><br class="">Buffer is how far to go out for geometries to include as well as used in clipping.<br class=""><br class="">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.<br class=""><br class="">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.<br class=""><br class="">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<br class=""></div></blockquote><div class=""><br class=""></div><div class="">Thanks Paul, I thought the first Paul was messing with me but now I see he was serious. :) To clarify, I understand that SQL as text is a problem I was just not seeing any alternative.<br class=""></div><div class=""><br class=""></div><div class="">I think your recommendations for the other parameters make sense.</div><div class=""><br class=""></div><div class="">I was unaware of the possibility to concatenate layers in binary format, it seems reasonable but need to investigate further. I'm still confused about using a "row or similar" type instead of a query, if by that you mean to encode just a single geometry at a time, because I can't see how that could be possible to concatenate as binary. Perhaps my confusion can be explained by that I also have problems understanding the "40.3.4. Row Types" chapter in the PostgreSQL documentation.</div><div class=""> </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div bgcolor="#FFFFFF" class=""></div><br class="">______________________________<wbr class="">_________________<br class="">postgis-devel mailing list<br class=""><a href="mailto:postgis-devel@lists.osgeo.org" class="">postgis-devel@lists.osgeo.org</a><br class=""><a href="http://lists.osgeo.org/mailman/listinfo/postgis-devel" rel="noreferrer" target="_blank" class="">http://lists.osgeo.org/<wbr class="">mailman/listinfo/postgis-devel</a><br class=""></blockquote></div><br class=""></div></div><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">_______________________________________________</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">postgis-devel mailing list</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="mailto:postgis-devel@lists.osgeo.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">postgis-devel@lists.osgeo.org</a><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="http://lists.osgeo.org/mailman/listinfo/postgis-devel" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">http://lists.osgeo.org/mailman/listinfo/postgis-devel</a></div></blockquote></div><br class=""></div></div></body></html>