Opened 19 years ago

Closed 18 years ago

#1278 closed defect (fixed)

multipolygons in GML while DescribeFeatureType says polygonProperty

Reported by: bartvde@… Owned by: mapserverbugs
Priority: high Milestone: 4.6 release
Component: WFS Server Version: 4.4
Severity: normal Keywords:
Cc:

Description

while testing a worldmap WFS set up with Mapserver against the Cadcorp SIS
Mapbrowser I ran into the following error:
 
In the DescribeFeatureType response Mapserver states:
 
<element ref="gml:polygonProperty" minOccurs="0"/>
 
But then in the actual GML some of the items are multipolygon:
 
<gml:polygonProperty>
  <gml:MultiPolygon srsName="EPSG:4326">
    <gml:polygonMember>
 
Cadcorp SIS Mapbrowser gives an error message about this.

Attachments (1)

bug1278.tgz (18.9 KB ) - added by bartvde@… 19 years ago.
Patch involving mapwfs.c and mapgml.c

Download all attachments as: .zip

Change History (18)

comment:1 by dmorissette, 19 years ago

Do you know what a WFS server is supposed to do in a case where a layer can
contain both polygons and multipolygons? Should we just revert to advertizing
gml:geometryProperty (or whatever the name is) instead of specific geometry
types in the DescribeFeatureType schema?

comment:2 by bartvde@…, 19 years ago

Hi Daniel,

good question. I am not in favour of gml:geometryProperty since we lose
information that way, to determine the type of layer. This is used eg by Chameleon.

But for sure the option I describe below also has disadvantages somewhere.

We could change to gml:multiPolygonProperty", it can contain:

<gml:multiPolygonProperty>
  <gml:MultiPolygon srsName="EPSG:4326">

and as many <gml:polygonMember> elements as needed. So for normal polygons just one.

What do you think?

Bart

comment:3 by bartvde@…, 19 years ago

I just made a fix against the 4.4.1 version and tested this. Will attach the
patch. It works perfectly now in Cadcorp SIS Mapbrowser. But ofcourse this would
also need to be done for Points and Lines.

by bartvde@…, 19 years ago

Attachment: bug1278.tgz added

Patch involving mapwfs.c and mapgml.c

comment:4 by bartvde@…, 19 years ago

Or is there gonna be a distinction in the Mapserver geometry model between
MULTIPOLYGON and POLYGON because of the GEOS integration?

comment:5 by dmorissette, 19 years ago

Cc: steve.lime@… added
I wouldn't think that GEOS will change anything to this, but the right person to
answer would be Steve.

comment:6 by sdlime, 19 years ago

GEOS needs the distinction itself but that's handled behind the scenes, in much 
the same way as the GML writer code does. You could process all features to 
figure out the layer "type" in a more specific fashion but that seems silly. I 
think we need to be able to allow the user to control the describeFeature 
output a bit more, for example by setting the core geometry type. There are a 
couple of other bugs dealing with GML3 L0 and application schema that will 
allow this. 

Steve

comment:7 by bartvde@…, 19 years ago

Steve,

but by letting the user set the core geometry type you have a chance of having
Mapserver WFS output invalid GML according to the schema. That remains an issue
then.

The safest way in my opinion is to output Multi type GML (MultiPolygon etc.) all
the time, even though there are no multipolygons in the layer.

Bart

comment:8 by sdlime, 19 years ago

I agree that a multipolygon is the best default choice. I still think we need 
to allow folks to override it in order to support application-level schema 
which may or may not allow multipart features.

Dan?

Steve

comment:9 by dmorissette, 19 years ago

If you allow users to control the geometry type at the schema level then we'd
also need more logic in mapgml.c to force the GML output to use the geometry
type specified by the user in the schema instead of using the automated geometry
type handling that we currently have.

comment:10 by sdlime, 19 years ago

Or we just trust users to know their data and enlightlen them in the 
documentation. They should be changing from the default without a darn good 
reason.

Steve

comment:11 by dmorissette, 19 years ago

Even if we trust users, that won't solve the issue of mixed geometry types (e.g.
polygon + multipolygon) being returned in the same layer, which is the issue
that was initially reported in this bug. If you allow users to force a layer to
a given geometry type, then there needs to be a filter on the specified geometry
type as a minimum in mapgml.c.

comment:12 by bartvde@…, 19 years ago

Hi Daniel,

but that could easily be solved by always using the Multi types in Mapserver 
DescribeFeatureType.

Question is, if a user specifies Polygon and his data is Point, do you want 
Mapserver to check that too, or is that part the user's responsibility?

Bart

comment:13 by dmorissette, 19 years ago

Always using multipolygon is probably what we'll have to do, but that's ugly.  :(

comment:14 by bartvde@…, 19 years ago

It can be ugly for situations in which there are only polygons in the dataset.
As soon as some of the geometries in the dataset start to be multipolygon, and
others are not, it is a necessary thing. 

Maybe it would be an idea to let users override MULTIPOLYGON when they know for
sure it only contains polygons (wfs_geometry_type METADATA)? Or maybe it will
become necessary to have Mapserver internal types like:

TYPE POLYGON
TYPE MULTIPOLYGON

It would be too expensive I think for Mapserver to scan all the data and see if
there are multipolygons in the dataset.

comment:15 by bartvde@…, 19 years ago

Milestone: 4.6 release
Are we able to make a decision on this and get this into 4.6?

comment:16 by sdlime, 19 years ago

I'd propose offering by default an xs:choice between the single and multi 
versions of the geometry types based on layer type, with the option for the 
user to exclude single or multiple types. They can't actually explicity set the 
type in the metadata because there are differences between GML schema versions 
(e.g. multipolygon vs. multisurface).

Steve

comment:17 by bartvde@…, 18 years ago

Resolution: fixed
Status: newclosed
This has been solved by Steve's recent changes in Mapserver WFS.

For completeness, you can now use something like:

          gml_geometries "provincies"
          gml_provincies_type "multipolygon"

Marking as FIXED.

Note: See TracTickets for help on using tickets.