Eric, you&#39;re faster. Catched them all while I tested...<br><br>Esteban, esta es la función init() resultante, por si la quieres aprovechar:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function init() {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; var g = new OpenLayers.Projection(&quot;EPSG:4326&quot;);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; var p = new OpenLayers.Projection(&quot;EPSG:900913&quot;);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var options = {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; projection: p,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; displayProjection: g,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; units: &quot;m&quot;,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; maxResolution: 156543.0339,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; maxExtent: new OpenLayers.Bounds(-20037508, -20037508,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 20037508, 20037508.34)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; };<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; map = new OpenLayers.Map(&#39;map&#39;, options);<br>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var layergoogle = new OpenLayers.Layer.Google(&quot;Google Normal&quot;,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {type: G_NORMAL_MAP, &#39;sphericalMercator&#39;: true});<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var vectores = new OpenLayers.Layer.Vector(&quot;Vector Features&quot;);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; map.addLayers([layergoogle, vectores]);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //line near Barcelona, spain, for example<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var p1 = new OpenLayers.Geometry.Point(2, 41);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var p2 = new OpenLayers.Geometry.Point(41, 2);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var lineString = new OpenLayers.Geometry.LineString([p1,p2]).transform(g, p);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var lineFeature = new OpenLayers.Feature.Vector(lineString, null, null);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vectores.addFeatures([lineFeature]);<br>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var lonLat = new OpenLayers.LonLat(2, 41).transform(g, p);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; map.setCenter(lonLat, 7);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br><br><br><div class="gmail_quote">2008/6/6 Eric Lemoine &lt;<a href="mailto:eric.c2c@gmail.com">eric.c2c@gmail.com</a>&gt;:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">2008/6/6 Esteban olm &lt;<a href="mailto:esteban.olm@gmail.com">esteban.olm@gmail.com</a>&gt;:<br>

<div class="Ih2E3d">&gt; Hello,<br>
&gt;<br>
&gt; I need help! I can not understand why I can not see a line in openlayers.<br>
&gt; If I don&#39;t use projections, I can see it, but then the line is not properly<br>
&gt; drawn in Firefox (but yes in Explorer).<br>
&gt; I know that problem is a projection problem (I have read a lot in Internet),<br>
&gt; I know Google use Mercator, but I don&#39;t know how to solve it.<br>
&gt;<br>
&gt; Please help !! There is something I can not find.<br>
&gt; Here is the entire HTML page from what I think is the best approximation<br>
&gt; (but it doesn&#39;t draw the line):<br>
<br>
</div>See my comments in the code.<br>
<div><div></div><div class="Wj3C7c"><br>
<br>
<br>
&gt; ----------------------------------------------------------------------------------------------------------------------<br>
&gt; &lt;html&gt;<br>
&gt; &lt;head&gt;<br>
&gt; &nbsp; &nbsp; &lt;title&gt;prueba&lt;/title&gt;<br>
&gt;<br>
&gt; &nbsp; &nbsp; &lt;!-- this google key is fo <a href="HTTP://LOCALHOST" target="_blank">HTTP://LOCALHOST</a>, so it should go in your PC<br>
&gt; --&gt;<br>
&gt; &nbsp; &nbsp; &lt;script<br>
&gt; src=&quot;<a href="http://maps.google.com/maps?file=api&amp;amp;v=2&amp;amp;key=ABQIAAAAAdktgbP3W_jzENycyyxYmhT2yXp_ZAY8_ufC3CFXhHIE1NvwkxQAmpwRv0-s77497-2GnWVaa_ulwA" target="_blank">http://maps.google.com/maps?file=api&amp;amp;v=2&amp;amp;key=ABQIAAAAAdktgbP3W_jzENycyyxYmhT2yXp_ZAY8_ufC3CFXhHIE1NvwkxQAmpwRv0-s77497-2GnWVaa_ulwA</a>&quot;<br>

&gt; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;<br>
&gt; &nbsp; &nbsp; &lt;script src=&quot;<a href="http://openlayers.org/dev/OpenLayers.js" target="_blank">http://openlayers.org/dev/OpenLayers.js</a>&quot;&gt;&lt;/script&gt;<br>
&gt;<br>
&gt; &nbsp; &nbsp; &lt;script type=&quot;text/javascript&quot;&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; var lat=42.508;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; var lon=1.118;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; var map; //complex object of type OpenLayers.Map<br>
&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; function init() {<br>
&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//Initialise the &#39;map&#39; object<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; map = new OpenLayers.Map (&quot;map&quot;, {<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; controls:[<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; new OpenLayers.Control.Navigation(),<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; new OpenLayers.Control.PanZoomBar(),<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; new OpenLayers.Control.Attribution()],<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; maxExtent: new<br>
&gt; OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; maxResolution: 156543.0399,<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; units: &#39;m&#39;,<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; projection: new OpenLayers.Projection(&quot;EPSG:900913&quot;)<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } );<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var layergoogle = new OpenLayers.Layer.Google(&quot;Google Normal&quot;,<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{ type: G_NORMAL_MAP &nbsp; },<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#39;sphericalMercator&#39;: true,<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#39;projection&#39;: new OpenLayers.Projection(&quot;EPSG:900913&quot;)<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>
<br>
</div></div>Place the &#39;type&#39; and &#39;sphericalMercator&#39; properties in the same<br>
object. Remove the &#39;projection&#39; property.<br>
<br>
{<br>
 &nbsp; &nbsp;&#39;type&#39;: G_NORMAL_MAP,<br>
 &nbsp; &nbsp;&#39;sphericalMercator&#39;: true<br>
}<br>
<div class="Ih2E3d"><br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; );<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var vectores = new OpenLayers.Layer.Vector (&quot;Vector Features&quot;,<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{ &#39;projection&#39;: &nbsp;new OpenLayers.Projection(&quot;EPSG:4326&quot;),<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#39;displayProjection&#39;: new<br>
&gt; OpenLayers.Projection(&quot;EPSG:900913&quot;)<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; );<br>
<br>
</div>You do not need any options for the vector layer:<br>
<br>
var vectores = new OpenLayers.Layer.Vector (&quot;Vector Features&quot;);<br>
<div class="Ih2E3d"><br>
<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; map.addLayer(layergoogle);<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; map.addLayer(vectores);<br>
&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //line near Barcelona, spain, for example<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var p1 = new OpenLayers.Geometry.Point(2, 41);<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var p2 = new OpenLayers.Geometry.Point(41, 2);<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var points = [p1,p2];<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var lineString = new OpenLayers.Geometry.LineString(points);<br>
<br>
</div>Reproject your line string before creating the feature with it:<br>
<br>
lineString.transform(<br>
<div class="Ih2E3d"> &nbsp; &nbsp;new OpenLayers.Projection(&quot;EPSG:4326&quot;),<br>
</div><div class="Ih2E3d"> &nbsp; &nbsp;new OpenLayers.Projection(&quot;EPSG:900913&quot;)<br>
);<br>
<br>
</div><div class="Ih2E3d">&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var lineFeature = new OpenLayers.Feature.Vector(lineString,<br>
&gt; null, null);<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; features = [lineFeature];<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vectores.addFeatures( [features] );<br>
&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var lonLat = new OpenLayers.LonLat(2, 41)<br>
<br>
</div>Either pass mercator coordinates to the LonLat constructor or<br>
reproject it before passing to setCenter:<br>
<br>
lonLat.transform(<br>
<div class="Ih2E3d"> &nbsp; &nbsp;new OpenLayers.Projection(&quot;EPSG:4326&quot;),<br>
</div><div class="Ih2E3d"> &nbsp; &nbsp;new OpenLayers.Projection(&quot;EPSG:900913&quot;)<br>
);<br>
<br>
</div><div class="Ih2E3d">&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; map.setCenter(lonLat, 7);<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; }<br>
&gt; &nbsp; &nbsp; &lt;/script&gt;<br>
&gt; &lt;/head&gt;<br>
&gt; &lt;body onload=&quot;init();&quot;&gt;<br>
&gt; &nbsp; &nbsp; &lt;div style=&quot;width:500px; height:300px&quot; id=&quot;map&quot;&gt;&lt;/div&gt;<br>
&gt; &lt;/body&gt;<br>
&gt; &lt;/html&gt;<br>
<br>
</div>Hope this helps,<br>
<br>
Note that I haven&#39;t tested anything so there might still be errors lurking.<br>
<font color="#888888">--<br>
Eric<br>
_______________________________________________<br>
Dev mailing list<br>
<a href="mailto:Dev@openlayers.org">Dev@openlayers.org</a><br>
<a href="http://openlayers.org/mailman/listinfo/dev" target="_blank">http://openlayers.org/mailman/listinfo/dev</a><br>
</font></blockquote></div><br>