<html><body><div style="font-family: garamond,new york,times,serif; font-size: 12pt; color: #000000"><div>Hi,</div><div><br data-mce-bogus="1"></div><div>I guess you should either</div><div>=> drop the created table prior to launch the ogr2ogr command with the -nlt PROMOTE_TO_MULTI switch</div><div>=> or maually alter the existing table: ALTER TABLE schema.table ALTER COLUMN geom TYPE geometry(MultiPolygon, SRID) using ST_MULTI(geom)</div><div><br data-mce-bogus="1"></div><div>HTH,</div><div>Hug</div><div><br></div><div data-marker="__SIG_PRE__"><div></div></div><div><br data-mce-bogus="1"></div><hr id="zwchr" data-marker="__DIVIDER__"><div data-marker="__HEADERS__"><b>De: </b>"Richard Greenwood" <richard.greenwood@gmail.com><br><b>À: </b>"Bo Victor Thomsen" <bo.victor.thomsen@gmail.com><br><b>Cc: </b>"gdal dev" <gdal-dev@lists.osgeo.org><br><b>Envoyé: </b>Lundi 25 Juillet 2022 15:32:35<br><b>Objet: </b>Re: [gdal-dev] New behaviour of "PROMOTE_TO_MULTI" ?<br></div><div><br></div><div data-marker="__QUOTED_TEXT__"><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" target="_blank">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>--
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"><br>-- <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>
<br><br>[Fichier texte:ATT00001]<br></div></div></body></html>