<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Aptos;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Aptos",sans-serif;
        mso-ligatures:standardcontextual;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#467886;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        font-size:10.0pt;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        mso-ligatures:standardcontextual;}
span.EmailStyle22
        {mso-style-type:personal-reply;
        font-family:"Aptos",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;
        mso-ligatures:none;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#467886" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Ah, easy <span style="font-family:"Segoe UI Emoji",sans-serif">
😊</span><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-family:"Calibri",sans-serif;mso-ligatures:none">From:</span></b><span style="font-family:"Calibri",sans-serif;mso-ligatures:none"> Even Rouault <even.rouault@spatialys.com>
<br>
<b>Sent:</b> Monday, July 22, 2024 8:30 PM<br>
<b>To:</b> Joaquim Manuel Freire Luís <jluis@ualg.pt>; gdal-dev@lists.osgeo.org<br>
<b>Subject:</b> Re: [gdal-dev] Extracting data from a parquet file<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p><o:p> </o:p></p>
<div>
<p class="MsoNormal">Le 22/07/2024 à 21:10, Joaquim Manuel Freire Luís a écrit :<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal">Even,<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Thanks for the explanation. But how did you find the name of the geometries (geo_point_2D and geo_shape)? Loading the “world-administrative-boundaries.parquet” in a binary editor I can see them there, but that’s certainly not the way to
 find these things.<o:p></o:p></p>
</blockquote>
<p class="MsoNormal"><span style="font-size:12.0pt;mso-ligatures:none">$ ogrinfo world-administrative-boundaries.parquet -al -so | grep "Geometry Column"<br>
Geometry Column 1 = geo_point_2d<br>
Geometry Column 2 = geo_shape<br>
<br>
<br>
<o:p></o:p></span></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Joaquim<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-family:"Calibri",sans-serif;mso-ligatures:none">From:</span></b><span style="font-family:"Calibri",sans-serif;mso-ligatures:none"> Even Rouault
<a href="mailto:even.rouault@spatialys.com"><even.rouault@spatialys.com></a> <br>
<b>Sent:</b> Monday, July 22, 2024 2:29 PM<br>
<b>To:</b> Joaquim Manuel Freire Luís <a href="mailto:jluis@ualg.pt"><jluis@ualg.pt></a>;
<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><br>
<b>Subject:</b> Re: [gdal-dev] Extracting data from a parquet file</span><o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"> <o:p></o:p></p>
<p>Joaquim,<o:p></o:p></p>
<p>The GeoPackage format only supports one geometry field per layer. and the QGIS OGR provider doesn't know currently how to handle several geometry fields per layer too<o:p></o:p></p>
<p>To do what you want, you need to explictly select the desired geometry field name with:<o:p></o:p></p>
<p>ogr2ogr out.gpkg world-administrative-boundaries.parquet -sql "select geo_shape, * from \"world-administrative-boundaries\""<o:p></o:p></p>
<p>Actually if you outputted to a format that supports several geometry fields per layer (let's say PostGIS), the above wouldn't work. You would need to exclude the geometry fields from the wildcard * selection with:<o:p></o:p></p>
<p style="margin-bottom:12.0pt">ogr2ogr out.gpkg  world-administrative-boundaries.parquet -sql "select geo_shape, * exclude (geo_point_2D, geo_shape) from \"world-administrative-boundaries\""<o:p></o:p></p>
<p>Even<o:p></o:p></p>
<div>
<p class="MsoNormal">Le 19/07/2024 à 16:58, Joaquim Manuel Freire Luís via gdal-dev a écrit :<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span lang="PT">Hi,</span><o:p></o:p></p>
<p class="MsoNormal"><span lang="PT"> </span><o:p></o:p></p>
<p class="MsoNormal">I finally managed to build a working GDAL with the arrow/parquet driver and I’m now trying to convert this file<o:p></o:p></p>
<p class="MsoNormal">(<a href="https://public.opendatasoft.com/api/explore/v2.1/catalog/datasets/world-administrative-boundaries/exports/parquet?lang=en&timezone=Europe%2FLondon">https://public.opendatasoft.com/api/explore/v2.1/catalog/datasets/world-administrative-boundaries/exports/parquet?lang=en&timezone=Europe%2FLondon</a>)<o:p></o:p></p>
<p class="MsoNormal">but can only extract the “Point”, not the “Multi polygon”<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">ogrinfo world-administrative-boundaries.parquet<o:p></o:p></p>
<p class="MsoNormal">INFO: Open of `world-administrative-boundaries.parquet'<o:p></o:p></p>
<p class="MsoNormal">      using driver `Parquet' successful.<o:p></o:p></p>
<p class="MsoNormal">1: world-administrative-boundaries (Point, Multi Polygon)<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">This gets only the points<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">ogr2ogr lixo.gpkg world-administrative-boundaries.parquet<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">The same happens if I open the file in QGis. Points only, no polygons.<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">But if I do an ogrinfo -al, it prints all data in file.<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">ogrinfo -al world-administrative-boundaries.parquet<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">….<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">OGRFeature(world-administrative-boundaries):255<o:p></o:p></p>
<p class="MsoNormal">  iso3 (String) = GIB<o:p></o:p></p>
<p class="MsoNormal">  status (String) = UK Non-Self-Governing Territory<o:p></o:p></p>
<p class="MsoNormal">  color_code (String) = GBR<o:p></o:p></p>
<p class="MsoNormal">  name (String) = Gibraltar<o:p></o:p></p>
<p class="MsoNormal">…<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">So, how can we select in ogr2ogr to extract the polygons?<o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:12.0pt;mso-ligatures:none"><br>
<br>
<br>
</span><o:p></o:p></p>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>gdal-dev mailing list<o:p></o:p></pre>
<pre><a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a><o:p></o:p></pre>
<pre><a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><o:p></o:p></pre>
</blockquote>
<pre>-- <o:p></o:p></pre>
<pre><a href="http://www.spatialys.com">http://www.spatialys.com</a><o:p></o:p></pre>
<pre>My software is free, but my time generally not.<o:p></o:p></pre>
</blockquote>
<pre>-- <o:p></o:p></pre>
<pre><a href="http://www.spatialys.com">http://www.spatialys.com</a><o:p></o:p></pre>
<pre>My software is free, but my time generally not.<o:p></o:p></pre>
</div>
</body>
</html>