小编Tif*_*any的帖子

OpenLayers谷歌地图投影问题与KML

这是我第一次使用stackoverflow并使用Openlayers和Google Maps.

我一直在浏览不同的论坛和网站,包括OpenLayers.org,以解决我的问题.我已经完成了以下组​​合的搜索:openlayers,谷歌地图投影和球形墨卡托...但我还没有找到解决方案.

问题:当我放大和缩小地图时,来自Web服务调用(func setDataSource)的KML数据正在移动.我的猜测是我的代码中的预测错误或错误放置.我没有关于地图投影的任何背景,因此很难在线消化绘图术语:-(.有人可以帮忙吗?

   //start here
   var options = {
   projection: new OpenLayers.Projection("EPSG:900913"),
   displayProjection: new OpenLayers.Projection("EPSG:4326"),
   units: "m",
   numZoomLevels: 18,
              maxResolution: 156543.0339,
              maxExtent: new OpenLayers.Bounds(-20037508, -20037508,
                                              20037508, 20037508)}; 

   //*map = new OpenLayers.Map('map');

     map = new OpenLayers.Map('map', options);

    var gphy = new OpenLayers.Layer.Google(
             "Google Street",
    {'sphericalMercator':true});

   // Add the background images via WMS
  var bglayer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
               "http://labs.metacarta.com/wms/vmap0", {layers: 'basic'}, {'reproject': true});

  //map.addLayer(bglayer);
    map.addLayers([gphy, bglayer]);
  map.addControl(new OpenLayers.Control.LayerSwitcher());

   map.zoomToMaxExtent(); //* Zoom all the way out, this command also …
Run Code Online (Sandbox Code Playgroud)

google-maps projection openlayers proj4js

6
推荐指数
1
解决办法
7995
查看次数

标签 统计

google-maps ×1

openlayers ×1

proj4js ×1

projection ×1