[mapserver-users] MultiPolygon layer requested as GeoJSON is returned as Polygon

Peter Schmitt pschmitt at gmail.com
Mon Jan 8 11:50:11 PST 2018


Thanks Steve.  Yes, ows_geomtype=Geometry does the trick!

You're right -- it seems with layer TYPE=polygon, the OGR output is coerced
to a Polygon rather than MultiPolygon for this case:
https://github.com/mapserver/mapserver/blob/2c1e5c50791cac205cfbeed0e1fa98bb421f5c5c/mapogroutput.c#L908-L923

My mental model was that the METADATA block only gave hints to what should
be reported in GetCapabilities requests.

Thanks again,
Pete

On Mon, Jan 8, 2018 at 12:07 PM, Lime, Steve D (MNIT) <
steve.lime at state.mn.us> wrote:

> Hi Peter: Adding the following metadata to the layer returns a
> multipolygon for me:
>
>
>
>         METADATA
>
>             "ows_geomtype"  "Geometry"
>
>         END
>
>
>
> Without specific direction on geometry type it may be that MapServer is
> capitalizing on the layer type or something like that.
>
>
>
> Steve
>
>
>
> *From:* mapserver-users [mailto:mapserver-users-bounces at lists.osgeo.org] *On
> Behalf Of *Peter Schmitt
> *Sent:* Friday, January 05, 2018 12:09 PM
> *To:* mapserver-users at lists.osgeo.org
> *Subject:* [mapserver-users] MultiPolygon layer requested as GeoJSON is
> returned as Polygon
>
>
>
> Hi,
>
>
>
> I have a layer with one MultiPolygon feature.  I issue a request for the
> layer as GeoJSON, like so:
>
>
>
> curl "http://localhost/mapserv?MAP=/usr/src/mapfiles/busted.map&
> service=WFS&VERSION=1.1.0&REQUEST=getfeature&typename=
> should_be_multi&OUTPUTFORMAT=geojson"
>
>
>
> In response, I get a single feature, but it has been converted to a
> Polygon.
>
>
>
> {
>
>    "type": "FeatureCollection", "name": "should_be_multi", "features": [
>
>       { "type": "Feature", "properties": { }, "geometry": { "type":
> "Polygon", "coordinates": ... } }
>
>    ]
>
> }
>
>
>
> The returned polygon has interior rings, one of which should actually be a
> separate polygon with its own interior rings.  I think this is wrong and
> the geometry type returned by MapServer should be MultiPolygon.  Can anyone
> help me understand what is going on?
>
>
>
> Here's the feature as a MultiPolygon I expected to receive:
>
> http://bl.ocks.org/d/640884687326af5d123a5fc761884e3d
>
> http://bl.ocks.org/d/640884687326af5d123a5fc761884e3d/map.geojson
>
>
>
> Here's my MAP file:
>
> https://gist.github.com/pedros007/f685d8d336c77aff4cc56673b85f6672
>
>
>
> Thanks,
>
> Pete
>



-- 
Pete
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20180108/d124aab7/attachment.htm>


More information about the MapServer-users mailing list