views:

262

answers:

0

Hi! I'm trying to lay an KML over VirtualEarth Map in OpenLayers, but it doesn-t work. I guess it has to be something with the projection.

Map:
var options = {
    controls: [ new OpenLayers.Control.KeyboardDefaults(),
                new OpenLayers.Control.MouseDefaults(),
                new OpenLayers.Control.PanZoomBar(),
                new OpenLayers.Control.LayerSwitcher()
                ],
    maxExtent: new OpenLayers.Bounds( -200000, -200000, 200000, 200000),
    numZoomLevels: 19,
    units: 'm',
    projection: new OpenLayers.Projection("EPSG:900913"),
 displayProjection: new OpenLayers.Projection("EPSG:4326"),
sphericalMercator: true

};


map = new OpenLayers.Map("map", options);

var binghybrid = new OpenLayers.Layer.VirtualEarth("Hybrid", {
            type: VEMapStyle.Hybrid
});


KML:
var animals = new OpenLayers.Layer.Vector("Animals", {
           projection: new OpenLayers.Projection("EPSG:4326"),
            strategies: [new OpenLayers.Strategy.Fixed()],
            protocol: new OpenLayers.Protocol.HTTP({
                url: "kml/animals.kml",
                format: new OpenLayers.Format.KML({
                    extractStyles: true,
                    extractAttributes: true
                })
            })
        });

Anybody?! Thank you.