<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=iso-8859-1">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><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;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
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="DA" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US">Hi<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I'm migrating from calling native MiTAB operations for exporting features to a MapInfo TAB file to using GDAL and the MapInfo driver. I'm using C# and MaxRev.Gdal.Core package (and MaxRev.Gdal.WindowsRuntime.Minimal)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><a href="https://github.com/MaxRev-Dev/gdal.netcore">https://github.com/MaxRev-Dev/gdal.netcore</a>
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">But when I try to export features that has geometry collections with mixed geometry types, GDAL creates multiple features in the TAB file.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">If I try a feature with a collection of polygons, all is good too.. 1 feature with 2 polygons.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">My old code calling MiTAB directly works fine.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Simple code showing the issue<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">{<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> // Register the OGR library<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> Ogr.RegisterAll();<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> // Create a new MapInfo Tab file<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> DataSource ds = Ogr.GetDriverByName("MapInfo File").CreateDataSource(@"c:\temp\playground.tab", null);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> // Create a layer<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> Layer layer = ds.CreateLayer("layer", null, wkbGeometryType.wkbUnknown, null);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> // Create a feature<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> Feature feature = new Feature(layer.GetLayerDefn());<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> // Create a MultiGeometry<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> Geometry multiGeometry = new Geometry(wkbGeometryType.wkbGeometryCollection);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> // Add polygons and polylines to the MultiGeometry<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> Geometry polygonGeometry = Geometry.CreateFromWkt("POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0))");<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> Geometry polylineGeometry = Geometry.CreateFromWkt("LINESTRING (2 0, 3 0, 3 1, 2 1)");<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> multiGeometry.AddGeometry(polygonGeometry);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> multiGeometry.AddGeometry(polylineGeometry);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> // Set the MultiGeometry as the feature's geometry<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> feature.SetGeometryDirectly(multiGeometry);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> // Create the feature in the layer<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> layer.CreateFeature(feature);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> // Cleanup<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> feature.Dispose();<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> ds.Dispose();<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">}<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I have asked this question on gis.stackexchange too which lead to this mail. Here a user tried the same simple test without using MaxRev’s version and came to the same result.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><a href="https://gis.stackexchange.com/questions/474496/using-gdal-maxrev-gdal-to-write-tab-files-with-mixed-geometry">https://gis.stackexchange.com/questions/474496/using-gdal-maxrev-gdal-to-write-tab-files-with-mixed-geometry</a>
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<div>
<div>
<p class="MsoNormal"><span lang="NO-BOK" style="font-size:10.0pt;mso-fareast-language:DA">Med venlig hilsen<o:p></o:p></span></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span lang="NO-BOK" style="mso-fareast-language:DA"> <o:p></o:p></span></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><b><span lang="NO-BOK" style="font-size:10.0pt;mso-fareast-language:DA">Michael Tjener Pallesen</span></b><span lang="NO-BOK" style="font-size:10.0pt;mso-fareast-language:DA"><o:p></o:p></span></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;mso-fareast-language:DA">Softwareudvikler<o:p></o:p></span></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="mso-fareast-language:DA"> <o:p></o:p></span></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span lang="EN-US"><img border="0" width="85" height="30" style="width:.8854in;height:.3125in" id="Picture_x0020_1" src="cid:image001.png@01DA4A1C.9FB4D8E0"></span><span style="mso-fareast-language:DA"><o:p></o:p></span></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="mso-fareast-language:DA"> <o:p></o:p></span></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9.0pt;mso-fareast-language:DA">Ceres Allé 3<o:p></o:p></span></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9.0pt;mso-fareast-language:DA">8000 Aarhus C<o:p></o:p></span></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9.0pt;mso-fareast-language:DA">Denmark<o:p></o:p></span></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9.0pt;mso-fareast-language:DA"><a href="https://www.niras.dk/?utm_campaign=e-mail-signatur&utm_source=internal&utm_medium=e-mail&utm_content=e-mail-signatur-dk"><span style="color:black;text-decoration:none">www.niras.dk</span></a><o:p></o:p></span></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="mso-fareast-language:DA"> <o:p></o:p></span></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span lang="DE" style="font-size:9.0pt;mso-fareast-language:DA">M: +45 3085 0906<br>
L: +45 8732 5808<br>
T: +45 8732 3232<o:p></o:p></span></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span lang="DE" style="font-size:9.0pt;mso-fareast-language:DA">E:
</span><span style="font-size:9.0pt;mso-fareast-language:DA"><a href="mailto:mtp@niras.dk"><span lang="DE" style="color:black;text-decoration:none">mtp@niras.dk</span></a></span><span lang="DE" style="font-size:9.0pt;mso-fareast-language:DA"><o:p></o:p></span></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span lang="DE" style="mso-fareast-language:DA"> <o:p></o:p></span></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:9.0pt;mso-fareast-language:DA">Følg os på:
<o:p></o:p></span></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><a href="https://www.linkedin.com/company/niras/mycompany/verification/" target="_blank"><span lang="EN-US" style="color:windowtext;text-decoration:none"><img border="0" width="24" height="24" style="width:.25in;height:.25in" id="Picture_x0020_2" src="cid:image002.jpg@01DA4A1C.9FB4D8E0"></span></a><span style="mso-fareast-language:DA">
</span><a href="https://www.facebook.com/NIRASGroup" target="_blank"><span lang="EN-US" style="color:windowtext;text-decoration:none"><img border="0" width="24" height="24" style="width:.25in;height:.25in" id="Picture_x0020_3" src="cid:image003.jpg@01DA4A1C.9FB4D8E0"></span></a><span style="mso-fareast-language:DA"><o:p></o:p></span></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="mso-fareast-language:DA"> <o:p></o:p></span></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span lang="EN-US"><img border="0" width="309" height="42" style="width:3.2187in;height:.4375in" id="Picture_x0020_4" src="cid:image004.png@01DA4A1C.9FB4D8E0"></span><span style="mso-fareast-language:DA"><o:p></o:p></span></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="mso-fareast-language:DA"> <o:p></o:p></span></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt;line-height:115%"><i><span style="font-size:8.0pt;line-height:115%;color:#A6A6A6;mso-fareast-language:DA">Denne e-mail kan indeholde fortrolige oplysninger. Hvis du fejlagtigt har<br>
modtaget denne, kontakt venligst afsenderen øjeblikkeligt og slet mailen<br>
samt eventuelle bilag. Kopier ikke denne mail, og undlad at dele dens<br>
indhold med tredje part. Tak. NIRAS’ håndtering af personlig information<br>
står beskrevet i vores </span></i><i><span lang="NO-BOK" style="font-size:8.0pt;line-height:115%;color:#A6A6A6;mso-fareast-language:DA"><a href="https://www.niras.dk/privacy-policy/"><span lang="DA" style="color:black;text-decoration:none">privatlivspolitik.</span></a></span></i><span style="font-size:8.0pt;line-height:115%;color:#A6A6A6;mso-fareast-language:DA"><br>
<br>
</span><o:p></o:p></p>
</div>
</div>
</div>
</body>
</html>