<div dir="ltr">That "

ows_geomtype" actually solved my problem.<div>Thank you!</div><div><br></div><div>The reason I wrote that the promote_to_multi option won't help me is exactly because the layer was still telling GDAL that it was a polygon layer.</div><div>It was what I thought, that GDAL is capable of doing the conversion, it just didn't get the correct layer type info.</div><div><br></div><div>Thanks again!</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jun 22, 2023 at 10:44 AM Rahkonen Jukka <<a href="mailto:jukka.rahkonen@maanmittauslaitos.fi">jukka.rahkonen@maanmittauslaitos.fi</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 class="msg2539173770146245514">





<div lang="FI" style="overflow-wrap: break-word;">
<div class="m_2539173770146245514WordSection1">
<p class="MsoNormal"><span>Hi,<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">GDAL gives typically that kind of multipolygon error when the driver tries to insert a multipolygon into a layer that is created to accept only polygons. In that case casting all geometries
 into multipolygons really helps: the layer gets created to accept multipolygons, simple polygons are converted into multipolygons with one member, and multipolygons are saved as they are. I am not sure if this is the problem that you have, just want to clarify
 that the suggested fix makes sense. See also <a href="https://github.com/OSGeo/gdal/issues/2828" target="_blank">
https://github.com/OSGeo/gdal/issues/2828</a><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">By reading
<a href="https://mapserver.org/output/ogr_output.html" target="_blank">https://mapserver.org/output/ogr_output.html</a> the geometry type could be set at LAYER level with<br>
"ows_geomtype" "MultiPolygon"<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">-Jukka Rahkonen-<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0cm 0cm">
<p class="MsoNormal"><b>Lähettäjä:</b> MapServer-users <<a href="mailto:mapserver-users-bounces@lists.osgeo.org" target="_blank">mapserver-users-bounces@lists.osgeo.org</a>>
<b>Puolesta </b>Benedek Petrovicz<br>
<b>Lähetetty:</b> torstai 22. kesäkuuta 2023 11.17<br>
<b>Vastaanottaja:</b> Scott <<a href="mailto:public@postholer.com" target="_blank">public@postholer.com</a>><br>
<b>Kopio:</b> <a href="mailto:mapserver-users@lists.osgeo.org" target="_blank">mapserver-users@lists.osgeo.org</a><br>
<b>Aihe:</b> Re: [MapServer-users] FlatGeobuf as output format<u></u><u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">I'm not trying to create any fgb-s, but MapServer is.<u></u><u></u></p>
<div>
<p class="MsoNormal">And the issue is with MultiPolygons, so converting everything to that type doesn't help.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">The data source is not fgb. It can be anything.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">It is an MSSQL DB in my instance.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Btw, converting the same dataset to fgb manually with ogr2ogr does work, and it doesn't require any extra parameters.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Isn't MapServer using ogr2ogr functionality for OGR based OUTPUTFORMATs?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I feel like it could handle it, but just hangs up because it sees MultiPolygon when checking the type.<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">On Wed, Jun 21, 2023 at 6:43 PM Scott <<a href="mailto:public@postholer.com" target="_blank">public@postholer.com</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm">
<p class="MsoNormal">I'm not sure how you're creating your fgb's, but from an ogr2ogr context
<br>
try promoting all geoms to multi:<br>
<br>
-nlt PROMOTE_TO_MULTI<br>
<br>
On 6/21/23 07:50, Benedek Petrovicz wrote:<br>
> Hi!<br>
> <br>
> I'm trying to integrate OGR's FlatGeobuf driver as an output format in <br>
> my mapfiles.<br>
> It works for the most part and it's awesome, but it fails immediately <br>
> when I feed some MultiPolygons into it.<br>
> <br>
> The geometries are queried from an MSSQL DB.<br>
> <br>
> I get the following error:<br>
> msOGRWriteShape(): OGR error. Attempt to write feature failed (code=6): <br>
> ICreateFeature: Mismatched geometry type msCalculateScale(): General <br>
> error message. Invalid image width or height.<br>
> <br>
> I found a little note in the docs which corresponds with this issue <br>
> (<a href="https://mapserver.org/input/vector/ogr.html" target="_blank">https://mapserver.org/input/vector/ogr.html</a>
<br>
> <<a href="https://mapserver.org/input/vector/ogr.html" target="_blank">https://mapserver.org/input/vector/ogr.html</a>>):<br>
> /"Even though MapInfo and other OGR data sources may support layers with <br>
> mixed geometry types (e.g. points, lines and polygons in the same file) <br>
> this is not yet supported in MapServer. So you still have to define a <br>
> layer ‘TYPE’ and make sure that all the shapes in the OGR data source <br>
> are compatible with that layer type, otherwise MapServer may produce an <br>
> error about incompatible geometry types at runtime."/<br>
> /<br>
> /<br>
> So it fails for me when I have Polygons and MultiPolygons in the table <br>
> I'm querying.<br>
> But it also fails if it includes MultiPolygons only. So with no mixing <br>
> of types.<br>
> <br>
> I'm using the POLYGON type for my layer in the mapfile.<br>
> <br>
> The same dataset works fine when I'm using the GML2 output format. Even <br>
> with mixing Polygons and MultiPolygons.<br>
> <br>
> Am I doing something wrong here?<br>
> Is it a known limitation for MultiPolygons?<br>
> Is there a way to bypass the issue while retaining the geometries in the DB?<br>
> <br>
> Thank you<br>
> Petrovicz<br>
> <br>
> _______________________________________________<br>
> MapServer-users mailing list<br>
> <a href="mailto:MapServer-users@lists.osgeo.org" target="_blank">MapServer-users@lists.osgeo.org</a><br>
> <a href="https://lists.osgeo.org/mailman/listinfo/mapserver-users" target="_blank">
https://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br>
_______________________________________________<br>
MapServer-users mailing list<br>
<a href="mailto:MapServer-users@lists.osgeo.org" target="_blank">MapServer-users@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/mapserver-users" target="_blank">https://lists.osgeo.org/mailman/listinfo/mapserver-users</a><u></u><u></u></p>
</blockquote>
</div>
</div>
</div>

</div></blockquote></div>