| Version 2 (modified by euzuro, 7 years ago) |
|---|
VirtualEarth Layer
- Class Definition: trunk/openlayers/lib/OpenLayers/Layer/VirtualEarth.js
- API Reference: http://openlayers.org/doc/reference.html#OpenLayers.Layer.VirtualEarth
- Subclass of:
- Related Links:
How To Include a VirtualEarth Layer in OpenLayers
For a working example of a Virtual Earth Layer in OpenLayers, see examples/ve.html, running live from the repository.
- Include VirtualEarth Script
The first thing to do is to include the VirtualEarth library script on your HTML page, just before you include the OpenLayers.js script:<script src='http://dev.virtualearth.net/mapcontrol/v3/mapcontrol.js'></script> <script src="http://www.openlayers.org/api/OpenLayers.js"></script>
- Create the Virtual Earth Layer
Once you have correctly loaded the VirtualEarth script, you can create a new VirtualEarth Layer and add it to your Map.
The code should look something like this:var map = new OpenLayers.Map("mapDiv"); var veLayer = new OpenLayers.Layer.VirtualEarth("VE"); map.addLayer(veLayer);
