<div dir="ltr"><div>Just a FWIW,</div><div><br></div><div>FlatGeobuf is actually not prioritizing space optimization, instead designed for simplicity and speed. Even so, it can be smaller than both shapefile and geojson but it depends on data. But so, it can make sense to compress if space optimization is required.</div><div><br></div><div>The primary reason for why FlatGeobuf is fast is the use of Flatbuffers which is not far from C structs (i.e direct access, no decode, no extra allocations needed) but has a stable platform independent wire format. If created without index FlatGeobuf can be both written and read as stream, which makes it very fast as a system to system transfer format. If written with an index a FlatGeobuf can be accessed with a bbox filter very efficiently because it has a guaranteed balanced Hilbert R-tree, so can be traversed with forward seek and found data locality is good because data is ordered by the spatial index. Unfortunately bytea input/output does not allow full advantage of these properties - something like COPY would be better (since it can be streamed).</div><div><br></div><div>/Björn</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Den tors 25 nov. 2021 kl 00:10 skrev Regina Obe <<a href="mailto:lr@pcorp.us">lr@pcorp.us</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"><div lang="EN-US"><div class="gmail-m_-398233345456126715WordSection1"><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">As mentioned on IRC just reiterated here.  <u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">I would like to see ST_AsFlatGeoBuf in there. Here are my reasons.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">1) To Bruce’s point that sure ogr_fdw can read it, I’m more interested in the writing of it (which at least I can’t do from scratch with ogr_fdw) and getting out of the database onto the command line is not one of my great ambitions in life.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">2) The fact it is a lighter weight format than ST_AsGeoJSON which has the same 1GB limitation.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Or as mentioned <a href="https://flatgeobuf.org/" target="_blank">https://flatgeobuf.org/</a> a better shapefile format (for < 1GB)<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">And the fact that FlatGeobuf is about 50% lighter than GeoJSON <u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">From site:<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">  (shapefile 1, FlatGeoBuf 0.77,  GeoJSON  1.2)<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Means I can stuff much more data in the 1GB limit than I can in GeoJSON.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Though not sure about how that places with the other attribute data if they are compacted as efficiently.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">3) Given it is  demonstrated it can work fine with leaflet and openlayers means it is possible to hook it into something like <u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><a href="https://github.com/CrunchyData/pg_featureserv" target="_blank">https://github.com/CrunchyData/pg_featureserv</a> <u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">as an alternative format to geojson (not saying you should Martin Davis – just throwing it out there </span><span style="font-size:11pt;font-family:Wingdings;color:rgb(31,73,125)">J</span><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"> )<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">4) One more reason to fight that 1GB limit – as postgis raster is impacted by that too.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Thanks,<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Regina<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p><div style="border-top:none;border-right:none;border-bottom:none;border-left:1.5pt solid blue;padding:0in 0in 0in 4pt"><div><div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0in 0in"><p class="MsoNormal"><b><span style="font-size:11pt;font-family:Calibri,sans-serif">From:</span></b><span style="font-size:11pt;font-family:Calibri,sans-serif"> postgis-users [mailto:<a href="mailto:postgis-users-bounces@lists.osgeo.org" target="_blank">postgis-users-bounces@lists.osgeo.org</a>] <b>On Behalf Of </b>Björn Harrtell<br><b>Sent:</b> Wednesday, November 24, 2021 5:26 PM<br><b>To:</b> PostGIS Development Discussion <<a href="mailto:postgis-devel@lists.osgeo.org" target="_blank">postgis-devel@lists.osgeo.org</a>><br><b>Cc:</b> PostGIS Users Discussion <<a href="mailto:postgis-users@lists.osgeo.org" target="_blank">postgis-users@lists.osgeo.org</a>><br><b>Subject:</b> Re: [postgis-users] [postgis-devel] PSC Vote: Keep or drop Flatgeobuf in PostGIS 3.2.0<u></u><u></u></span></p></div></div><p class="MsoNormal"><u></u> <u></u></p><div><div><p class="MsoNormal">Even though I spent quite a bit of effort on implementing this stuff and I'm sure I can fix the crashers I agree with the arguments to remove it. That is, 1GB limit is really bad and better to use GDAL which has a well maintained impl of it.<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">If there was a way to stream in and out binary with custom encoding and no size limit (i.e COPY with custom/ext binary format) it could make sense but I don't think that is going to happen any time soon.<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">Oh well, it was fun. Some of it. <span style="font-family:"Segoe UI Symbol",sans-serif">😂</span><u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">PS. ST_AsGeobuf should be deprecated/removed too - it's even less useful IMHO.<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">PS2. I do still believe in FlatGeobuf and it is used in production. ;)<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal" style="margin-bottom:12pt">/Björn<u></u><u></u></p><div><div><p class="MsoNormal">Den ons 24 nov. 2021 22:26Bruce Rindahl <<a href="mailto:bruce.rindahl@gmail.com" target="_blank">bruce.rindahl@gmail.com</a>> skrev:<u></u><u></u></p></div><blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in"><div><p class="MsoNormal">FWIW I say remove it and seriously think about not including it at all.  Looks like you can use the format right now via ogr_fdw using GDAL. <u></u><u></u></p></div><p class="MsoNormal"><u></u> <u></u></p><div><div><p class="MsoNormal">On Wed, Nov 24, 2021 at 12:51 PM Regina Obe <<a href="mailto:lr@pcorp.us" target="_blank">lr@pcorp.us</a>> wrote:<u></u><u></u></p></div><blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in"><div><div><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">FWIW it’s already in GDAL since 3.1 and yah GDAL is a better home since it doesn’t have the  1GB PostgreSQL limitation</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><a href="https://gdal.org/drivers/vector/flatgeobuf.html" target="_blank">https://gdal.org/drivers/vector/flatgeobuf.html</a></span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Also here are OpenLayers and Leaflet examples for those not familiar with the format</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">OpenLayers: <a href="https://flatgeobuf.org/examples/openlayers/" target="_blank">https://flatgeobuf.org/examples/openlayers/</a></span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Leaflet: <a href="https://flatgeobuf.org/examples/leaflet/" target="_blank">https://flatgeobuf.org/examples/leaflet/</a></span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Thanks,</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Regina</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"> </span><u></u><u></u></p><div style="border-top:none;border-right:none;border-bottom:none;border-left:1.5pt solid blue;padding:0in 0in 0in 4pt"><div><div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0in 0in"><p class="MsoNormal"><b><span style="font-size:11pt;font-family:Calibri,sans-serif">From:</span></b><span style="font-size:11pt;font-family:Calibri,sans-serif"> postgis-users [mailto:<a href="mailto:postgis-users-bounces@lists.osgeo.org" target="_blank">postgis-users-bounces@lists.osgeo.org</a>] <b>On Behalf Of </b>Darafei "Kom?pa" Praliaskouski<br><b>Sent:</b> Wednesday, November 24, 2021 3:27 PM<br><b>To:</b> PostGIS Development Discussion <<a href="mailto:postgis-devel@lists.osgeo.org" target="_blank">postgis-devel@lists.osgeo.org</a>><br><b>Cc:</b> PostGIS Users Discussion <<a href="mailto:postgis-users@lists.osgeo.org" target="_blank">postgis-users@lists.osgeo.org</a>><br><b>Subject:</b> Re: [postgis-users] [postgis-devel] PSC Vote: Keep or drop Flatgeobuf in PostGIS 3.2.0</span><u></u><u></u></p></div></div><p class="MsoNormal"> <u></u><u></u></p><div><p class="MsoNormal">Hi,<br><br>I have not seen flatgeobuf in the wild, and I believe it can be safely removed. <u></u><u></u></p><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">The current implementation is impaired by Postgres' life choices of 1GB limit and thus not usable for any data, just size-limited subset. ogr2ogr seems like a better suited place for it to reside.<u></u><u></u></p></div><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">I'm -0 on adding flatgeobuf to core, and -1 on releasing with known crashers. This would converge to "remove if nobody can fix crashers".<u></u><u></u></p></div><div><p class="MsoNormal"> <u></u><u></u></p></div></div><p class="MsoNormal"> <u></u><u></u></p><div><div><p class="MsoNormal">On Wed, Nov 24, 2021 at 11:10 PM Regina Obe <<a href="mailto:lr@pcorp.us" target="_blank">lr@pcorp.us</a>> wrote:<u></u><u></u></p></div><blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin:5pt 0in 5pt 4.8pt"><p class="MsoNormal">This is a PSC vote, but we would like some feedback on this from packagers<br>and users as such comments will sway our vote.<br><br>We have two blockers that center around the new FlatGeoBuf format.<br><br><a href="https://trac.osgeo.org/postgis/ticket/5005" target="_blank">https://trac.osgeo.org/postgis/ticket/5005</a>  (this one is easily<br>replicatable)<br><br><a href="https://trac.osgeo.org/postgis/ticket/5014" target="_blank">https://trac.osgeo.org/postgis/ticket/5014</a> (this one I can only replicate<br>with the cowbuilder setup Bas Cowenberg provided)<br><br>both I think are manifestations of the same problem how the header is<br>derived and what it's doing with numeric and geometry fields.<br><br>I've taken a stab at troubleshooting and fixing, but did not have much luck.<br>That said, if anyone is willing to help fix that would be great and fix<br>within a 1 to 2 week time period.<br><br>If not I feel that we really need to take it out of our PostGIS 3.2.0<br>release (which will be going on to 3.2.0beta2).<br><br>I'd like to release PostGIS 3.2.0beta2 in about a week or so with flatgeobuf<br>fixed or removed.  If removed, we'll  push flatgeobuf to PostGIS 3.3.0<br>cycle.<br><br>Thanks,<br>Regina<br><br><br>_______________________________________________<br>postgis-devel mailing list<br><a href="mailto:postgis-devel@lists.osgeo.org" target="_blank">postgis-devel@lists.osgeo.org</a><br><a href="https://lists.osgeo.org/mailman/listinfo/postgis-devel" target="_blank">https://lists.osgeo.org/mailman/listinfo/postgis-devel</a><u></u><u></u></p></blockquote></div></div></div></div><p class="MsoNormal">_______________________________________________<br>postgis-devel mailing list<br><a href="mailto:postgis-devel@lists.osgeo.org" target="_blank">postgis-devel@lists.osgeo.org</a><br><a href="https://lists.osgeo.org/mailman/listinfo/postgis-devel" target="_blank">https://lists.osgeo.org/mailman/listinfo/postgis-devel</a><u></u><u></u></p></blockquote></div><p class="MsoNormal">_______________________________________________<br>postgis-devel mailing list<br><a href="mailto:postgis-devel@lists.osgeo.org" target="_blank">postgis-devel@lists.osgeo.org</a><br><a href="https://lists.osgeo.org/mailman/listinfo/postgis-devel" target="_blank">https://lists.osgeo.org/mailman/listinfo/postgis-devel</a><u></u><u></u></p></blockquote></div></div></div></div></div></div>_______________________________________________<br>
postgis-devel mailing list<br>
<a href="mailto:postgis-devel@lists.osgeo.org" target="_blank">postgis-devel@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/postgis-devel" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/postgis-devel</a><br>
</blockquote></div></div>