MapServer / MapServer-import

3 stars 2 forks source link

multipolygons in GML while DescribeFeatureType says polygonProperty #1278

Open tbonfort opened 12 years ago

tbonfort commented 12 years ago

Reporter: bartvde@osgis.nl Date: 2005/03/08 - 19:14

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.
tbonfort commented 12 years ago

Author: dmorissette Date: 2005/03/08 - 19:37

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?
tbonfort commented 12 years ago

Author: bartvde@osgis.nl Date: 2005/03/08 - 20:15

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
tbonfort commented 12 years ago

Author: bartvde@osgis.nl Date: 2005/03/09 - 13:39

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.
tbonfort commented 12 years ago

Author: bartvde@osgis.nl Date: 2005/03/09 - 15:07

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

Author: dmorissette Date: 2005/03/09 - 16:06

I wouldn't think that GEOS will change anything to this, but the right person to
answer would be Steve.
tbonfort commented 12 years ago

Author: sdlime Date: 2005/03/09 - 19:01

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
tbonfort commented 12 years ago

Author: bartvde@osgis.nl Date: 2005/03/10 - 10:44

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
tbonfort commented 12 years ago

Author: sdlime Date: 2005/03/10 - 19:57

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
tbonfort commented 12 years ago

Author: dmorissette Date: 2005/03/10 - 22:29

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.
tbonfort commented 12 years ago

Author: sdlime Date: 2005/03/10 - 22:55

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
tbonfort commented 12 years ago

Author: dmorissette Date: 2005/03/22 - 19:58

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.
tbonfort commented 12 years ago

Author: bartvde@osgis.nl Date: 2005/03/22 - 20:16

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
tbonfort commented 12 years ago

Author: dmorissette Date: 2005/03/22 - 20:21

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

Author: bartvde@osgis.nl Date: 2005/03/24 - 15:14

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.
tbonfort commented 12 years ago

Author: bartvde@osgis.nl Date: 2005/05/10 - 16:46

Are we able to make a decision on this and get this into 4.6?
tbonfort commented 12 years ago

Author: sdlime Date: 2005/05/10 - 18:03

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
tbonfort commented 12 years ago

Author: bartvde@osgis.nl Date: 2006/01/09 - 20:13

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.