<div class="gmail_quote">Hi all,<br><br>Just realised I //***************** then wrong line it should be: <br><br>var pixel = new VEPixel(x,y);<br><br>If you look at the original code it stated:<br><br>return new Msn.VE.Pixel
(x, y);<br><br>Therefore I would have expected this would have been the code replacement but it does not work..<br><br>Cheers,<br><br>Paul....<br><br><br>-------------------------------------------------------------<br>Hi all,
<br><br>OK I have been working on adapting OpenLayers to work with VE5 and 6.. In my un-educated knowledge of OpenLayers I see that the only change which needs to be made is within VirtualEarth.js on the function getMapObjectPixelFromXY. I have attempted different approaches (most shown in the function below) and none of them work. 
<br><br>The VE layer is being added fine but the panning of the map produces error within the VE validation code (when debuged and stepped through with VS2008 and IE and also object DOM exceptions in FireFox debugger). Within VS2008 the debugger indicates that all relevant x and y points are populated within OL, so I feel its more of an interaction problem between OL and VE?
<br><br>The test code, which is quite messy is as follows (there are different approaches here commented out) I feel that the //************************* is the best approach:<br><br>&nbsp;getMapObjectPixelFromXY: function(x, y) {
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; //return new Object (parseFloat(x), parseFloat(y));<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; /**try<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return new VEPixel(x,y);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; catch ()&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return new (VEPixel(0,0));
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }*/<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; try<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; var pixel = this.mapObject.LatLongToPixel(x, y);&nbsp;&nbsp;&nbsp; //*************************<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; //var pixel = this.mapObject.LatLongToPixel(this.mapObject.GetCenter

(), this.mapObject.GetZoomLevel());<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; //var pixel = this.mapObject.LatLongToPixel(this.mapObject.GetCenter(), 1);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; //var pixel = new VEPixel(x,y);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; alert (&quot;Created Pixel&quot;);
<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; alert (&quot;Pixel X = &quot; + pixel.x);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; alert (&quot;Pixel Y = &quot; + pixel.y);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return pixel;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch (err)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; txt=&quot;There was an error on this page.\n\n&quot;;
<br>&nbsp;&nbsp;&nbsp; &nbsp; txt+=&quot;Error description: &quot; + err.description + &quot;\n\n&quot;;<br>&nbsp;&nbsp;&nbsp; &nbsp; txt+=&quot;Click OK to continue.\n\n&quot;;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; alert(txt);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br><br>Does anyone have any ideas or pointers to why there are problems.
<br><br>Many thanks,<br><br>Paul....<br><br><br><div class="gmail_quote"><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="Ih2E3d">
Hi Paul,<br><br>
Between VE3 and VE5 the API have changed, and I think that the OL code<br>has not been adapted to those changes.<br>You should use Virtual Earth 3 API with OpenLayers, or hack OpenLayers<br>to work with VE5 (if you do this, please contribute that code to the
<br>project!)<br><br>Hope this helps<br></div><div><div></div><div><br><div class="Ih2E3d"><br>&gt; Hi All,<br>&gt;<br>&gt; Can anyone help please.<br>&gt;<br>&gt; I am using Virtual Earth version 5 and 6 and have problems utilising
<br>&gt; OpenLayers.<br>&gt;<br>&gt; I can get OpenLayers to work with version 3 and 4 of VE but not in the<br>&gt; latest versions.<br>&gt;<br>&gt; What happens is that the VE tiles are drawn but I have no control of VE,
<br>&gt; either panning/zooming changing 2D/3D / Running the VE JS functions. etc..<br>&gt; etc..<br>&gt;<br>&gt; Does anyone have any experience with VE5 + and openlayers and if so any idea<br>&gt; how to get round my particular problem.
<br>&gt;<br>&gt; The problem I have can be easily tested using the VE openlayers html and<br>&gt; changing the script line from version 3 to 5.<br>&gt;<br>&gt; Many thanks,<br>&gt;<br>&gt; Paul....<br></div></div></div><font color="#888888">

<br></font></blockquote></div><br>
</div><br>