OpenLayers OpenLayers

Ticket #1648 (new feature)

Opened 4 months ago

Last modified 3 weeks ago

Add WFS protocol

Reported by: tschaub Assigned to: tschaub
Priority: critical Milestone: 2.8 Release
Component: Layer.Vector Version: 2.7 RC1
Keywords: Cc: adube@mapgears.com
State: Needs More Work

Description

The WFS protocol will work with a GML format by default and should allow for some version negotiation (or at least support multiple versions).

Attachments

wfs.patch (115.1 kB) - added by tschaub on 10/20/08 01:28:07.
wfs protocol/formats for v1.0 and 1.1

Change History

07/31/08 19:39:18 changed by tschaub

It makes sense to add a BBOX strategy at the same time. This depends on #1543.

08/22/08 08:36:23 changed by elemoine

patch-1648-r7825-A0.diff includes the BBOX strategy code and corresponding unit tests. Unit tests pass on FF2 and FF3.

08/26/08 04:14:21 changed by euzuro

  • state set to Review.

09/05/08 11:18:56 changed by euzuro

  • version changed from 2.6 to 2.7 RC1.

Floating to RC1... vector-behavior patches will go in on RC2.

09/09/08 16:04:17 changed by tschaub

I'll update the patch for this when #1639 is done.

09/09/08 16:04:25 changed by tschaub

  • state changed from Review to Needs More Work.

09/10/08 18:29:35 changed by tschaub

I'm moving the bbox patch to #1731.

09/12/08 11:28:24 changed by euzuro

  • milestone changed from 2.7 Release to 2.8 Release.

09/23/08 19:43:05 changed by tschaub

  • state changed from Needs More Work to Review.

Tests pass in FF3. Needs more testing (contributions welcome).

10/07/08 16:09:23 changed by adube

  • cc set to adube@mapgears.com.

I installed TinyOWS on my laptop and willing to test this new feature. I'll post any comments here if I have any.

Alexandre
Mapgears

10/09/08 14:58:02 changed by adube

I've been trying to figure why tinyOWS keeps saying "xml is not valid" as response of the post query. Found out in the apache access_log the following :

element Query: Schemas validity error : Element '{http://www.opengis.net/wfs}Query', attribute 'srsName': The attribute 'srsName' is not allowed.

See also in attached WFS-basic.xsd

So, after the srsName removed from the query, tinyows returned xml ! The wfs-protocol.html example uses GeoServer, so maybe GS is less strict than tinyows for that matter...

10/10/08 20:29:37 changed by tschaub

I've been doing a bit more work on this and want to separate out wfs 1.1 from 1.0. This involves updating the filter formats (so fe 1.1 uses gml 3 and fe 1.0 uses gml 2 among other changes). I'm working on these changes in a sandbox.

Thanks for any additional help.

10/17/08 18:47:59 changed by tschaub

  • state changed from Review to Needs More Work.

Ok, there are still some places where we take advantage of GeoServer being liberal in what it accepts (srsName on wfs:Query for example), but the WFS protocol and associated changes are getting close. See the topp/wfs sandbox if you want to give it a try.

Help with test writing in particular would be appreciated. This is also going to involve changes for filters and gml parsing.

10/20/08 01:28:07 changed by tschaub

  • attachment wfs.patch added.

wfs protocol/formats for v1.0 and 1.1

10/20/08 01:51:51 changed by tschaub

This is now in good shape. Next task is separating out all the non WFS (Filter & GML) changes into separate tickets. One remaining issue is that we don't write a schemaLocation attribute that includes a reference to the feature type schema. Not sure for whom that is important.

10/22/08 19:44:58 changed by tschaub

Filter related changes now in #1790. This ticket now depends on that one.

10/27/08 15:35:35 changed by bjornharrtell

Been looking through the stuff in the sandbox and the changes looks good. There is one thing though I think is important about the usage of WFS/Filters and that is clear documentation about where it is possible and/or recommended that filters can be used as an option to an constructor or function.

I think it is useful to be able to filter as a part of a strategy on a Vector layer, but also when using the WFS protocol/format standalone. At one time a filter was put on the the Vector layer itself - I'm guessing this is no longer the case which I think is good, but at the same time I don't really follow where to use it now. I can only find it as a part of "Query" in the WFST/v1.js format. I think support for optional and arbitrary filters for both queries and transactions would be useful.

11/04/08 10:05:28 changed by bartvde

Tim, I tried your patch against 2.7, but found a few issues. Should this patch still be removing the BBOX writer Filter/v1.js since ticket:1731 made it into 2.7? Also, the examples/filter.html is a diff but there is no initial version in 2.7 (but maybe in your sandbox).

11/13/08 03:14:36 changed by bartvde

A more serious issue IMHO is that the protocol in filterDelete is writing XML stuff that should be done by the Format instead. Or am I missing something?

    /**
     * Method: filterDelete
     * Send a request that deletes all features by their filter.
     *
     * Parameters:
     * filter - {OpenLayers.Filter} filter
     */
    filterDelete: function(filter) {
        var root = this.format.writeNode("wfs:Transaction");

        var deleteNode = this.format.createElementNSPlus("wfs:Delete", {
            attributes: {
                typeName: (options.featureNS ? this.featurePrefix + ":" : "") +
                    options.featureType
            }
        });

        if(options.featureNS) {
            deleteNode.setAttribute("xmlns:" + this.featurePrefix, options.featureNS);
        }
        var filterNode = this.format.writeNode("ogc:Filter", filter);

        deleteNode.appendChild(filterNode);

        root.appendChild(deleteNode);

        var data = OpenLayers.Format.XML.prototype.write.apply(
            this.format, [root]
        );

        return OpenLayers.Request.POST({
            url: this.url,
            data: data
        });

    },

    CLASS_NAME: "OpenLayers.Protocol.WFS.v1"

11/13/08 19:53:42 changed by tschaub

Setting feature state is addressed in #1833 now.