[OpenLayers-Users] KML over VirtualEarth Map doesn't display or has a shift

Stefan Keller sfkeller at gmail.com
Fri Apr 30 13:47:04 EDT 2010


Hi!

I'm trying to lay an KML over VirtualEarth Map in OpenLayers,
but it either does'nt display anything or KML points have a shift of 100m.
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?!



More information about the Users mailing list