天地图2.0和google卫星非偏移数据叠加

天地图2.0刚出来不久,新增了“球面墨卡托”投影,地图配色方面也有很大进步。 不过还是有吐槽的哈哈
http://www.cnblogs.com/gisvip/archive/2013/03/06/2945299.html


注:天地图采用的坐标系为国家标准的CGCS2000坐标系 
不过不管怎么样。今天发现一个最大的进步就是 天地图2.0 的瓦片数据("球面墨卡托”投影) 偏移很小【经过脱密变形处理】,能够和google非偏移的卫星图叠加比较完美。。相比其它的加偏处理要好很多。。。 
矢量地图采用天地图数据,卫星数据采用google非偏移数据。比较完美。。。。
先上个图 

道路数据和卫星数
据叠加比较完美

直接放代码

[代码]js代码:

001 <!DOCTYPE html>
002   
003 <html>
004   
005   <head>
006   
007     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
008   
009     <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
010   
011     <meta name="apple-mobile-web-app-capable" content="yes">
012   
013     <title>OpenLayers MapQuest Demo</title>
014   
015         <script src="http://www.openlayers.cn/olapi/OpenLayers.js"></script>
016   
017     <link rel="stylesheet" href="http://www.openlayers.cn/olapi/theme/default/style.css"type="text/css">
018   
019         <style type="text/css">
020   
021     .olImageLoadError
022   
023         {
024   
025     /*ol2.12   onImageLoadError no longer exists,  replace */
026   
027     display: none !important;
028   
029         }
030   
031     </style>
032   
033  
034       <script type="text/javascript">
035   
036  
037         var map,ctrlLyrSwitcher;
038   
039         function init(){
040   
041                  map = new OpenLayers.Map({
042   
043                 div: "map",
044   
045                 projection: "EPSG:900913",//EPSG:后不能有空格
046   
047                 displayProjection: new OpenLayers.Projection("EPSG:4326"),
048   
049                 numZoomLevels:20,
050   
051                 layers: [
052   
053         new OpenLayers.Layer.XYZ(
054   
055             "google",
056             [
057   
058                 "http://khm0.google.com/kh/v=123&x=${x}&y=${y}&z=${z}",
059   
060                                 "http://khm1.google.com/kh/v=123&x=${x}&y=${y}&z=${z}",
061   
062                 "http://khm2.google.com/kh/v=123&x=${x}&y=${y}&z=${z}",
063   
064                 "http://khm3.google.com/kh/v=123&x=${x}&y=${y}&z=${z}"
065   
066             ],
067   
068             {
069   
070                 //wrapDateLine: true,
071   
072                 transitionEffect: "resize"
073   
074             }
075   
076         ),
077   
078             new OpenLayers.Layer.XYZ(
079   
080                  "tianditu",
081   
082                  [
083   
084                   "http://tile0.chinaonmap.com/DataServer?T=vec_w&X=${x}&Y=${y}&L=${z}",
085   
086                   "http://tile1.chinaonmap.com/DataServer?T=vec_w&X=${x}&Y=${y}&L=${z}",
087   
088                   "http://tile2.chinaonmap.com/DataServer?T=vec_w&X=${x}&Y=${y}&L=${z}",
089   
090                   "http://tile3.chinaonmap.com/DataServer?T=vec_w&X=${x}&Y=${y}&L=${z}",
091   
092                   "http://tile4.chinaonmap.com/DataServer?T=vec_w&X=${x}&Y=${y}&L=${z}",
093   
094                   "http://tile5.chinaonmap.com/DataServer?T=vec_w&X=${x}&Y=${y}&L=${z}",
095   
096                   "http://tile6.chinaonmap.com/DataServer?T=vec_w&X=${x}&Y=${y}&L=${z}",
097   
098                   "http://tile7.chinaonmap.com/DataServer?T=vec_w&X=${x}&Y=${y}&L=${z}"
099   
100                  ],
101   
102                  {
103   
104                  //wrapDateLine: true
105   
106                  }
107   
108                  ),
109   
110                   new OpenLayers.Layer.XYZ(
111   
112                  "天地图中文注记",
113   
114                  [
115   
116                   "http://tile0.chinaonmap.com/DataServer?T=cva_w&X=${x}&Y=${y}&L=${z}",
117   
118                   "http://tile1.chinaonmap.com/DataServer?T=cva_w&X=${x}&Y=${y}&L=${z}",
119   
120                   "http://tile2.chinaonmap.com/DataServer?T=cva_w&X=${x}&Y=${y}&L=${z}",
121   
122                   "http://tile3.chinaonmap.com/DataServer?T=cva_w&X=${x}&Y=${y}&L=${z}",
123   
124                   "http://tile4.chinaonmap.com/DataServer?T=cva_w&X=${x}&Y=${y}&L=${z}",
125   
126                   "http://tile5.chinaonmap.com/DataServer?T=cva_w&X=${x}&Y=${y}&L=${z}",
127   
128                   "http://tile6.chinaonmap.com/DataServer?T=cva_w&X=${x}&Y=${y}&L=${z}",
129   
130                   "http://tile7.chinaonmap.com/DataServer?T=cva_w&X=${x}&Y=${y}&L=${z}"
131   
132                  ],
133   
134                  {
135   
136                  //wrapDateLine: true,
137   
138                  isBaseLayer: false,
139   
140                  visibility:false,
141   
142                  displayInLayerSwitcher:false
143   
144                  }
145   
146                  ),
147   
148                  new OpenLayers.Layer.XYZ(
149   
150                  "天地图卫星图标注",
151   
152                  [
153   
154                   "http://tile0.chinaonmap.com/DataServer?T=cia_w&X=${x}&Y=${y}&L=${z}",
155   
156                   "http://tile1.chinaonmap.com/DataServer?T=cia_w&X=${x}&Y=${y}&L=${z}",
157   
158                   "http://tile2.chinaonmap.com/DataServer?T=cia_w&X=${x}&Y=${y}&L=${z}",
159   
160                   "http://tile3.chinaonmap.com/DataServer?T=cia_w&X=${x}&Y=${y}&L=${z}",
161   
162                   "http://tile4.chinaonmap.com/DataServer?T=cia_w&X=${x}&Y=${y}&L=${z}",
163   
164                   "http://tile5.chinaonmap.com/DataServer?T=cia_w&X=${x}&Y=${y}&L=${z}",
165   
166                   "http://tile6.chinaonmap.com/DataServer?T=cia_w&X=${x}&Y=${y}&L=${z}",
167   
168                   "http://tile7.chinaonmap.com/DataServer?T=cia_w&X=${x}&Y=${y}&L=${z}"
169   
170                  ],
171   
172                  {
173   
174                 // wrapDateLine: true,
175   
176                  isBaseLayer: false
177   
178                  }
179   
180                  )
181   
182  
183     ],
184   
185     center: [0, 0],
186   
187     zoom: 1
188   
189 });
190   
191 ctrlLyrSwitcher=new OpenLayers.Control.LayerSwitcher();
192   
193 map.addControl(ctrlLyrSwitcher);
194   
195 map.addControl(new OpenLayers.Control.MousePosition());
196   
197 map.events.register("changebaselayer", map, function (soso) {updateLayerVisibility(soso)});
198   
199          
200   
201          
202   
203 }
204   
205  
206  
207 OpenLayers.Util.onImageLoadError = function() {
208                                 this.src = "http://www.openlayers.cn/olapi/img/blank.gif";
209   
210                                 //return "http://www.openlayers.cn/olapi/img/blank.gif";
211   
212                                  
213   
214                         };
215   
216 function updateLayerVisibility(soso)
217   
218 {
219   
220     if(soso.layer.name=="tianditu"){
221   
222         map.layers[3].setVisibility(false);
223   
224         map.layers[3].displayInLayerSwitcher=false;
225   
226  
227         map.layers[2].setVisibility(true);
228   
229         map.layers[2].displayInLayerSwitcher=true;
230   
231     }
232   
233     else{
234   
235         map.layers[2].displayInLayerSwitcher=false;
236   
237         map.layers[2].setVisibility(false);
238   
239  
240  
241  
242         map.layers[3].displayInLayerSwitcher=true;
243   
244         map.layers[3].setVisibility(true);
245   
246  
247  
248     }
249   
250     ctrlLyrSwitcher.layerStates = [];
251   
252     ctrlLyrSwitcher.redraw();
253   
254 }
255   
256  
257 </script>
258   
259 </head>
260   
261 <body onload="init()">
262   
263     <h1 id="title">google卫星非偏移和天地图2.0</h1>
264   
265     
266   
267     
268   
269     <div id="map" style="position:relative;width: 1000px;height: 600px;border: 1px solid #ccc;"></div>
270   
271  </body>
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值