user1285411
user1285411

Reputation: 21

openlayers: cloudmade layer has slightly different projection than bing or osm

i have an openlayers map with different layers like bing or openstreetmap and also an cloudmade layer. bing and openstreetmap show the exact same location. if i switch the layer to cloudmade the position jumps about 200m.

any idea, how to change this?

var map, options;

        function init(){

        map = new OpenLayers.Map('map', {
        controls: [
                new OpenLayers.Control.Navigation(),
                new OpenLayers.Control.ScaleLine(),
                new OpenLayers.Control.Attribution(),
                new OpenLayers.Control.LayerSwitcher(),
                new OpenLayers.Control.PanZoomBar({minZoom: 12})

            ],
            minZoom:12,
            maxZoom:19          });


    var osm = new OpenLayers.Layer.OSM();


var binghybrid = new OpenLayers.Layer.Bing({
key: "MYKEY",
type: "AerialWithLabels",
name: "Satellite"});

var cloudmade = new OpenLayers.Layer.CloudMade("cloudmade", {
key: 'MYKEY',
styleId: 57439});


             map.addLayers([cloudmade, binghybrid, osm]);
    var epsg4326 = new OpenLayers.Projection("EPSG:4326");
    var center = new OpenLayers.LonLat(14.290556,48.303056).transform(epsg4326, map.getProjectionObject());
    map.setCenter(center, 14);

Upvotes: 2

Views: 1333

Answers (1)

drnextgis
drnextgis

Reputation: 2224

You should modify original OpenLayers.Layer.CloudMade class: change OpenLayers.Layer.TMS to OpenLayers.Layer.XYZ. Here is working example.

Upvotes: 4

Related Questions