做地理信息系统(GIS)项目,除了实现功能用户体验度要好之外,最重要的是地图渲染效果更要好。很多时候苦于数据的完整性和对于配图的审美观,程序猿们都很难配出好看的地图效果。基于上述一般直接调用google的地图服务,包括矢量地图,地形地图和影像地图。这样就不用花大力气关注于数据的问题,只需要把地图的操作功能实现就行。下面来说说如何基于arcgis js api 调用google的地图服务。

首先我们需要知道google地图服务的地址:

http://mt.google.cn/vt/lyrs=s@112&hl=zh-CN&gl=cn  //卫星地图服务

http://mt.google.cn/vt/lyrs=h@177000000&hl=zh-CN&gl=cn    //地区名称矢量地图服务

http://mt.google.cn/vt/lyrs=m@112&hl=zh-CN&gl=cn    //矢量地图服务

jsapi 初始化google地图服务实现代码:

initGoogleMapLayer:function(){
dojo.declare("GoogleMapLayer", esri.layers.TiledMapServiceLayer, { // create WMTSLayer by extending esri.layers.TiledMapServiceLayer
constructor: function(){
this.spatialReference = new esri.SpatialReference({
wkid: 102113
});
this.initialExtent = new esri.geometry.Extent(-20037508.342787, -20037508.342787, 20037508.342787, 20037508.342787, this.spatialReference);
this.fullExtent = new esri.geometry.Extent(-20037508.342787, -20037508.342787, 20037508.342787, 20037508.342787, this.spatialReference);
//
this.tileInfo = new esri.layers.TileInfo({
"dpi": "90.71428571427429",
"format": "image/png",
"compressionQuality": 0,
"spatialReference": {
"wkid": "3857"
},
"rows": 256,
"cols": 256,
"origin": {
"x": -20037508.342787,
"y": 20037508.342787
}, // Scales in DPI 96
"lods": [{"level": 0,"scale": 591657527.591555,"resolution": 156543.033928
}, {"level": 1,"scale": 295828763.795777,"resolution": 78271.5169639999
}, {"level": 2,"scale": 147914381.897889,"resolution": 39135.7584820001
}, {"level": 3,"scale": 73957190.948944,"resolution": 19567.8792409999
}, {"level": 4,"scale": 36978595.474472,"resolution": 9783.93962049996
}, {"level": 5,"scale": 18489297.737236,"resolution": 4891.96981024998
}, {"level": 6,"scale": 9244648.868618,"resolution": 2445.98490512499
}, {"level": 7,"scale": 4622324.434309,"resolution": 1222.99245256249
}, {"level": 8,"scale": 2311162.217155,"resolution": 611.49622628138
}, {"level": 9,"scale": 1155581.108577,"resolution": 305.748113140558
}, {"level": 10,"scale": 577790.554289,"resolution": 152.874056570411
}, {"level": 11,"scale": 288895.277144,"resolution": 76.4370282850732
}, {"level": 12,"scale": 144447.638572,"resolution": 38.2185141425366
}, {"level": 13,"scale": 72223.819286,"resolution": 19.1092570712683
}, {"level": 14,"scale": 36111.909643,"resolution": 9.55462853563415
}, {"level": 15,"scale": 18055.954822,"resolution": 4.77731426794937
}, {"level": 16,"scale": 9027.977411,"resolution": 2.38865713397468
}, {"level": 17,"scale": 4513.988705,"resolution": 1.19432856685505
}, {"level": 18,"scale": 2256.994353,"resolution": 0.597164283559817
}, {"level": 19,"scale": 1128.497176,"resolution": 0.298582141647617
}]
});
this.loaded = true;
this.onLoad(this);
},
getTileUrl: function(level, row, col){
return "http://mt" + (col % 4) + ".google.cn/vt/lyrs=s@112&hl=zh-CN&gl=cn&" + "x=" + col + "&" +
"y=" +
row +
"&" +
"z=" +
level +
"&s=";
}
}); dojo.declare("GoogleMapAnooLayer", esri.layers.TiledMapServiceLayer, { // create WMTSLayer by extending esri.layers.TiledMapServiceLayer
constructor: function(){
this.spatialReference = new esri.SpatialReference({
wkid: 102113
});
this.initialExtent = new esri.geometry.Extent(-20037508.342787, -20037508.342787, 20037508.342787, 20037508.342787, this.spatialReference);
this.fullExtent = new esri.geometry.Extent(-20037508.342787, -20037508.342787, 20037508.342787, 20037508.342787, this.spatialReference);
//
this.tileInfo = new esri.layers.TileInfo({
"dpi": "90.71428571427429",
"format": "image/png",
"compressionQuality": 0,
"spatialReference": {
"wkid": "3857"
},
"rows": 256,
"cols": 256,
"origin": {
"x": -20037508.342787,
"y": 20037508.342787
}, // Scales in DPI 96
"lods": [{"level": 0,"scale": 591657527.591555,"resolution": 156543.033928
}, {"level": 1,"scale": 295828763.795777,"resolution": 78271.5169639999
}, {"level": 2,"scale": 147914381.897889,"resolution": 39135.7584820001
}, {"level": 3,"scale": 73957190.948944,"resolution": 19567.8792409999
}, {"level": 4,"scale": 36978595.474472,"resolution": 9783.93962049996
}, {"level": 5,"scale": 18489297.737236,"resolution": 4891.96981024998
}, {"level": 6,"scale": 9244648.868618,"resolution": 2445.98490512499
}, {"level": 7,"scale": 4622324.434309,"resolution": 1222.99245256249
}, {"level": 8,"scale": 2311162.217155,"resolution": 611.49622628138
}, {"level": 9,"scale": 1155581.108577,"resolution": 305.748113140558
}, {"level": 10,"scale": 577790.554289,"resolution": 152.874056570411
}, {"level": 11,"scale": 288895.277144,"resolution": 76.4370282850732
}, {"level": 12,"scale": 144447.638572,"resolution": 38.2185141425366
}, {"level": 13,"scale": 72223.819286,"resolution": 19.1092570712683
}, {"level": 14,"scale": 36111.909643,"resolution": 9.55462853563415
}, {"level": 15,"scale": 18055.954822,"resolution": 4.77731426794937
}, {"level": 16,"scale": 9027.977411,"resolution": 2.38865713397468
}, {"level": 17,"scale": 4513.988705,"resolution": 1.19432856685505
}, {"level": 18,"scale": 2256.994353,"resolution": 0.597164283559817
}, {"level": 19,"scale": 1128.497176,"resolution": 0.298582141647617
}]
});
this.loaded = true;
this.onLoad(this);
},
getTileUrl: function(level, row, col){
return "http://mt" + (col % 4) + ".google.cn/vt/lyrs=h@177000000&hl=zh-CN&gl=cn&" + "x=" + col + "&" +
"y=" +
row +
"&" +
"z=" +
level +
"&s=";
}
});
}

arcgis jsapi调用初始化的google地图服务:

var googleMapLayer = new GoogleMapLayer();
map.addLayer(googleMapLayer);

通过上面的代码实现就能把google地图服务,添加到自己的项目中。

arcgis jsapi 调用google地区服务的更多相关文章

  1. OpenLayers调用arcgis server发布的地图服务

    有两种方式可以调用arcgis server发布的地图服务,一种是rest,一种是wms.  地图的投影为900913,arcgis server为10.0版本,地图服务的空间参考为3857.   与 ...

  2. arcgis engine 调用arcgis server服务

    首先需要添加两个引用: using ESRI.ArcGIS.GISClient;using ESRI.ArcGIS.DataSourcesRaster; /// <summary> /// ...

  3. OpenLayers调用ArcGIS Server发布的WFS服务

    OpenLayers调用ArcGIS Server发布的WFS服务 原创: 蔡建良 2013-08-20 一. 开发环境 1) Openlayers2.13+arcgis server9.3 2) W ...

  4. 怎样用Google APIs和Google的应用系统进行集成(3)----调用Google 发现(Discovery)API的RESTful服务

    说了这么多,那么首先同意我以Google Discovery RESTful服务为例,给大家演示怎样用最普通的Java代码调用Google Discovery RESTful服务. 引言: 在&quo ...

  5. ArcGIS API for JavaScript(2)-ArcGIS Server发布要素图层服务

    1.前言 上一篇该系列的文章我们主要讲了一下基础Web地图搭建,这篇我们主要讲一下ArcGIS Server发布服务,并且如何调用服务.将自己的数据加载到Web地图当中来,实现Web端浏览数据. 2. ...

  6. arcgis jsapi接口入门系列(3):各种类型的图层添加

    这里说的tomcat切片,是指arcgis server切片后,把切片图片文件用tomcat发布(其他任意web服务器发布都行) //添加tomcat切片图层 addTomcatTileLayer: ...

  7. c#两种方式调用google地球,调用COM API以及调用GEPLUGIN 与js交互,加载kml文件,dae文件。将二维高德地图覆盖到到三维谷歌地球表面。

    网络上资源很多不全面,自己在开发的时候走了不少弯路,在这里整理了最全面的google全套开发,COM交互,web端交互.封装好了各种模块功能. 直接就可以调用. 第一种方式:调用COMAPI实现调用g ...

  8. Salesforce Apex页面中调用远端网络服务

    本文介绍了Salesforce Apex页面中调用远端网络服务的实现过程. ### 注册远端网络服务 在使用Apex代码调用远端网络服务之前,首先需要在Salesforce中注册远端网络服务地址, 本 ...

  9. Android按需添加Google Play服务

    以前无论使用何种Google Play服务,都是直接在gradle文件中引用一个库. compile 'com.google.android.gms:play-services:9.4.0' 这直接导 ...

随机推荐

  1. android 多媒体数据库详解

    主要分为几节: 1. Android的媒体文件内部是如何存储的? 2. Andoid的媒体文件如何获取? 3. 在使用媒体文件的一些小技巧. 1. Android的多媒体如何存储的? Android的 ...

  2. [置顶] Objective-C ,ios,iphone开发基础:命名规范

    命名规范:http://bukkake.iteye.com/blog/695492  点击打开链接

  3. "Invalid username/password or database/scan listener not up"

        文档 ID …         11.2 RAC DBconsole Creation Fails With Error: "Invalid username/password or ...

  4. c friend -- 友元

    c friend -- 友元 友元用于突破protected 或者 private 保护的限制,首先要做的是在被访问者的类中声明是友元函数或者友元类.代码如下 #include <iostrea ...

  5. C/C++中char* 与char []定义的区别

    转载请注明来自souldak,微博:@evagle Question: 给你一个字符串例如abb输出它包含的字符的所有可能排列. 例如abb输出3个:abb,bab,bba Answer: 假设我们自 ...

  6. 链栈之C++实现

    链栈是借用单链表实现的栈.其不同于顺序栈之处在于: 1.链栈的空间是程序运行期间根据需要动态分配的,机器内存是它的上限.而顺序栈则是 静态分配内存的. 2.链栈动态分配内存的特性使得它一般无需考虑栈溢 ...

  7. ExtJs4 笔记(7) Ext.tip.ToolTip 提示

    本篇介绍提示控件,ExtJs支持两种方式定义提示,可以支持普通html元素和一般的ExtJs UI控件. 一.基本提示 Ext.tip.ToolTip 1.最简单的提示 下面通过代码定义一个最简单的提 ...

  8. osc搜索引擎框架search-framework,TngouDB,gso,

    项目目的:OSChina 实现全文搜索的简单封装框架 License: Public Domain 包含内容: 重建索引工具 -> IndexRebuilder.java 增量构建索引工具 -& ...

  9. 承载于以太网帧之上的数据包的解析——ARP、IPv4、IPv6

    承接上一博文而来,继续解析网络数据包,对于承载在以太网上的三种协议进行了解析,主要是分为依据RFC定义的标准先解析头部数据,然后得到有效载荷,即为协议包括的实体数据,更上层进行进一步处理. 一.ARP ...

  10. java多线程12设计模式

    1.Single Threaded Execution Pattern(单线程运行模式) 2.Immutable Pattern(一成不变的模式) 3.Guarded Suspension Patte ...