[OpenLayers-Users] OpenLayers.Format.WFS question/issue
Christopher Schmidt
crschmidt at metacarta.com
Mon Mar 10 12:23:40 EDT 2008
On Mon, Mar 10, 2008 at 11:38:46AM -0500, Stephen Woodbridge wrote:
> 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:
Can you provide some evidence that this is how it's supposed to be done?
Inserts and Modifys are different in WFS-T: that's just a case of
OpenLayerse following the spec, as far as I know?
Note that this isn't a case of the difference being the namespace: the
difference here is that in Insert, you pass a full, GML-serialized
feature. In Modify, you pass a specific property that you are
modifying.
Essentially, the WFS-T support is largely cobbled together from examples
on the web. If you can provide examples of a server which I can post the
following data to, and see a successful transaction, I'm interested.
> <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.
WFS-T support was built on examples, primarily from GeoServer, with
support from Cameron Shorter and others who wrote the original vector
code. The XSDs shipped with the spec are totally useless to me, even
when they're actually accurate, so I don't have a good backup of why it
was done this way, other than "I thought it should be done this way.
> 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.
'arbitrary attributes'? The Layer Definition ('Schema') For a WFS layer
is key to all work with WFS, no?
> 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>.
What does the spec say? This matters more than 'existing services', as
far as I'm concerned, but the existing insert statements work with
GeoServer, Manifold, and at least some others, and GeoServer is what I was
working with when I wrote it.
Regards,
--
Christopher Schmidt
MetaCarta
More information about the Users
mailing list