[Users] Help with OpenLayers.Format.GeoJSON

Pol d.paolino at gmail.com
Mon Sep 13 16:19:39 CEST 2010


Hello all,

I'm moving my whole project to the Drupal Framework and I'm using the
services module who can send data in many format(xml, json, amfphp, etc
etc).

Before using it, I was using simple php to send the data to my store, like
this:

MarkersStore = new GeoExt.data.FeatureStore({
layer: MarkersLayer,
proxy: new GeoExt.data.ProtocolProxy({
protocol: new OpenLayers.Protocol.HTTP({
url: get_markers.php,
format: new OpenLayers.Format.GeoJSON({
'internalProjection': proj900913,
'externalProjection': proj4326
}),
readWithPOST: true
})
}),
autoLoad: false,
});

Now I have to modify my code to get it working with the tools provided by
this amazing framework.

My Json code look like this now:

{

    "#error": false,
    "#data": {
        "type": "FeatureCollection",
        "features": [
            {
                "geometry": {
                    "type": "Point",
                    "coordinates": [
                        4.35205865469,
                        50.8235093311
                    ]
                },
                "properties": {
                    "img": "sites/default/modules/lukoil/lukoil.jpg",
                    "inf": "Lukoil ID 3",
                    "html": null
                }
            }]
      }
}


The FeatureCollection I use to parse is now embedded in another container.

That means that my old FeatureStore is no more working with those data and I
don't know how to solve this.

Any idea ?

My store look like this now:

MarkersStore = new GeoExt.data.FeatureStore({
layer: MarkersLayer,
proxy: new GeoExt.data.ProtocolProxy({
protocol: new OpenLayers.Protocol.HTTP({
url: /services/json,
params: {'method':'\"markers.get\"'},
format: new OpenLayers.Format.GeoJSON({
'internalProjection': proj900913,
'externalProjection': proj4326
}),
readWithPOST: true
})
}),
autoLoad: false,
});

Thanks for the help !


-Pol D.-
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20100913/8d7c3516/attachment-0001.htm 


More information about the Users mailing list