<div dir="auto"><div dir="ltr"><div>Paul,</div><div><br></div><div>I have been trying to wrap my head around how an analogue to jsonb_to_record would be useful for FlatGeobuf and can't figure it out. In fact, I have trouble coming up with anything *really* useful as user exposed PostGIS functions. The problem is that there is no way to work with parts of a binary buffer except vis the generic file system aux functions which does not feel right to use for stuff like this.</div><div><br></div><div>A plain ST_AsFlatGeobuf aggregate and a setof record returning ST_FromFlatGeobuf could provide some usefulness perhaps but would be limited by max tuple size and not really the desired "building blocks".<br></div><div><br></div><div>Optimally I would want to be able to process a FlatGeobuf binary from a steam into rows and vice versa but the only way that I can think of to do that is to make COPY accept and produce FlatGeobuf.</div><div><br></div><div>Did you have something in mind that I'm not seeing?</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Den ons 23 sep. 2020 kl 17:22 skrev Paul Ramsey <<a href="mailto:pramsey@cleverelephant.ca" target="_blank" rel="noreferrer">pramsey@cleverelephant.ca</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
> On Sep 23, 2020, at 12:34 AM, Björn Harrtell <<a href="mailto:bjorn.harrtell@gmail.com" target="_blank" rel="noreferrer">bjorn.harrtell@gmail.com</a>> wrote:<br>
> <br>
> Is flatgeobuf an alternative to shapefile, to MVT, or both? Do you<br>
> expect people to use it to extract full datasets or only parts of it<br>
> at a time?<br>
<br>
I think it's a worthy addition, and having the format in PostGIS will promote usage (orobouros) because that makes the format available to all connecting languages, systems, and it doesn't need to be reimplemented in 50 locations.<br>
<br>
> One thing I'm not sure about is `ST_FromFlatGeobuf`. I would expect<br>
> that to return a table/tuple, but AFAIK there is no way to change the<br>
> output format of a function based on the input, so I think I would<br>
> expect something like a fgb2pgsql cli and not a SQL function.<br>
<br>
See jsonb_to_record(jsonb), I think this is doable for geojson as well as [flat]geobuf.<br>
<br>
P.<br>
<br>
</blockquote></div></div></div>