<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Andrew,</p>
    <p>Can you paste the output of<br>
    </p>
    <p>ogrinfo -al -so PG:"dbname=dbname port=5432 host=dbhost
      user=dbusr" --optfile sql_filter.sql</p>
    <p>so we can see the layer geometry type. I presume it is unknown.</p>
    <p>GeoPackage supports geometry columns with unknown geometry type.</p>
    <p>Shapefile requires a precise geometry type, but the shapefile
      driver has a heuristics to use the geometry type of the first
      feature as the layer geometry type, when the declared layer
      geometry type is unknown. The OpenFileGDB driver doesn't have that
      heuristics.<br>
    </p>
    <p>It is likely you need to add an explicit -nlt POLYGON or -nlt
      MULTIPOLYGON to your ogr2ogr invokation</p>
    <p>Even<br>
    </p>
    <p><br>
    </p>
    <div class="moz-cite-prefix">Le 11/11/2022 à 14:53, Andrew Terry a
      écrit :<br>
    </div>
    <blockquote type="cite"
cite="mid:AM6PR01MB49467E091B8F0E7873395177A1009@AM6PR01MB4946.eurprd01.prod.exchangelabs.com">
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <div class="WordSection1">
        <p class="MsoNormal">Hi,</p>
        <p class="MsoNormal"> </p>
        <p class="MsoNormal">Trying out the export to OpenFileGDB, using
          GDAL 3.7.0dev-5a6f99a78b installed with OSGeo4W</p>
        <p class="MsoNormal"> </p>
        <p class="MsoNormal">ogr2ogr -f "OpenFileGDB" test_filegdb.gdb
          PG:"dbname=dbname port=5432 host=dbhost user=dbusr" --optfile
          sql_filter.sql</p>
        <p class="MsoNormal"> </p>
        <p class="MsoNormal">This works for SHP and GeoPackage and the
          output is a EPSG 27700 Polygon geometries.</p>
        <p class="MsoNormal"> </p>
        <p class="MsoNormal">I get the following error:</p>
        <p class="MsoNormal"> </p>
        <p class="MsoNormal">ERROR 6: Unsupported geometry type</p>
        <p class="MsoNormal">ERROR 1: Terminating translation
          prematurely after failed</p>
        <p class="MsoNormal">translation from sql statement.</p>
        <p class="MsoNormal"><span> </span></p>
        <p class="MsoNormal"><span>What geometry type is expected? I did
            try ST_Multi and ST_Force3D to see whether multipolygons etc
            are expected.</span></p>
        <p class="MsoNormal"><span> </span></p>
        <p class="MsoNormal"><span>Hopefully I’m not missing something
            too obvious.</span></p>
        <p class="MsoNormal"><span> </span></p>
        <p class="MsoNormal"><span>Thanks</span></p>
        <p class="MsoNormal"><span> </span></p>
        <p class="MsoNormal"><span>Andy</span></p>
        <p class="MsoNormal"> </p>
      </div>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
gdal-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
  </body>
</html>