I hope this helps you...<br><br><br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Oscar Fonts</b> <<a href="mailto:oscar.fonts.lists@gmail.com">oscar.fonts.lists@gmail.com</a>><br>
Date: 2008/6/6<br>Subject: Re: [OpenLayers-Dev] Please, help with vectors projection over google layer (really desperate)<br>To: Eric Lemoine <<a href="mailto:eric.c2c@gmail.com">eric.c2c@gmail.com</a>><br>Cc: Esteban olm <<a href="mailto:esteban.olm@gmail.com">esteban.olm@gmail.com</a>>, openlayers <<a href="mailto:dev@openlayers.org">dev@openlayers.org</a>><br>
<br><br>Eric, you'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> function init() {<br> var g = new OpenLayers.Projection("EPSG:4326");<br>
var p = new OpenLayers.Projection("EPSG:900913");<br><br> var options = {<br> projection: p,<br> displayProjection: g,<br> units: "m",<br>
maxResolution: 156543.0339,<br> maxExtent: new OpenLayers.Bounds(-20037508, -20037508,<br> 20037508, 20037508.34)<br> };<br> map = new OpenLayers.Map('map', options);<div class="Ih2E3d">
<br>
<br> var layergoogle = new OpenLayers.Layer.Google("Google Normal",<br></div> {type: G_NORMAL_MAP, 'sphericalMercator': true});<div class="Ih2E3d"><br> var vectores = new OpenLayers.Layer.Vector("Vector Features");<br>
</div>
map.addLayers([layergoogle, vectores]);<div class="Ih2E3d"><br><br> //line near Barcelona, spain, for example<br> var p1 = new OpenLayers.Geometry.Point(2, 41);<br> var p2 = new OpenLayers.Geometry.Point(41, 2);<br>
</div>
var lineString = new OpenLayers.Geometry.LineString([p1,p2]).transform(g, p);<div class="Ih2E3d"><br> var lineFeature = new OpenLayers.Feature.Vector(lineString, null, null); <br></div> vectores.addFeatures([lineFeature]);<br>
<br> var lonLat = new OpenLayers.LonLat(2, 41).transform(g, p);<br> map.setCenter(lonLat, 7);<br> }<br></div><br>