[OpenLayers-Dev] OpenLayers.Protocol.WFS.v1: Unsupported GeoJSON format?

Tim-Hinnerk Heuer th.heuer at gmail.com
Mon Jul 2 23:33:45 PDT 2012


Hi List,

I've recently started playing with GWT-OpenLayers and it seems to be quite
good. However, when I write this code:

        VectorOptions vOptions = new VectorOptions();
        Strategy strategies[] = {new BBoxStrategy()};
        WFSProtocolOptions pOptions = new WFSProtocolOptions("wfs", "
http://www.opengis.net/gml", "postgis:maori_land_wgs84");
        pOptions.setVersion("1.1.0");
        pOptions.setSrsName("EPSG:2193");
        GeoJSON format = new GeoJSON();
        pOptions.setFormat(format);
        Protocol prot = new WFSProtocol(pOptions);
        vOptions.setStrategies(strategies);
        vOptions.setProtocol(prot);
        vectorLayer = new Vector("features", vOptions);

        map.addLayer(vectorLayer);

I get an exception in OpenLayers-2.12 release on this line:
    read: function(options) {
        OpenLayers.Protocol.prototype.read.apply(this, arguments);
        options = OpenLayers.Util.extend({}, options);
        OpenLayers.Util.applyDefaults(options, this.options || {});
        var response = new OpenLayers.Protocol.Response({requestType:
"read"});

        var data = OpenLayers.Format.XML.prototype.write.apply(
            this.format, [this.format.writeNode("wfs:GetFeature", options)] //
THIS LINE
        );

this.format.writeNode is undefined. First I was blaming GWT and thinking it
might not be as good as they say, but now, looking at the OpenLayers code a
bit more, it looks to me as an OpenLayers bug or at least it means that the
GeoJSON format is not supported.

It looks to me as though only XML formats are supported. Is that correct?

Please correct me if I'm wrong or if I should attempt to fix it properly
within OpenLayers.

Kind regards,
Tim

Tim-Hinnerk Heuer

Twitter: @geekdenz
Blog: http://www.thheuer.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20120703/7fe5d437/attachment.html>


More information about the Dev mailing list