[OpenLayers-Dev] Format GML 3 issue?

Julien Jeudy julien.jeudy at magellium.fr
Mon Jan 4 03:51:39 EST 2010


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:

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




More information about the Dev mailing list