博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
《ArcGIS Runtime SDK for Android开发笔记》——(13)、图层扩展方式加载Google地图...
阅读量:6983 次
发布时间:2019-06-27

本文共 3694 字,大约阅读时间需要 12 分钟。

1、前言

http://mt2.google.cn/vt/lyrs=m@225000000&hl=zh-CN&gl=cn&x=420&y=193&z=9&s=Galil

通过图层扩展类的方式加载Google地图的是我们通常获取Google地图的一种方式,根据这种方式我们可以通过拼接地图瓦片Url字符串获取瓦片数据,关于Google瓦片算法的解析网上有很多,以下仅列出博客地址,及具体实现类。

 :http://blog.csdn.net/hugoandpig/article/details/7719307

转载请注明出处: 

2、Google地图的自定义扩展类

package com.seraph.collect.BaseComp.MapLayer;import java.util.Map;import java.util.concurrent.RejectedExecutionException;import android.util.Log;import com.esri.android.map.TiledServiceLayer;import com.esri.core.geometry.Envelope;import com.esri.core.geometry.Point;import com.esri.core.geometry.SpatialReference;/** *Google地图加载 */public class GoogleMapLayer extends TiledServiceLayer {    private int minLevel = 0;    private int maxLevel = 19;    private String[] subDomains = new String[] { "mt1", "mt2", "mt3" };    private double[] scales = new double[] { 591657527.591555,            295828763.79577702, 147914381.89788899, 73957190.948944002,            36978595.474472001, 18489297.737236001, 9244648.8686180003,            4622324.4343090001, 2311162.217155, 1155581.108577, 577790.554289,            288895.277144, 144447.638572, 72223.819286, 36111.909643,            18055.954822, 9027.9774109999998, 4513.9887049999998, 2256.994353,            1128.4971760000001 };    private double[] resolutions = new double[] { 156543.03392800014,            78271.516963999937, 39135.758482000092, 19567.879240999919,            9783.9396204999593, 4891.9698102499797, 2445.9849051249898,            1222.9924525624949, 611.49622628138, 305.748113140558,            152.874056570411, 76.4370282850732, 38.2185141425366,            19.1092570712683, 9.55462853563415, 4.7773142679493699,            2.3886571339746849, 1.1943285668550503, 0.59716428355981721,            0.29858214164761665 };    private Point origin = new Point(-20037508.342787, 20037508.342787);    private int dpi = 96;    private int tileWidth = 256;    private int tileHeight = 256;    public GoogleMapLayer() {        super(true);        this.init();    }    private void init() {        try {            getServiceExecutor().submit(new Runnable() {                public void run() {                    GoogleMapLayer.this.initLayer();                }            });        } catch (RejectedExecutionException rejectedexecutionexception) {            Log.e("Google Map Layer", "initialization of the layer failed.",                    rejectedexecutionexception);        }    }    protected byte[] getTile(int level, int col, int row) throws Exception {        if (level > maxLevel || level < minLevel)            return new byte[0];        String subDomain = subDomains[(level + col + row) % subDomains.length];          //构建待拼接字符串      String _mapType = "m@225000000";        String url = "http://" + subDomain                + ".google.cn/vt/lyrs=" + _mapType + "&hl=zh-CN&gl=CN&src=app&" + "x=" + col + "&" + "y=" + row + "&" + "z=" + level + "&s=Ga";        Map
map = null; return com.esri.core.internal.io.handler.a.a(url, map); } protected void initLayer() { if (getID() == 0L) { nativeHandle = create(); changeStatus(com.esri.android.map.event.OnStatusChangedListener.STATUS .fromInt(-1000)); } else { this.setDefaultSpatialReference(SpatialReference.create(102113)); this.setFullExtent(new Envelope(-22041257.773878, -32673939.6727517, 22041257.773878, 20851350.0432886)); this.setTileInfo(new TileInfo(origin, scales, resolutions, scales.length, dpi, tileWidth, tileHeight)); super.initLayer(); } }}

 

转载于:https://www.cnblogs.com/gis-luq/p/5443498.html

你可能感兴趣的文章
(实践篇)剖析最近项目使用的一个框架
查看>>
tigerVNC的简单使用教程(CentOS的远程桌面连接)
查看>>
组合数据类型综合练习:英文词频统计
查看>>
文献综述八:基于JAVA的商品网站的研究
查看>>
iOS 应用有用户评论功能 因为潜在色情信息被退回解决方案
查看>>
usaco Typo
查看>>
DataTable 实现新增加合计行
查看>>
字符串
查看>>
创建对象的三种方式
查看>>
spring学习之spring 插件 for eclipse
查看>>
js-sha256源码
查看>>
运维笔试题
查看>>
dispaly、position、float之间的关系与相互作用
查看>>
MyEclipse加入jquery.js文件missing semicolon的错误
查看>>
axis1.4生成客户端
查看>>
MI-NOTE黑砖
查看>>
WinForm中Component Class、User Control及Custom Control的区别和使用建议
查看>>
地区选择控件杂记
查看>>
来自工程师的8项Web性能提升建议
查看>>
dns配置文件
查看>>