<div dir="ltr">Have you tried -nlt MultiPolygon?</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jul 25, 2022 at 2:54 AM Bo Victor Thomsen <<a href="mailto:bo.victor.thomsen@gmail.com">bo.victor.thomsen@gmail.com</a>> wrote:<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>
<p>I have a MapInfo .tab file containing polygons, both simple and
multipolygons (and only polygons).</p>
<p>Using this command: (all ogr2ogr commands are one-liners, but
examples are split for lucidity)<br>
</p>
<p><font face="monospace">ogr2ogr <br>
--config PG_USE_COPY yes <br>
-progress <br>
-lco OVERWRITE=YES <br>
-dim XY <br>
-f "PostgreSQL" PG:"host=localhost port=5432 user=***
password=*** dbname=geodata" <br>
FREDSKOV.TAB<br>
</font></p>
<p>will (correctly) create a table in Postgres of PostGIS type
"Geometry" <br>
</p>
<p>If I change the command to:</p>
<p><font face="monospace">ogr2ogr <br>
--config PG_USE_COPY yes <br>
-progress <br>
-lco OVERWRITE=YES <br>
-dim XY <br>
<b> -nlt PROMOTE_TO_MULTI</b><br>
-f "PostgreSQL" PG:"host=localhost port=5432 user=***
password=*** dbname=geodata" <br>
FREDSKOV.TAB</font></p>
<p>I would expect the table to change the PostGIS type to
"MultiPolygon". However it still is registered as "Geometry".<br>
</p>
<p>Checking the table using SQL command:</p>
<p><font face="monospace">SELECT ST_geometrytype(wkb_geometry),
count(*) FROM mat.fredskov group by 1</font></p>
<p>affirms, that all geometries now is of type "ST_MultiPolygon".</p>
<p>AFAIK, this is a new behaviour. Or what ? <br>
</p>
<p>Postgres/Postgis version : 13.2, 3.1 <br>
</p>
<p>OGR2OGR version: both 3.4 andf 3.6 dev.<br>
</p>
<p><br>
</p>
<p><br>
</p>
<p><br>
</p>
<pre cols="72">--
Med venlig hilsen / Kind regards
Bo Victor Thomsen</pre>
</div>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr">Richard W. Greenwood<br><a href="http://www.greenwoodmap.com" target="_blank">www.greenwoodmap.com</a></div></div>