[Users] Help with OpenLayers.Format.GeoJSON

Eric Lemoine eric.lemoine at camptocamp.com
Tue Sep 28 10:27:40 CEST 2010


On Tue, Sep 28, 2010 at 10:16 AM, Pol <d.paolino at gmail.com> wrote:
> Hello,
> I succeded to get it working in firebug, I was using Firefox Beta 4 and
> Firebug is having some issues with it.
> Check
> this: http://img163.imageshack.us/img163/5491/screenshot20100928at100.png
> The code related to that screenshot is
> there: http://gist.github.com/600596 or here:
> MarkersStore = new GeoExt.data.FeatureStore({
>
> 		layer: MarkersLayer,
> 		proxy: new GeoExt.data.ProtocolProxy({
> 			protocol: new OpenLayers.Protocol.HTTP({
> 				url: marker_api_url,
> 				params:{'method':'\"markers.get\"'},
> 				format: new OpenLayers.Format.GeoJSON({
> 					read: function() {
> 						console.log("var This: " + this);
> 						console.log("var arguments: " + arguments);
> 			                         var obj =
> OpenLayers.Format.JSON.prototype.read.apply(this, arguments);
> 				 		console.log("var obj: " + obj);
> 						return OpenLayers.Format.GeoJSON.prototype.read.apply(this,
> obj["#data"]);
> 			        },
> 					'internalProjection': proj900913,
> 					'externalProjection': proj4326
> 				}),
> 				readWithPOST: true
> 			})
> 		}),
> 		autoLoad: true,
> 	});
>
> The var obj is always NULL... can you help me please ?

I'd recommend to look more closely at what you have in "arguments",
arguments[0] should have the JSON string.



-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com


More information about the Users mailing list