0

我有一张地图,其中底图的投影为“EPSG:32639”,底图上显示的 kml 图层的投影为“EPSG:4326”。它只显示我的底图,不显示任何 kml 图层。那有什么问题?

我的源代码在那里。

function initMap(){
            // if this is just a coverage or a group of them, disable a few items,
            // and default to jpeg format
            format = 'image/png';

            var bounds = new OpenLayers.Bounds(
                551438.385, 3602649.973,
                571430.791, 3627258.571
            );
            var options = {
                controls: [
                                            new OpenLayers.Control.Navigation( {mouseWheelOptions: {interval: 100}}),
                    new OpenLayers.Control.PanZoomBar(),
                                            new OpenLayers.Control.NavToolbar(),
                    new OpenLayers.Control.LayerSwitcher({'ascending':false}),
                    new OpenLayers.Control.Permalink(),
                    new OpenLayers.Control.ScaleLine(),
                    new OpenLayers.Control.MousePosition(),
                                            new OpenLayers.Control.Scale($('scale')),
                                            new OpenLayers.Control.OverviewMap(),
                    new OpenLayers.Control.KeyboardDefaults(),
                                            new OpenLayers.Control.ZoomBox({alwaysZoom:true})
                                            ],
                maxExtent: bounds,
                projection: 'EPSG:32639',
                units: 'm',
                                    maxResolution: 136.21203906250003,
                                    numZoomLevels: 10,
            };
            map = new OpenLayers.Map('map', options);


            tiled = new OpenLayers.Layer.TileCache('ESFAHANMAP',
             ['http://www.memap.ir/map'],'ESFAHANMAP',{'format':'image/jpeg',sphericalMercator: true, buffer: 0 });


                            kmlLayer = new OpenLayers.Layer.Vector('Points', 'point.kml',{
                                    projection: new OpenLayers.Projection('EPSG:4326')
                            });
                            map.addLayers([tiled,kmlLayer]);
            map.zoomToExtent(bounds);

        } 
4

1 回答 1

0

好吧,你不能在同一张地图上显示不同的投影。您需要将 KML 中的要素重新投影到与底图相同的投影。请参阅此处的示例

于 2011-02-04T11:49:59.273 回答