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

Arnd Wippermann arnd.wippermann at web.de
Fri Apr 30 14:05:58 EDT 2010


Hi,

I think, you have add 'sphericalMercator' to your layer.

var vehyb = new OpenLayers.Layer.VirtualEarth(
    "Virtual Earth Hybrid",
    {'type': VEMapStyle.Hybrid, 'sphericalMercator': true}
);
 
Arnd

-----Ursprüngliche Nachricht-----
Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
Auftrag von Stefan Keller
Gesendet: Freitag, 30. April 2010 19:47
An: users at openlayers.org
Betreff: [OpenLayers-Users] KML over VirtualEarth Map doesn't display or
hasa shift

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?!
_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users




More information about the Users mailing list