源码如下:
Function init(){
Var url= 'http://sampleserver1./ArcGIS/rest/services/Portland/ESRI_LandBase_WebMercator/MapServer';
var agsType=new ArcGISMapType(url);
var map=new GMap2(document.getElementById("map"),{mapTypes:[agsType]}); map.setCenter(new GLatLng(45.5, -122.7), 15);
}
如果你知道发布的地图服务的切片方案,也可以手动的加载地图
var tileInfo = {
"rows": 512,
"cols": 512,
"dpi": 96,
"origin": {
"x": -180,
"y": 90
},
"spatialReference": {
"wkid": 4326
},
"lods": [
{"level" : 0, "resolution" : 0.351562499999999, "scale" : 147748799.285417},
{"level" : 1, "resolution" : 0.17578125, "scale" : 73874399.6427087},
{"level" : 2, "resolution" : 0.0878906250000001, "scale" : 36937199.8213544},
{"level" : 3, "resolution" : 0.0439453125, "scale" : 18468599.9106772},
{"level" : 4, "resolution" : 0.02197265625, "scale" : 9234299.95533859},
{"level" : 5, "resolution" : 0.010986328125, "scale" : 4617149.97766929},
{"level" : 6, "resolution" : 0.0054931640625, "scale" : 2308574.98883465},
{"level" : 7, "resolution" : 0.00274658203124999, "scale" : 1154287.49441732},
{"level" : 8, "resolution" : 0.001373291015625, "scale" : 577143.747208662},
{"level" : 9, "resolution" : 0.0006866455078125, "scale" : 288571.873604331},
{"level" : 10, "resolution" : 0.000343322753906249, "scale" : 144285.936802165},
{"level" : 11, "resolution" : 0.000171661376953125, "scale" : 72142.9684010827},
{"level" : 12, "resolution" : 8.58306884765626E-05, "scale" : 36071.4842005414},
{"level" : 13, "resolution" : 4.29153442382813E-05, "scale" : 18035.7421002707},
{"level" : 14, "resolution" : 2.14576721191406E-05, "scale" : 9017.87105013534},
{"level" : 15, "resolution" : 1.07288360595703E-05, "scale" : 4508.93552506767}
]};
var url = 'http://sampleserver1./ArcGIS/rest/services/Portland/Portland_ESRI_LandBase_AGO/MapServer';
var agsType = new ArcGISMapType(url,{projection: new ArcGISProjection(tileInfo)});
// note no load event listener.
var map = new GMap2(document.getElementById("map"), { mapTypes: [agsType]});
map.setCenter(new GLatLng(45.5, -122.7), 15);
今天说的都是在google map里面连接ArcGIS Server发布的数据,下一次给大家讲讲在ArcGIS Server客户端API在连接google的数据