[OpenLayers-Users] OpenLayers.Format.WFS question/issue

Stephen Woodbridge woodbri at swoodbridge.com
Mon Mar 10 12:38:46 EDT 2008


Hi all,

I admit up front that this inquiry might partly be my ignorance on the 
subject, but when OpenLayers.Format.WFS serializes a polygon insert 
request it looks like:

  <wfs:Insert>
   <feature:Geofence xmlns:feature="http://mapserver.gis.umn.edu/mapserver">
    <feature:the_geom>
     <gml:MultiPolygon xmlns:gml="http://www.opengis.net/gml">
      <gml:polygonMember>
       <gml:Polygon>
        <gml:outerBoundaryIs>
         <gml:LinearRing>
          <gml:coordinates decimal="." cs="," ts=" 
">-105.662109375,40.1591796875 -107.068359375,38.2255859375 
-103.640625,37.7861328125 -105.662109375,40.1591796875</gml:coordinates>
         </gml:LinearRing>
        </gml:outerBoundaryIs>
       </gml:Polygon>
      </gml:polygonMember>
     </gml:MultiPolygon>
    </feature:the_geom>
   </feature:Geofence>
  </wfs:Insert>

This appears to be getting done by 
OpenLayers.Format.WFS.createFeatureXML(feature) and the namespace is 
hardcoded to "feature:..."

My question is why this namespace and not the wfs namespace and XML 
something more like:

  <wfs:Insert typeName="Geofence">
   <wfs:Property>
    <wfs:Name>the_geom</wfs:Name>
    <wfs:Value>
     <gml:MultiPolygon xmlns:gml="http://www.opengis.net/gml">
      <gml:polygonMember>
       <gml:Polygon>
        <gml:outerBoundaryIs>
         <gml:LinearRing>
          <gml:coordinates decimal="." cs="," ts=" 
">-105.662109375,40.1591796875 -107.068359375,38.2255859375 
-103.640625,37.7861328125 -105.662109375,40.1591796875</gml:coordinates>
         </gml:LinearRing>
        </gml:outerBoundaryIs>
       </gml:Polygon>
      </gml:polygonMember>
     </gml:MultiPolygon>
     </wfs:Value>
   </wfs:Property>
   <wfs:Property>
    <wfs:Name>name</wfs:Name>
    <wfs:Value>noname</wfs:Value>
   </wfs:Property>
  </wfs:Insert>

This would more closely follow the <wfs:Modify> format and namespace.

So why should anyone care? mostly the later is much easier to parse as 
the tags are predetermined by the wfs namespace and not consturcted from 
the arbitrary attributes used in the layer definition.

I am interested in the "why of this" so I better understand how all this 
works. Reading the code, it looks like this change can be done by 
overloading createFeatureXML with code that generates the later XML 
above, so I could make the change myself outside of the OL code base for 
testing and review.

If I did that would it be an appropriate change to svn?
A change to svn, would probably break any existing services that depend 
on the existing format for <wfs:Insert>.

Thanks in advance for any thoughts on this.

-Steve W



More information about the Users mailing list