Отображение вектора OSM + Яндекс

Привет всем. У меня вопрос на тему Как связать open layers c Яндексом. А точнее как вывести на него значение из kml файла, на OSM всё хорошо выводится а как быть с яндексом :slight_smile: мой примерчик ниже


<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
   <script src="http://www.openlayers.org/api/OpenLayers.js"></script>
    <script src="http://www.openstreetmap.org/openlayers/OpenStreetMap.js"></script>

<script type="text/javascript">

var map;
  var lat=52.273542;
  var lon=104.28768;
  var zoom=14;
  
    
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.getImagesLocation() + "404.png";
    } else {
        x = ((x % lim) + lim) % lim;
        var url = (this.url) ? this.url : "http://vec02.maps.yandex.net/";
        return url + "tiles?l=map&v=2.2.3&x=" + x + "&y=" + y + "&z=" + z;
    }
};
  
  
  
   function OLinit() {
        
      map = new OpenLayers.Map ("map", {
                controls:[
                    new OpenLayers.Control.Navigation(),
                    new OpenLayers.Control.PanZoomBar(),
                    new OpenLayers.Control.LayerSwitcher()],
            units: "m",
                maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),
                            maxResolution: 156543.0399,
                projection: new OpenLayers.Projection("EPSG:900913"),
                displayProjection: new OpenLayers.Projection("EPSG:4326")
            } );

         
   var sundials = new OpenLayers.Layer.Vector("KML", {
                projection: map.displayProjection,
                strategies: [new OpenLayers.Strategy.Fixed()],
                protocol: new OpenLayers.Protocol.HTTP({
                    url: "route.kml",
                    format: new OpenLayers.Format.KML({
                        extractStyles: true,
                        extractAttributes: true
                    })
                })
            });   
         
layerMapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik");
map.addLayer(layerMapnik);      
   

var YaBounds = new OpenLayers.Bounds(-20037508, -20002151, 20037508, 20072865);


var yandexMaps =
    new OpenLayers.Layer.TMS("Yandex.Maps", "http://vec02.maps.yandex.net/",
    {
        maxExtent: YaBounds,
        type: "png",
        getURL: yandex_getTileURL,
        numZoomLevels: 18,
        attribution: '<a href="http://beta-maps.yandex.ru/">Яндекс.Карты</a>',
        transitionEffect: 'resize'
    });

   
map.addLayers([yandexMaps]);


var lonLat = new OpenLayers.LonLat(lon, lat).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject());
      map.setCenter (lonLat, zoom);


map.addLayers([yandexMaps, sundials]);
     
     
    select = new OpenLayers.Control.SelectFeature(sundials);

     sundials.events.on({
                "featureselected": onFeatureSelect,
                "featureunselected": onFeatureUnselect
            });
    map.addControl(select);
    
    
    select.activate(); 
}

</script>

</HEAD>

<BODY onload="OLinit();">
<div id="map"></div>



projection: new OpenLayers.Projection("EPSG:900913"),

яндегс использует не EPSG:3857 (она же неофициальная EPSG:900913), а EPSG:3395
Поддерживает ли ее ваша версия OL надо смотреть, или же самому добавить функцию пересчета
в/из EPSG:4326

http://www.openlayers.org/api/OpenLayers.js не поддерживает EPSG:3395
Как решить проблему, описано здесь:
http://trac.osgeo.org/openlayers/wiki/Documentation/Dev/proj4js