<font color="#000000"><font size="2"><font face="trebuchet ms,sans-serif">IMHP<br>reprojecting the map is better than reprojecting each feature every time you switch beetween layers.<br>so in my project i set map options to<br>
projection: new OpenLayers.Projection("EPSG:900913"),<br> displayProjection: new OpenLayers.Projection("EPSG:4326"),<br> maxResolution: "auto",<br> maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),<br>
<br>and then add<br> gmap = new OpenLayers.Layer.Google("Google Terrain",{ type: G_PHYSICAL_MAP, sphericalMercator:true}); <br> bing = new OpenLayers.Layer.VirtualEarth("Aerial", { type: VEMapStyle.Aerial, sphericalMercator:true}); <br>
vector = new OpenLayers.Layer.Vector("vectors");<br><br>more info on reprojecting and spherical marcator at <a href="http://docs.openlayers.org/library/spherical_mercator.html">http://docs.openlayers.org/library/spherical_mercator.html</a><br>
<br>but i'm using ol since a month so may be i'm wrong!!<br><br><br>-Vito-<br><br><br><br></font></font></font>--<br>-----------<br>Tafuni Vito<br><a href="mailto:vito@vitotafuni.com">vito@vitotafuni.com</a><br>---------------------------------------------<br>
"Verba volant, scripta manent... data corrupted"<br>
<br><br><div class="gmail_quote">2010/7/1 <span dir="ltr"><<a href="mailto:christopher.schmidt@nokia.com">christopher.schmidt@nokia.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im"><br>
On Jun 30, 2010, at 7:02 PM, ext Stephen Woodbridge wrote:<br>
<br>
> Hi all,<br>
><br>
> I have an OL app setup the is using epsg4326 and everything it fine.<br>
> It has a mapserver base layer and a vector overlay with markers and<br>
> another with lines.<br>
><br>
> I have been asked to add Google as an additional base layer.<br>
><br>
> So my understanding is that the map object will take on the projection<br>
> of the base layer when you switch between them.<br>
><br>
> I have few questions:<br>
><br>
> 1. I assume that the vector features are not transformed when the base<br>
> layer is switched? Is this true? Which probably means I need to cycle<br>
> through the features and transform them to the base layers projection<br>
> something like:<br>
><br>
> map.events.register('changebaselayer', map, function(evt, element) {<br>
> var fromProj = map.getUnit()=='m'?epsg4326:epsg900913;<br>
> for (var i=0, var len=layer.features.length; i<len; i++)<br>
> layer.features[i].geometry.transform(fromProj,<br>
> map.getProjectionObject());<br>
> layer.redraw();<br>
> });<br>
<br>
</div>Yes.<br>
<div class="im"><br>
><br>
> 2. I have a WKT parser object. It need to reproject the features based<br>
> on the current base layer. Can I change the internalProjection on base<br>
> layer change like:<br>
><br>
> parser.internalProjection = map.getProjectionObject();<br>
<br>
</div>That should work.<br>
<br>
-- Chris<br>
<div><div></div><div class="h5"><br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@openlayers.org">Users@openlayers.org</a><br>
<a href="http://openlayers.org/mailman/listinfo/users" target="_blank">http://openlayers.org/mailman/listinfo/users</a><br>
</div></div></blockquote></div><br>