I am kind of new for openlayers and I am working on a project that have many different layers. one of this layer is Yandex, I added this layer few days ago and it seems to work fine, untill QA :) discovered that when you switch from this layer to another it not position the same as the other layer, I added this layer base on the following article (couldn't find anything else that show how to add the Yandex) http://xbb.uz/openlayers/i-Yandex.Maps

when I have lines layer on the map and change the base layer from google, bing or any other layer to yandex the lines or the yandex layer are not positioned right. YANDEX layer enter image description here

OPEN STREET MAP LAYER enter image description here

closed as off-topic by PolyGeo Oct 15 '15 at 8:44

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking help to debug/write/improve code must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Providing a clear problem statement and evidence of a code attempt will help others to help you. See: How to create a Minimal, Complete, and Verifiable example." – PolyGeo
If this question can be reworded to fit the rules in the help center, please edit the question.

  • I am also trying to put a Yandex layer on OpenLayers. Did you solve it? It is something to do with the projections but I cannot find a solution anywhere. My code is: function yandex_getTileURL(bounds) { var r = this.map.getResolution(); var maxExt = (this.maxExtent) ? this.maxExtent : YaBounds; var w = (this.tileSize) ? this.tileSize.w : 256; var h = (this.tileSize) ? this.tileSize.h : 256; var x = Math.round((bounds.left - maxExt.left)/(r * w)); var y = Math.round((maxExt.top - bounds.top)/(r * h)); var z = this.map.getZoom(); var lim = Math.pow(2, z); if (y <0>= lim) { return OpenLayers.Util – user22149 Sep 19 '13 at 18:22
  • No I still got no solution for it. I am working on finding a solution for it and I will update this post as soon as I will find a solution. – talsibony Sep 24 '13 at 5:43

I believe that the projection there is not correct.

By common experience Yandex maps are in EPSG:3395, but Openlayers cannot handle it by itself. You'd need also to include proj4.js, then define a projection somethere:

proj4.defs('EPSG:3395', '+proj=merc +datum=WGS84 +ellps=WGS84 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +no_defs')


maxExtent: [-20037508.342789248, -20037508.342789248, 20037508.342789248, 20037508.342789248],

BTW there is a type in the code:

if (y <0>= lim) {

Not the answer you're looking for? Browse other questions tagged or ask your own question.