[OpenLayers-Users] WFS-T POST with attributes and geometries

Eric eric at glimpsely.com
Fri Sep 7 10:08:44 PDT 2012


Hello list,
I am trying to save features to a PostGIS DB using OL and tinyows. Saving
geometries alone works fine, updating records works well, but as soon as
I combine attributes and geometries, I get an error from tinyows
indicating that the XML is not in the right format. I have noticed a
difference between the 3 scenarios. For instance, when I save a geometry
without attributes, I get the following: (this works fine)

<wfs:Insert>
      <feature:parcels xmlns:feature="http://www.tinyows.org/">
      <feature:geom>
          <gml:MultiSurface xmlns:gml="http://www.opengis.net/gml" 
srsName="EPSG:3857">
          <gml:surfaceMember>
              <gml:Polygon>
                  <gml:exterior>
                      <gml:LinearRing>
<gml:posList>-10752.....</gml:posList>
                      </gml:LinearRing>
                  </gml:exterior>
              </gml:Polygon>
          </gml:surfaceMember>
      </gml:MultiSurface>
</feature:geom>
</feature:washco_parcels>
</wfs:Insert>



And, when I add attributes, I get the following: (generates an error to
the effect that "<feature:address1>test" is unexpected)

<wfs:Insert>
      <feature:parcels xmlns:feature="http://www.tinyows.org/">
      <feature:geom>
          <gml:MultiSurface xmlns:gml="http://www.opengis.net/gml" 
srsName="EPSG:3857">
          <gml:surfaceMember>
              <gml:Polygon>
                  <gml:exterior>
                      <gml:LinearRing>
<gml:posList>-10752.....</gml:posList>
                      </gml:LinearRing>
                  </gml:exterior>
              </gml:Polygon>
          </gml:surfaceMember>
      </gml:MultiSurface>
</feature:geom>
<feature:address1>test</feature:address1>
</feature:washco_parcels>
</wfs:Insert>


Finally, if I do a simple UPDATE, I get the following: (works fine)

<wfs:Update xmlns:demo="http://www.tinyows.org/" typeName="demo:parcels">
<wfs:Property>
      <wfs:Name>geom</wfs:Name>
      <wfs:Value>
          <gml:MultiSurface xmlns:gml="http://www.opengis.net/gml" 
srsName="EPSG:3857">
          <gml:surfaceMember>
              <gml:Polygon>
                  <gml:exterior>
                      <gml:LinearRing>
<gml:posList>-10737.....</gml:posList>
                      </gml:LinearRing>
                  </gml:exterior>
              </gml:Polygon>
          </gml:surfaceMember>
      </gml:MultiSurface>
</wfs:Value>
</wfs:Property>
*<wfs:Property>
      <wfs:Name>objectid</wfs:Name>
      <wfs:Value>18785</wfs:Value>
</wfs:Property>*

.......

The first difference is in the namespace used (feature vs wfs). Any
reason why OL is treating them differently? Another difference is in the 
way attributes
are included:

<wfs:Property>
      <wfs:Name>objectid</wfs:Name>
      <wfs:Value>18785</wfs:Value>
</wfs:Property>

vs

<feature:address1>test</feature:address1>

The third example (using wfs:Property) seems to be the correct way to
specify information in a WFS file. The first example works fine despite
not using that format, because I suspect the GML schema is more flexible
and since it does not have attributes that are not geometries, it is
considered valid.

So I tried turning off schema checking in the tinyows.xml file and the
problem payload go through without issues. So this seem to indicate that
some of the XSD used are strict and don't allow attributes to be defined
like <feature:address1>test</feature:address1>.

So I know it can be fixed by turning off schema validation, and perhaps 
by adapting the XSD used by tinyows, but that seems to be avoiding the 
issue. What do I need to override in OL to make it generate the proper 
XML payload?

BTW, I am using OL 2.12 and Tinyows 1.0.0. This was also posted in the 
tinyows mailing list, but it appears to be more related to this list.

thanks!
Eric


More information about the Users mailing list