[OpenLayers-Users] JSON format does not work in Protocol.WFS
Andreas Hocevar
ahocevar at opengeo.org
Tue Apr 13 08:56:05 EDT 2010
Hi,
On Apr 13, 2010, at 08:36 , paweluz wrote:
>
> Hi!
>
> I have been reading for a while that using JSON format is better in some
> cases that using just GML (XML). I have been trying to use it, but in
> firebug all the time I can see just XML not the json file... My code looks
> like this:
>
> var wfsproba = new OpenLayers.Layer.Vector("Editable Features", {
> strategies: [new OpenLayers.Strategy.BBOX(),saveStrategy],
> projection: new OpenLayers.Projection("EPSG:4326"),
> styleMap: wfs_style,
> protocol: new OpenLayers.Protocol.WFS({
> version: "1.1.0",
> srsName: "EPSG:4326",
> url: "http://localhost/geoserver2_0_1/wfs",
> featureNS : "http://www.openplans.org/topp",
> featureType: "bazadanych",
> geometryName: "the_geom",
> formatOptions: {outputFormat: 'json'},
Instead of the above line, just write
outputFormat: "json"
> readFormat: new OpenLayers.Format.GeoJSON() ,
> schema:
> "http://localhost/geoserver2_0_1/wfs/DescribeFeatureType?version=1.1.0&typename=topp:bazadanych",
> featurePrefix: "topp"
> })
>
> Did I make some mistake. If I understand this right In firebug I should have
> response in JSON not GML?? I used Openlayers 2.9-rc2.
See above.
Regards,
Andreas.
>
> Can anyone please help me in this....
>
> Regards,
> Poul
>
>
> --
> View this message in context: http://n2.nabble.com/JSON-format-does-not-work-in-Protocol-WFS-tp4894449p4894449.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
--
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.
More information about the Users
mailing list