<div>Thanks Eric, but...</div><div><br></div>How to include such code in my current application ?<div><br></div><div>I&#39;m doing these:</div><div><br></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><div>
<font face="&#39;courier new&#39;, monospace">MyReader = new OpenLayers.Format.GeoJSON({</font></div><div class="im" style="color: rgb(80, 0, 80); "><div><span style="white-space: pre-wrap; "><font face="&#39;courier new&#39;, monospace">                </font></span><font face="&#39;courier new&#39;, monospace">read: function() {</font></div>
<div><font face="&#39;courier new&#39;, monospace">         </font><span style="white-space: pre-wrap; "><font face="&#39;courier new&#39;, monospace">                </font></span><font face="&#39;courier new&#39;, monospace">var obj = OpenLayers.Format.JSON.read.apply(this, arguments);</font></div>
</div><div><font face="&#39;courier new&#39;, monospace">         </font><span style="white-space: pre-wrap; "><font face="&#39;courier new&#39;, monospace">                </font></span><font face="&#39;courier new&#39;, monospace">return OpenLayers.Format.GeoJSON.read.apply(this, obj-&gt;#data);</font></div>
<div><font face="&#39;courier new&#39;, monospace">     </font><span style="white-space: pre-wrap; "><font face="&#39;courier new&#39;, monospace">                </font></span><font face="&#39;courier new&#39;, monospace">}</font></div>
<div><font face="&#39;courier new&#39;, monospace"> </font><span style="white-space: pre-wrap; "><font face="&#39;courier new&#39;, monospace">        </font></span><font face="&#39;courier new&#39;, monospace">});</font></div><div>
<font face="&#39;courier new&#39;, monospace"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif">And then ? I don&#39;t know how to use it in my store...</font></div></span></div><div>
<br></div><div>Thanks for helping !</div><div><br></div><div><br clear="all">-Pol D.-<br><br><div class="gmail_quote">On Mon, Sep 13, 2010 at 19:04, Eric Lemoine <span dir="ltr">&lt;<a href="mailto:eric.lemoine@camptocamp.com">eric.lemoine@camptocamp.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div></div><div class="h5">On Monday, September 13, 2010, Pol &lt;<a href="mailto:d.paolino@gmail.com">d.paolino@gmail.com</a>&gt; wrote:<br>

&gt; Hello all,<br>
&gt; I&#39;m moving my whole project to the Drupal Framework and I&#39;m using the services module who can send data in many format(xml, json, amfphp, etc etc).<br>
&gt; Before using it, I was using simple php to send the data to my store, like this:<br>
&gt;<br>
&gt;       MarkersStore = new GeoExt.data.FeatureStore({<br>
&gt;               layer: MarkersLayer,<br>
&gt;               proxy: new GeoExt.data.ProtocolProxy({<br>
&gt;                       protocol: new OpenLayers.Protocol.HTTP({<br>
&gt;                               url: get_markers.php,<br>
&gt;                               format: new OpenLayers.Format.GeoJSON({<br>
&gt;                                       &#39;internalProjection&#39;: proj900913,<br>
&gt;                                       &#39;externalProjection&#39;: proj4326<br>
&gt;                               }),<br>
&gt;                               readWithPOST: true<br>
&gt;                       })<br>
&gt;               }),<br>
&gt;               autoLoad: false,<br>
&gt;       });<br>
&gt;<br>
&gt; Now I have to modify my code to get it working with the tools provided by this amazing framework.<br>
&gt; My Json code look like this now:<br>
&gt; {    &quot;#error&quot;: false,<br>
&gt;     &quot;#data&quot;: {<br>
&gt;         &quot;type&quot;: &quot;FeatureCollection&quot;,<br>
&gt;         &quot;features&quot;: [<br>
&gt;             {<br>
&gt;                 &quot;geometry&quot;: {<br>
&gt;                     &quot;type&quot;: &quot;Point&quot;,<br>
&gt;                     &quot;coordinates&quot;: [<br>
&gt;                         4.35205865469,<br>
&gt;                         50.8235093311<br>
&gt;                     ]<br>
&gt;                 },<br>
&gt;                 &quot;properties&quot;: {<br>
&gt;                     &quot;img&quot;: &quot;sites/default/modules/lukoil/lukoil.jpg&quot;,<br>
&gt;                     &quot;inf&quot;: &quot;Lukoil ID 3&quot;,<br>
&gt;                     &quot;html&quot;: null<br>
&gt;                 }<br>
&gt;             }]<br>
&gt;       }<br>
&gt; }<br>
&gt;<br>
&gt; The FeatureCollection I use to parse is now embedded in another container.<br>
&gt; That means that my old FeatureStore is no more working with those data and I don&#39;t know how to solve this.<br>
&gt;<br>
&gt; Any idea ?<br>
&gt; My store look like this now:<br>
&gt;       MarkersStore = new GeoExt.data.FeatureStore({<br>
&gt;               layer: MarkersLayer,<br>
&gt;               proxy: new GeoExt.data.ProtocolProxy({<br>
&gt;                       protocol: new OpenLayers.Protocol.HTTP({<br>
&gt;                               url: /services/json,<br>
&gt;                               params: {&#39;method&#39;:&#39;\&quot;markers.get\&quot;&#39;},<br>
&gt;                               format: new OpenLayers.Format.GeoJSON({<br>
&gt;                                       &#39;internalProjection&#39;: proj900913,<br>
&gt;                                       &#39;externalProjection&#39;: proj4326<br>
&gt;                               }),<br>
&gt;                               readWithPOST: true<br>
&gt;                       })<br>
&gt;               }),<br>
&gt;               autoLoad: false,<br>
&gt;       });<br>
&gt;<br>
&gt; Thanks for the help !<br>
<br>
</div></div>Hi<br>
<br>
This framework isn&#39;t so amazing since it doesn&#39;t support GeoJSON.<br>
Sorry I couldn&#39;t resist :-)<br>
<br>
The representation format of the received data is not GeoJSON, so it&#39;s<br>
no surprise that Format. GeoJSON cannot read that.<br>
<br>
What you can do is define your own Format, with something like that for example:<br>
<br>
    new OpenLayers.Format.GeoJSON({<br>
         read: function() {<br>
             var obj = OpenLayers.Format.JSON.read.apply(this, arguments);<br>
             return OpenLayers.Format.GeoJSON.read.apply(this, [obj]);<br>
         }<br>
     });<br>
<br>
Cheers,<br>
<br>
--<br>
Eric Lemoine<br>
<br>
Camptocamp France SAS<br>
Savoie Technolac, BP 352<br>
73377 Le Bourget du Lac, Cedex<br>
<br>
Tel : 00 33 4 79 44 44 96<br>
Mail : <a href="mailto:eric.lemoine@camptocamp.com">eric.lemoine@camptocamp.com</a><br>
<a href="http://www.camptocamp.com" target="_blank">http://www.camptocamp.com</a><br>
</blockquote></div><br></div>