[OpenLayers-Dev] Format GML 3 issue?

Julien Jeudy julien.jeudy at magellium.fr
Tue Jan 5 05:24:28 EST 2010


Hello Tim,

Thanks for your answer. You're right, I did not notice the schema reference.
Sorry.

The WFS server I using is base on the GML 3 schema by default :
http://schemas.opengis.net/gml/3.1.1/base/gml.xsd where gml:pos is accept
for gml:LinearRing (in geometryBasic2d.xsd). But It's possible for me to use
GML SF. So I will follow your recommendation.

Best Regards,
Julien

-----Message d'origine-----
De : dev-bounces at openlayers.org [mailto:dev-bounces at openlayers.org] De la
part de Tim Schaub
Envoyé : lundi 4 janvier 2010 23:14
À : dev at openlayers.org
Objet : Re: [OpenLayers-Dev] Format GML 3 issue?

Julien Jeudy wrote:
> Dear all,
> 
> I have a doubt on a GML 3 OpenLayers format issue (from a WFS 1.1.0).
> 
> In GML there are two ways to list polygons points:
> 

Rrrr.

I wrote the GML 3 parser based on the GML Simple Features Profile.

Quoting from OGC® 06-049r1 8.4.4.10.2 a):

"""
in all cases, geometry coordinates shall only be specified using the 
gml:pos for gml:Point or gml:posList elements for all other types
"""

Our parser references the schema:
http://schemas.opengis.net/gml/3.1.1/profiles/gmlsfProfile/1.0.0/gmlsf.xsd

That defines LinearRingType with posList only.

I know we are generally good about being "liberal in what we accept," 
but I also like that the parser doesn't account for all the complex 
legacy of GML.

I'd be curious to hear if your server can be coerced to follow the 
simple features profile.  This is generally safer as there are many 
things that we don't currently support outside the simple features profile.

http://trac.openlayers.org/ticket/2396

As suggested there, I'd like to hear exactly what we want to support 
before adding too many conditions to this parser (and I think it would 
be better to have subclasses targeted at specific versions/profiles).

Tim

> 1. a unique posList element: the following geom is correctly transform
from
> GML3 to OpenLayers geometry
>
<gml:surfaceMember><gml:Polygon><gml:exterior><gml:LinearRing><gml:posList>-
> 8427711.443672495 4658480.583807316 -8428116.646618983 4671596.358484082
> -8429661.427192722 4697373.995504196 -8432776.70314257 .
> 
> 2. a list of pos elements: But this geom is not correctly transform
> <gml:Surface
>
srsName="EPSG:900913"><gml:patches><gml:PolygonPatch><gml:exterior><gml:Line
> arRing srsName="EPSG:900913">
>                 <gml:pos>3944245.09999984 3978948.409156078</gml:pos>
>                 <gml:pos>3944282.8999998407 3978974.7107042107</gml:pos> .
> 
> I think it's due to this part of code (from trunk -
> OpenLayers.Format.GML.v3.js). Because on each iteration of gml pos the
> points array is erased.
> 		"pos": function(node, obj) {
>                 var str = this.getChildValue(node).replace(
>                     this.regExes.trimSpace, ""
>                 );
>                 var coords = str.split(this.regExes.splitSpace);
>                 var point;
>                 if(this.xy) {
>                     point = new OpenLayers.Geometry.Point(
>                         coords[0], coords[1], coords[2]
>                     );
>                 } else {
>                     point = new OpenLayers.Geometry.Point(
>                         coords[1], coords[0], coords[2]
>                     );
>                 }
>                 obj.points = [point];
>             },
> 
> Does anyone know whether the GML is not conform or if it's possible to
> propose a patch?
> If it's not a GML conformity issue, I think that the following patch can
> solve the problem but I'm not sure it's the best way:
> 	"pos": function(node, obj) {
> 		...
> 		if(obj.points) {
>                 	obj.points.push(point);
>             } else {
>                 	obj.points = [point];
>             }
> 	}
> 
> thanks,
> Julien
> 
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev


-- 
Tim Schaub
OpenGeo - http://opengeo.org
Expert service straight from the developers.
_______________________________________________
Dev mailing list
Dev at openlayers.org
http://openlayers.org/mailman/listinfo/dev




More information about the Dev mailing list