[MapServer-users] FlatGeobuf as output format

Rahkonen Jukka jukka.rahkonen at maanmittauslaitos.fi
Thu Jun 22 01:44:05 PDT 2023


Hi,

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 https://github.com/OSGeo/gdal/issues/2828


By reading https://mapserver.org/output/ogr_output.html the geometry type could be set at LAYER level with
"ows_geomtype" "MultiPolygon"

-Jukka Rahkonen-

Lähettäjä: MapServer-users <mapserver-users-bounces at lists.osgeo.org> Puolesta Benedek Petrovicz
Lähetetty: torstai 22. kesäkuuta 2023 11.17
Vastaanottaja: Scott <public at postholer.com>
Kopio: mapserver-users at lists.osgeo.org
Aihe: Re: [MapServer-users] FlatGeobuf as output format

I'm not trying to create any fgb-s, but MapServer is.
And the issue is with MultiPolygons, so converting everything to that type doesn't help.

The data source is not fgb. It can be anything.
It is an MSSQL DB in my instance.

Btw, converting the same dataset to fgb manually with ogr2ogr does work, and it doesn't require any extra parameters.
Isn't MapServer using ogr2ogr functionality for OGR based OUTPUTFORMATs?

I feel like it could handle it, but just hangs up because it sees MultiPolygon when checking the type.

On Wed, Jun 21, 2023 at 6:43 PM Scott <public at postholer.com<mailto:public at postholer.com>> wrote:
I'm not sure how you're creating your fgb's, but from an ogr2ogr context
try promoting all geoms to multi:

-nlt PROMOTE_TO_MULTI

On 6/21/23 07:50, Benedek Petrovicz wrote:
> Hi!
>
> I'm trying to integrate OGR's FlatGeobuf driver as an output format in
> my mapfiles.
> It works for the most part and it's awesome, but it fails immediately
> when I feed some MultiPolygons into it.
>
> The geometries are queried from an MSSQL DB.
>
> I get the following error:
> msOGRWriteShape(): OGR error. Attempt to write feature failed (code=6):
> ICreateFeature: Mismatched geometry type msCalculateScale(): General
> error message. Invalid image width or height.
>
> I found a little note in the docs which corresponds with this issue
> (https://mapserver.org/input/vector/ogr.html
> <https://mapserver.org/input/vector/ogr.html>):
> /"Even though MapInfo and other OGR data sources may support layers with
> mixed geometry types (e.g. points, lines and polygons in the same file)
> this is not yet supported in MapServer. So you still have to define a
> layer ‘TYPE’ and make sure that all the shapes in the OGR data source
> are compatible with that layer type, otherwise MapServer may produce an
> error about incompatible geometry types at runtime."/
> /
> /
> So it fails for me when I have Polygons and MultiPolygons in the table
> I'm querying.
> But it also fails if it includes MultiPolygons only. So with no mixing
> of types.
>
> I'm using the POLYGON type for my layer in the mapfile.
>
> The same dataset works fine when I'm using the GML2 output format. Even
> with mixing Polygons and MultiPolygons.
>
> Am I doing something wrong here?
> Is it a known limitation for MultiPolygons?
> Is there a way to bypass the issue while retaining the geometries in the DB?
>
> Thank you
> Petrovicz
>
> _______________________________________________
> MapServer-users mailing list
> MapServer-users at lists.osgeo.org<mailto:MapServer-users at lists.osgeo.org>
> https://lists.osgeo.org/mailman/listinfo/mapserver-users
_______________________________________________
MapServer-users mailing list
MapServer-users at lists.osgeo.org<mailto:MapServer-users at lists.osgeo.org>
https://lists.osgeo.org/mailman/listinfo/mapserver-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20230622/e1b2618c/attachment.htm>


More information about the MapServer-users mailing list