Hi,<br><br>First of all thank you for the prompt suggestion. Worked perfectly and I was able to include also a style to work with properties defined within GeoJSON file:<br><i><br>specimens = new OpenLayers.Layer.GML(&quot;specimens&quot;, &quot;geojson.php&quot;, {format: OpenLayers.Format.GeoJSON, projection: new OpenLayers.Projection(&quot;EPSG:4326&quot;), styleMap: new OpenLayers.StyleMap(style)});</i><br>
<br>The situation I&#39;ve encountered now is that data from this layer has to be regenerated with every zoomend event (I do some clustering on server side to limit the number of features to less than 100 points - the return could be easily in hundreds or more). The part with zoomend event I can handle. However, I do not know what is the best strategy to handle this situation further:<br>
<br>1. delete the whole layer and recreate a new GML layer (using code above) every time? This produces some problems in handling controls (as I interpret from reaction of the scripts). The controls dedicated to layer &quot;specimens&quot; does not function anymore. I have to redeclare it again.<br>
<br>2. create a vector layer and load and delete features with zoom events without removing layer and controls.<br><br>For second solution I have found the piece of code below, (which also works) but returns me to the initial question how do I specify in this context projection an style parameters?:<br>
<br><i>OpenLayers.loadURL(&quot;geojson.php&quot;, {}, null, styleMap: new OpenLayers.StyleMap(style)}, onLoadgml, onLoadFailedgml); <br><br>function onLoadgml(r) { <br>&nbsp;&nbsp;&nbsp;&nbsp; if (r.status == 200) { <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var p = new OpenLayers.Format.GeoJSON(); <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var f = p.read(r.responseText);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; specimens.addFeatures(f); <br>&nbsp;&nbsp;&nbsp;&nbsp; } <br>}</i><br><i><br>....<br><br></i>I would somehow prefer the second strategy. Could somebody give me a hint on how to include <i>{format: OpenLayers.Format.GeoJSON, projection: new OpenLayers.Projection(&quot;EPSG:4326&quot;)</i> in script so that OL renders vector features at the right place<i>? <br>
<br></i>All the best,<br>Adorian<br><br><div class="gmail_quote">On Sat, Jun 28, 2008 at 5:32 PM, Christopher Schmidt &lt;<a href="mailto:crschmidt@metacarta.com">crschmidt@metacarta.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="Wj3C7c">On Sat, Jun 28, 2008 at 04:39:19PM +0200, Adorian Ardelean wrote:<br>
&gt; Hi,<br>
&gt;<br>
&gt; I am trying to load a GeoJSON file in a layer on top of a google map<br>
&gt; (OpenLayers 2.6).<br>
&gt;<br>
&gt; I used for now:<br>
&gt; var colfeatures = new OpenLayers.Layer.GML(&quot;specimens&quot;, &quot;geojson.php&quot;,<br>
&gt; {format: OpenLayers.Format.GeoJSON});<br>
&gt; map.addLayer(colfeatures);<br>
&gt;<br>
&gt; Entities show up on the map somewhere close to 0,0. For other vector<br>
&gt; entities (coordinates) I push through code this is solved with<br>
&gt;<br>
&gt; var g = new OpenLayers.Projection(&quot;EPSG:4326&quot;);<br>
&gt; var p = new OpenLayers.Projection(&quot;EPSG:900913&quot;);<br>
&gt;<br>
&gt; and .tranform(g,p)<br>
&gt;<br>
&gt; but I do not know how to apply this directly on features read from GeoJSON.<br>
&gt; Is there a way to loop through all entities in colfeatures and apply<br>
&gt; transform(g.p) or can somebody suggest me a better approach?<br>
</div></div>{format: OpenLayers.Format.GeoJSON} -&gt;<br>
&nbsp;{ format: OpenLayers.Format.GeoJSON,<br>
 &nbsp; projection: new OpenLayers.Projection(&quot;EPSG:4326&quot;)<br>
&nbsp;}<br>
<br>
Regards,<br>
<font color="#888888">--<br>
Christopher Schmidt<br>
MetaCarta<br>
</font></blockquote></div><br><br clear="all"><a href="http://mybiosis.info">http://mybiosis.info</a><br>