[OpenLayers-Users] GML parsing problem

Volker Nathusius nathusius at terrestris.de
Fri Oct 21 06:52:36 EDT 2011


Hello List,

I've got a problem with the OpenLayers.Format.GML (v3), when reading a 
GML string (output of deegrees WPS) to get a list of features, but 
instead I only got an empty array returned.
I got confirmation that the input GML string is valid. To find the 
problem, I disassembled the GML string and found two positions where the 
parser seems to choke:

First, the input GML uses the attribute xsi:schemaLocation on the 
Polygon tag - I needed to remove that one to make it work.
Second, the input GML uses <gml:posList> instead of <gml:coordinates>, 
and furthermore it separates coordinates as well as coordinate pairs 
with whitespaces. I needed to replace the posList-tag with a 
coordinates-tag, and separate the pairs with "," to make everything work.

Now I'm curious if the GML is in fact correct and OpenLayers GML parser 
has some issues, or the other way round?. See the examples below.

Thanks a lot,
best regards, Volker

this one as input isn't parsed:
[...]
<gml:Polygon xsi:schemaLocation="http://www.opengis.net/gml 
http://schemas.opengis.net/gml/3.1.1/base/geometryAggregates.xsd" 
xmlns:gml="http://www.opengis.net/gml">
<gml:exterior>
<gml:LinearRing>
<gml:posList>
                     382.2462 560.7862 382.0541 558.8353 381.4850 
556.9594 380.5609 555.2305 382.2462 560.7862
</gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
[...]

this one is parsed on the same place:
[...]
<gml:Polygon xmlns:gml="http://www.opengis.net/gml">
<gml:exterior>
<gml:LinearRing>
<gml:coordinates decimal="." cs="," ts=" ">
                     382.2462,560.7862 382.0541,558.8353 
381.4850,556.9594 380.5609,555.2305 3822462,560.7862
</gml:coordinates>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
[...]


-- 
   Volker von Nathusius

   terrestris GmbH&  Co. KG
   Pützchens Chaussee 56
   53227 Bonn

   Tel:    +49 (0)228 / 96 28 99 -54
   Fax:    +49 (0)228 / 96 28 99 -57

   Email:weskamm at terrestris.de
   Web:http://www.terrestris.de

   Amtsgericht Bonn, HRA 6835
   Komplementärin:  terrestris Verwaltungsgesellschaft mbH
   vertreten durch: Hinrich Paulsen, Till Adams



More information about the Users mailing list