[OpenLayers-Users] Format GML 3 issue?

Eric Lemoine eric.lemoine at camptocamp.com
Sun Dec 27 04:15:46 EST 2009


On Wednesday, December 23, 2009, Julien Jeudy <julien.jeudy at magellium.fr> 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:
>
> 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];
>             }
>         }
>
> But i'm not sure it's the best way to do this.

I'm not familiar enough with GML to answer your question, sorry. I'd
just recommend that you ask the question again on dev@ if you don't
get answers here. Also, if you think this is a bug feel free to create
a ticket, and possibly attach a patch. See
<http://trac.openlayers.org/wiki/HowToContribute>. Thanks,

-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com



More information about the Users mailing list