[Users] Help with OpenLayers.Format.GeoJSON

Eric Lemoine eric.lemoine at camptocamp.com
Wed Sep 15 07:51:03 CEST 2010


On Tuesday, September 14, 2010, Pol <d.paolino at gmail.com> wrote:
> I also tried this:
> 	MarkersStore = new GeoExt.data.FeatureStore({
> 		layer: MarkersLayer,
> 		proxy: new GeoExt.data.ProtocolProxy({
> 			protocol: new OpenLayers.Protocol.HTTP({
> 				url: marker_api_url,
> 				format: new OpenLayers.Format.GeoJSON({
> 					read: function() {
> 			                        var obj = OpenLayers.Format.JSON.read.apply(this, arguments);
> 						console.log(obj);
> 			   			return OpenLayers.Format.GeoJSON.read.apply(this, [obj]);
> 			                },
> 					'internalProjection': proj900913,
> 					'externalProjection': proj4326
> 				}),
> 				readWithPOST: true
> 			})
> 		}),
> 		autoLoad: false,
> 	});
>
> But it doesn't works. I never get anything in the log.
> Can you show me an example ?

You should do

return OpenLayers.Format.GeoJSON.read.apply(this, [obj["#data"]]);

But you have another problem since console.log doesn't display
anything. What if you add a console.log at the beginning of the read
function?

-- 
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