[Users] Help with OpenLayers.Format.GeoJSON

Pol d.paolino at gmail.com
Wed Sep 15 08:21:14 CEST 2010


Yes I tried also to do that, but the thing that worry me the most is that
console.log() do not display anything...

I've modified my code like 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() {
console.log("testing...");
                        var obj = OpenLayers.Format.JSON.read.apply(this,
arguments);
    return OpenLayers.Format.GeoJSON.read.apply(this, obj['#data']);
        },
'internalProjection': proj900913,
'externalProjection': proj4326
}),
readWithPOST: true
})
}),
autoLoad: true,
});

Any idea?
-Pol D.-
http://www.google.com/profiles/110003197662276240659


On Wed, Sep 15, 2010 at 07:51, Eric Lemoine <eric.lemoine at camptocamp.com>wrote:

> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20100915/ae1b778a/attachment.htm 


More information about the Users mailing list