[OpenLayers-Dev] Fwd: OpenLayers and Virtual Earth version 5 +
Paul Huey
huey.paul at gmail.com
Fri Jan 11 09:19:44 EST 2008
Hi all,
Just realised I //***************** then wrong line it should be:
var pixel = new VEPixel(x,y);
If you look at the original code it stated:
return new Msn.VE.Pixel(x, y);
Therefore I would have expected this would have been the code replacement
but it does not work..
Cheers,
Paul....
-------------------------------------------------------------
Hi all,
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.
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?
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:
getMapObjectPixelFromXY: function(x, y) {
//return new Object (parseFloat(x), parseFloat(y));
/**try
{
return new VEPixel(x,y);
}
catch ()
{
return new (VEPixel(0,0));
}*/
try
{
var pixel = this.mapObject.LatLongToPixel(x, y);
//*************************
//var pixel = this.mapObject.LatLongToPixel(
this.mapObject.GetCenter (), this.mapObject.GetZoomLevel());
//var pixel = this.mapObject.LatLongToPixel(
this.mapObject.GetCenter(), 1);
//var pixel = new VEPixel(x,y);
alert ("Created Pixel");
alert ("Pixel X = " + pixel.x);
alert ("Pixel Y = " + pixel.y);
return pixel;
}
catch (err)
{
txt="There was an error on this page.\n\n";
txt+="Error description: " + err.description + "\n\n";
txt+="Click OK to continue.\n\n";
alert(txt);
}
}
Does anyone have any ideas or pointers to why there are problems.
Many thanks,
Paul....
Hi Paul,
>
> Between VE3 and VE5 the API have changed, and I think that the OL code
> has not been adapted to those changes.
> You should use Virtual Earth 3 API with OpenLayers, or hack OpenLayers
> to work with VE5 (if you do this, please contribute that code to the
> project!)
>
> Hope this helps
>
>
> > Hi All,
> >
> > Can anyone help please.
> >
> > I am using Virtual Earth version 5 and 6 and have problems utilising
> > OpenLayers.
> >
> > I can get OpenLayers to work with version 3 and 4 of VE but not in the
> > latest versions.
> >
> > What happens is that the VE tiles are drawn but I have no control of VE,
>
> > either panning/zooming changing 2D/3D / Running the VE JS functions.
> etc..
> > etc..
> >
> > Does anyone have any experience with VE5 + and openlayers and if so any
> idea
> > how to get round my particular problem.
> >
> > The problem I have can be easily tested using the VE openlayers html and
> > changing the script line from version 3 to 5.
> >
> > Many thanks,
> >
> > Paul....
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20080111/6dd2e6a0/attachment.html
More information about the Dev
mailing list