距离上一篇arcgis for Android 已经很久。其实年初的时候就测试了arcgis for Android 100.1版本。搜集网上各篇文章,最后自已测试代码。修改代码。这一篇来讲一下加载在线的天地图和谷歌地图。

arcgis for Android 100.1 基本操作(缩小放大旋转定位)

1、效果图

加载天地图没有问题,只是我测试谷歌时候,只能看到屏幕上这些地图,其他滑动出去,就没有,不知道为什么。有知道的大神可以评论一下。

1、天地图的代码

这个网上搜集代码,封装好的天地图使用类:

package com.arcgis.until;import com.esri.arcgisruntime.arcgisservices.LevelOfDetail;
import com.esri.arcgisruntime.arcgisservices.TileInfo;
import com.esri.arcgisruntime.geometry.Envelope;
import com.esri.arcgisruntime.geometry.Point;
import com.esri.arcgisruntime.geometry.SpatialReference;
import com.esri.arcgisruntime.layers.WebTiledLayer;import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;/*** 天地图*/public class TianDiTuMethodsClass {private static final List<String> SubDomain = Arrays.asList(new String[]{"t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7"});private static final String URL_VECTOR_2000 = "http://{subDomain}.tianditu.com/DataServer?T=vec_c&x={col}&y={row}&l={level}";private static final String URL_VECTOR_ANNOTATION_CHINESE_2000 = "http://{subDomain}.tianditu.com/DataServer?T=cva_c&x={col}&y={row}&l={level}";private static final String URL_VECTOR_ANNOTATION_ENGLISH_2000 = "http://{subDomain}.tianditu.com/DataServer?T=eva_c&x={col}&y={row}&l={level}";private static final String URL_IMAGE_2000 = "http://{subDomain}.tianditu.com/DataServer?T=img_c&x={col}&y={row}&l={level}";private static final String URL_IMAGE_ANNOTATION_CHINESE_2000 = "http://{subDomain}.tianditu.com/DataServer?T=cia_c&x={col}&y={row}&l={level}";private static final String URL_IMAGE_ANNOTATION_ENGLISH_2000 = "http://{subDomain}.tianditu.com/DataServer?T=eia_c&x={col}&y={row}&l={level}";private static final String URL_TERRAIN_2000 = "http://{subDomain}.tianditu.com/DataServer?T=ter_c&x={col}&y={row}&l={level}";private static final String URL_TERRAIN_ANNOTATION_CHINESE_2000 = "http://{subDomain}.tianditu.com/DataServer?T=cta_c&x={col}&y={row}&l={level}";private static final String URL_VECTOR_MERCATOR = "http://{subDomain}.tianditu.com/DataServer?T=vec_w&x={col}&y={row}&l={level}";private static final String URL_VECTOR_ANNOTATION_CHINESE_MERCATOR = "http://{subDomain}.tianditu.com/DataServer?T=cva_w&x={col}&y={row}&l={level}";private static final String URL_VECTOR_ANNOTATION_ENGLISH_MERCATOR = "http://{subDomain}.tianditu.com/DataServer?T=eva_w&x={col}&y={row}&l={level}";private static final String URL_IMAGE_MERCATOR = "http://{subDomain}.tianditu.com/DataServer?T=img_w&x={col}&y={row}&l={level}";private static final String URL_IMAGE_ANNOTATION_CHINESE_MERCATOR = "http://{subDomain}.tianditu.com/DataServer?T=cia_w&x={col}&y={row}&l={level}";private static final String URL_IMAGE_ANNOTATION_ENGLISH_MERCATOR = "http://{subDomain}.tianditu.com/DataServer?T=eia_w&x={col}&y={row}&l={level}";private static final String URL_TERRAIN_MERCATOR = "http://{subDomain}.tianditu.com/DataServer?T=ter_w&x={col}&y={row}&l={level}";private static final String URL_TERRAIN_ANNOTATION_CHINESE_MERCATOR = "http://{subDomain}.tianditu.com/DataServer?T=cta_w&x={col}&y={row}&l={level}";private static final int DPI = 96;private static final int minZoomLevel = 1;private static final int maxZoomLevel = 18;private static final int tileWidth = 256;private static final int tileHeight = 256;private static final String LAYER_NAME_VECTOR = "vec";private static final String LAYER_NAME_VECTOR_ANNOTATION_CHINESE = "cva";private static final String LAYER_NAME_VECTOR_ANNOTATION_ENGLISH = "eva";private static final String LAYER_NAME_IMAGE = "img";private static final String LAYER_NAME_IMAGE_ANNOTATION_CHINESE = "cia";private static final String LAYER_NAME_IMAGE_ANNOTATION_ENGLISH = "eia";private static final String LAYER_NAME_TERRAIN = "ter";private static final String LAYER_NAME_TERRAIN_ANNOTATION_CHINESE = "cta";private static final SpatialReference SRID_2000 = SpatialReference.create(4490);private static final SpatialReference SRID_MERCATOR = SpatialReference.create(102100);private static final double X_MIN_2000 = -180;private static final double Y_MIN_2000 = -90;private static final double X_MAX_2000 = 180;private static final double Y_MAX_2000 = 90;private static final double X_MIN_MERCATOR = -20037508.3427892;private static final double Y_MIN_MERCATOR = -20037508.3427892;private static final double X_MAX_MERCATOR = 20037508.3427892;private static final double Y_MAX_MERCATOR = 20037508.3427892;private static final Point ORIGIN_2000 = new Point(-180, 90, SRID_2000);private static final Point ORIGIN_MERCATOR = new Point(-20037508.3427892, 20037508.3427892, SRID_MERCATOR);private static final Envelope ENVELOPE_2000 = new Envelope(X_MIN_2000, Y_MIN_2000, X_MAX_2000, Y_MAX_2000, SRID_2000);private static final Envelope ENVELOPE_MERCATOR = new Envelope(X_MIN_MERCATOR, Y_MIN_MERCATOR, X_MAX_MERCATOR, Y_MAX_MERCATOR, SRID_MERCATOR);private static final double[] SCALES = {2.958293554545656E8, 1.479146777272828E8,7.39573388636414E7, 3.69786694318207E7,1.848933471591035E7, 9244667.357955175,4622333.678977588, 2311166.839488794,1155583.419744397, 577791.7098721985,288895.85493609926, 144447.92746804963,72223.96373402482, 36111.98186701241,18055.990933506204, 9027.995466753102,4513.997733376551, 2256.998866688275,1128.4994333441375};private static final double[] RESOLUTIONS_MERCATOR = {78271.51696402048, 39135.75848201024,19567.87924100512, 9783.93962050256,4891.96981025128, 2445.98490512564,1222.99245256282, 611.49622628141,305.748113140705, 152.8740565703525,76.43702828517625, 38.21851414258813,19.109257071294063, 9.554628535647032,4.777314267823516, 2.388657133911758,1.194328566955879, 0.5971642834779395,0.298582141738970};private static final double[] RESOLUTIONS_2000 = {0.7031249999891485, 0.35156249999999994,0.17578124999999997, 0.08789062500000014,0.04394531250000007, 0.021972656250000007,0.01098632812500002, 0.00549316406250001,0.0027465820312500017, 0.0013732910156250009,0.000686645507812499, 0.0003433227539062495,0.00017166137695312503, 0.00008583068847656251,0.000042915344238281406, 0.000021457672119140645,0.000010728836059570307, 0.000005364418029785169};public static WebTiledLayer CreateTianDiTuTiledLayer(String layerType) {return CreateTianDiTuTiledLayer(getTianDiTuLayerType(layerType));}public static WebTiledLayer CreateTianDiTuTiledLayer(LayerType layerType) {WebTiledLayer webTiledLayer = null;String mainUrl = "";String mainName = "";TileInfo mainTileInfo = null;Envelope mainEnvelope = null;boolean mainIs2000 = false;try {switch (layerType) {case TIANDITU_VECTOR_2000:mainUrl = URL_VECTOR_2000;mainName = LAYER_NAME_VECTOR;mainIs2000 = true;break;case TIANDITU_VECTOR_MERCATOR:mainUrl = URL_VECTOR_MERCATOR;mainName = LAYER_NAME_VECTOR;break;case TIANDITU_IMAGE_2000:mainUrl = URL_IMAGE_2000;mainName = LAYER_NAME_IMAGE;mainIs2000 = true;break;case TIANDITU_IMAGE_ANNOTATION_CHINESE_2000:mainUrl = URL_IMAGE_ANNOTATION_CHINESE_2000;mainName = LAYER_NAME_IMAGE_ANNOTATION_CHINESE;mainIs2000 = true;break;case TIANDITU_IMAGE_ANNOTATION_ENGLISH_2000:mainUrl = URL_IMAGE_ANNOTATION_ENGLISH_2000;mainName = LAYER_NAME_IMAGE_ANNOTATION_ENGLISH;mainIs2000 = true;break;case TIANDITU_IMAGE_ANNOTATION_CHINESE_MERCATOR:mainUrl = URL_IMAGE_ANNOTATION_CHINESE_MERCATOR;mainName = LAYER_NAME_IMAGE_ANNOTATION_CHINESE;break;case TIANDITU_IMAGE_ANNOTATION_ENGLISH_MERCATOR:mainUrl = URL_IMAGE_ANNOTATION_ENGLISH_MERCATOR;mainName = LAYER_NAME_IMAGE_ANNOTATION_ENGLISH;break;case TIANDITU_IMAGE_MERCATOR:mainUrl = URL_IMAGE_MERCATOR;mainName = LAYER_NAME_IMAGE;break;case TIANDITU_VECTOR_ANNOTATION_CHINESE_2000:mainUrl = URL_VECTOR_ANNOTATION_CHINESE_2000;mainName = LAYER_NAME_VECTOR_ANNOTATION_CHINESE;mainIs2000 = true;break;case TIANDITU_VECTOR_ANNOTATION_ENGLISH_2000:mainUrl = URL_VECTOR_ANNOTATION_ENGLISH_2000;mainName = LAYER_NAME_VECTOR_ANNOTATION_ENGLISH;mainIs2000 = true;break;case TIANDITU_VECTOR_ANNOTATION_CHINESE_MERCATOR:mainUrl = URL_VECTOR_ANNOTATION_CHINESE_MERCATOR;mainName = LAYER_NAME_VECTOR_ANNOTATION_CHINESE;break;case TIANDITU_VECTOR_ANNOTATION_ENGLISH_MERCATOR:mainUrl = URL_VECTOR_ANNOTATION_ENGLISH_MERCATOR;mainName = LAYER_NAME_VECTOR_ANNOTATION_ENGLISH;break;case TIANDITU_TERRAIN_2000:mainUrl = URL_TERRAIN_2000;mainName = LAYER_NAME_TERRAIN;mainIs2000 = true;break;case TIANDITU_TERRAIN_ANNOTATION_CHINESE_2000:mainUrl = URL_TERRAIN_ANNOTATION_CHINESE_2000;mainName = LAYER_NAME_TERRAIN_ANNOTATION_CHINESE;mainIs2000 = true;break;case TIANDITU_TERRAIN_MERCATOR:mainUrl = URL_TERRAIN_MERCATOR;mainName = LAYER_NAME_TERRAIN;break;case TIANDITU_TERRAIN_ANNOTATION_CHINESE_MERCATOR:mainUrl = URL_TERRAIN_ANNOTATION_CHINESE_MERCATOR;mainName = LAYER_NAME_TERRAIN_ANNOTATION_CHINESE;break;}List<LevelOfDetail> mainLevelOfDetail = new ArrayList<LevelOfDetail>();Point mainOrigin = null;if (mainIs2000 == true) {for (int i = minZoomLevel; i <= maxZoomLevel; i++) {LevelOfDetail item = new LevelOfDetail(i, RESOLUTIONS_2000[i - 1], SCALES[i - 1]);mainLevelOfDetail.add(item);}mainEnvelope = ENVELOPE_2000;mainOrigin = ORIGIN_2000;} else {for (int i = minZoomLevel; i <= maxZoomLevel; i++) {LevelOfDetail item = new LevelOfDetail(i, RESOLUTIONS_MERCATOR[i - 1], SCALES[i - 1]);mainLevelOfDetail.add(item);}mainEnvelope = ENVELOPE_MERCATOR;mainOrigin = ORIGIN_MERCATOR;}mainTileInfo = new TileInfo(DPI,TileInfo.ImageFormat.PNG24,mainLevelOfDetail,mainOrigin,mainOrigin.getSpatialReference(),tileHeight,tileWidth);webTiledLayer = new WebTiledLayer(mainUrl,SubDomain,mainTileInfo,mainEnvelope);webTiledLayer.setName(mainName);webTiledLayer.loadAsync();} catch (Exception e) {e.getCause();}return webTiledLayer;}protected static LayerType getTianDiTuLayerType(String layerType) {LayerType result = LayerType.TIANDITU_VECTOR_2000;switch (layerType) {/*** 天地图矢量墨卡托投影地图服务*/case "TIANDITU_VECTOR_MERCATOR":result = LayerType.TIANDITU_VECTOR_MERCATOR;break;/*** 天地图矢量墨卡托中文标注*/case "TIANDITU_VECTOR_ANNOTATION_CHINESE_MERCATOR":result = LayerType.TIANDITU_VECTOR_ANNOTATION_CHINESE_MERCATOR;break;/*** 天地图矢量墨卡托英文标注*/case "TIANDITU_VECTOR_ANNOTATION_ENGLISH_MERCATOR":result = LayerType.TIANDITU_VECTOR_ANNOTATION_ENGLISH_MERCATOR;break;/*** 天地图影像墨卡托投影地图服务*/case "TIANDITU_IMAGE_MERCATOR":result = LayerType.TIANDITU_IMAGE_MERCATOR;break;/*** 天地图影像墨卡托投影中文标注*/case "TIANDITU_IMAGE_ANNOTATION_CHINESE_MERCATOR":result = LayerType.TIANDITU_IMAGE_ANNOTATION_CHINESE_MERCATOR;break;/*** 天地图影像墨卡托投影英文标注*/case "TIANDITU_IMAGE_ANNOTATION_ENGLISH_MERCATOR":result = LayerType.TIANDITU_IMAGE_ANNOTATION_ENGLISH_MERCATOR;break;/*** 天地图地形墨卡托投影地图服务*/case "TIANDITU_TERRAIN_MERCATOR":result = LayerType.TIANDITU_TERRAIN_MERCATOR;break;/*** 天地图地形墨卡托投影中文标注*/case "TIANDITU_TERRAIN_ANNOTATION_CHINESE_MERCATOR":result = LayerType.TIANDITU_TERRAIN_ANNOTATION_CHINESE_MERCATOR;break;/*** 天地图矢量国家2000坐标系地图服务*/case "TIANDITU_VECTOR_2000":result = LayerType.TIANDITU_VECTOR_2000;break;/*** 天地图矢量国家2000坐标系中文标注*/case "TIANDITU_VECTOR_ANNOTATION_CHINESE_2000":result = LayerType.TIANDITU_VECTOR_ANNOTATION_CHINESE_2000;break;/*** 天地图矢量国家2000坐标系英文标注*/case "TIANDITU_VECTOR_ANNOTATION_ENGLISH_2000":result = LayerType.TIANDITU_VECTOR_ANNOTATION_ENGLISH_2000;break;/*** 天地图影像国家2000坐标系地图服务*/case "TIANDITU_IMAGE_2000":result = LayerType.TIANDITU_IMAGE_2000;break;/*** 天地图影像国家2000坐标系中文标注*/case "TIANDITU_IMAGE_ANNOTATION_CHINESE_2000":result = LayerType.TIANDITU_IMAGE_ANNOTATION_CHINESE_2000;break;/*** 天地图影像国家2000坐标系英文标注*/case "TIANDITU_IMAGE_ANNOTATION_ENGLISH_2000":result = LayerType.TIANDITU_IMAGE_ANNOTATION_ENGLISH_2000;break;/*** 天地图地形国家2000坐标系地图服务*/case "TIANDITU_TERRAIN_2000":result = LayerType.TIANDITU_TERRAIN_2000;break;/*** 天地图地形国家2000坐标系中文标注*/case "TIANDITU_TERRAIN_ANNOTATION_CHINESE_2000":result = LayerType.TIANDITU_TERRAIN_ANNOTATION_CHINESE_2000;break;}return result;}public enum LayerType {/*** 天地图矢量墨卡托投影地图服务*/TIANDITU_VECTOR_MERCATOR,/*** 天地图矢量墨卡托中文标注*/TIANDITU_VECTOR_ANNOTATION_CHINESE_MERCATOR,/*** 天地图矢量墨卡托英文标注*/TIANDITU_VECTOR_ANNOTATION_ENGLISH_MERCATOR,/*** 天地图影像墨卡托投影地图服务*/TIANDITU_IMAGE_MERCATOR,/*** 天地图影像墨卡托投影中文标注*/TIANDITU_IMAGE_ANNOTATION_CHINESE_MERCATOR,/*** 天地图影像墨卡托投影英文标注*/TIANDITU_IMAGE_ANNOTATION_ENGLISH_MERCATOR,/*** 天地图地形墨卡托投影地图服务*/TIANDITU_TERRAIN_MERCATOR,/*** 天地图地形墨卡托投影中文标注*/TIANDITU_TERRAIN_ANNOTATION_CHINESE_MERCATOR,/*** 天地图矢量国家2000坐标系地图服务*/TIANDITU_VECTOR_2000,/*** 天地图矢量国家2000坐标系中文标注*/TIANDITU_VECTOR_ANNOTATION_CHINESE_2000,/*** 天地图矢量国家2000坐标系英文标注*/TIANDITU_VECTOR_ANNOTATION_ENGLISH_2000,/*** 天地图影像国家2000坐标系地图服务*/TIANDITU_IMAGE_2000,/*** 天地图影像国家2000坐标系中文标注*/TIANDITU_IMAGE_ANNOTATION_CHINESE_2000,/*** 天地图影像国家2000坐标系英文标注*/TIANDITU_IMAGE_ANNOTATION_ENGLISH_2000,/*** 天地图地形国家2000坐标系地图服务*/TIANDITU_TERRAIN_2000,/*** 天地图地形国家2000坐标系中文标注*/TIANDITU_TERRAIN_ANNOTATION_CHINESE_2000}
}

调用方式:

package com.arcgis.activity;import android.os.Bundle;
import android.os.Environment;
import android.support.v7.app.AppCompatActivity;import com.arcgis.R;
import com.arcgis.until.TianDiTuMethodsClass;
import com.esri.arcgisruntime.geometry.Point;
import com.esri.arcgisruntime.geometry.SpatialReference;
import com.esri.arcgisruntime.layers.ArcGISTiledLayer;
import com.esri.arcgisruntime.layers.WebTiledLayer;
import com.esri.arcgisruntime.loadable.LoadStatus;
import com.esri.arcgisruntime.mapping.ArcGISMap;
import com.esri.arcgisruntime.mapping.Basemap;
import com.esri.arcgisruntime.mapping.Viewpoint;
import com.esri.arcgisruntime.mapping.view.MapView;import java.util.Arrays;
import java.util.List;public class ArcgisTiandituMapActivity extends AppCompatActivity {private MapView mMapView;//影像地图 _W是墨卡托投影  _c是国家2000的坐标系@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_map);mMapView = (MapView) findViewById(R.id.map_view);// webtile layerfinal WebTiledLayer webTiledLayer =TianDiTuMethodsClass.CreateTianDiTuTiledLayer(TianDiTuMethodsClass.LayerType.TIANDITU_VECTOR_MERCATOR);webTiledLayer.loadAsync();ArcGISMap map = new ArcGISMap(new Basemap(webTiledLayer));Point center = new Point(113.365548756,23.12648183, SpatialReference.create(4490));// CGCS2000mMapView.setViewpointCenterAsync(center,12);mMapView.setMap(map);}protected void onResume() {super.onResume();mMapView.resume();}@Overrideprotected void onPause() {super.onPause();mMapView.pause();}
}

3、谷歌地图的代码

自已根据天地图封装方式,封装了谷歌地图使用类

注意:测试谷歌时候,只能看到屏幕上这些地图,其他滑动出去,就没有,不知道为什么。有知道的大神可以评论一下。

package com.arcgis.until;import com.esri.arcgisruntime.arcgisservices.LevelOfDetail;
import com.esri.arcgisruntime.arcgisservices.TileInfo;
import com.esri.arcgisruntime.data.TileKey;
import com.esri.arcgisruntime.geometry.Envelope;
import com.esri.arcgisruntime.geometry.Point;
import com.esri.arcgisruntime.geometry.SpatialReference;
import com.esri.arcgisruntime.layers.WebTiledLayer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;public class GoogleMapLayer{private static final int DPI = 96;private static final int minZoomLevel = 1;private static final int maxZoomLevel = 19;private static final int tileWidth = 256;private static final int tileHeight = 256;// 枚举public enum MapType {VECTOR,        //矢量标注地图IMAGE,        //影像地图ROAD        //道路标注图层}private MapType mMapType;private static final List<String> SubDomain = Arrays.asList(new String[]{"mt0", "mt1", "mt2", "mt3", "mt4"});//102100是esri内部使用id 与epsg:3857 是对应的private static final SpatialReference SRID_MERCATOR = SpatialReference.create(102113);private static final Point ORIGIN_MERCATOR = new Point(-20037508.3427892, 20037508.3427892, SRID_MERCATOR);private static final Envelope ENVELOPE_MERCATOR = new Envelope(-22041257.773878,-32673939.6727517, 22041257.773878, 20851350.0432886, SRID_MERCATOR);private static 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 static double[] iRes = 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 String getMapUrl(TileKey tileKey) {String iResult = null;Random iRandom = null;int level = tileKey.getLevel();int col = tileKey.getColumn();int row = tileKey.getRow();iResult = "http://mt";iRandom = new Random();iResult = iResult + iRandom.nextInt(4);switch (this.mMapType) {case VECTOR:iResult = iResult + ".google.cn/vt/lyrs=m@212000000&hl=zh-CN&gl=CN&src=app&x=" + col + "&y=" + row + "&z=" + level + "&s==Galil";break;case IMAGE:iResult = iResult + ".google.cn/vt/lyrs=s@126&hl=zh-CN&gl=CN&src=app&x=" + col + "&y=" + row + "&z=" + level + "&s==Galil";break;case ROAD:iResult = iResult + ".google.cn/vt/imgtp=png32&lyrs=h@212000000&hl=zh-CN&gl=CN&src=app&x=" + col + "&y=" + row + "&z=" + level + "&s==Galil";break;default:return null;}return iResult;}public static WebTiledLayer CreateGoogleLayer(MapType layerType) {WebTiledLayer webTiledLayer = null;String mainUrl = "";String mainName = "Google";TileInfo mainTileInfo = null;Envelope mainEnvelope = null;try {switch (layerType) {case VECTOR:mainUrl = "http://{subDomain}.google.cn/vt/lyrs=m@225000000&hl=zh-CN&gl=CN&src=app&s=G&x={col}&y={row}&z={level}";break;case ROAD:mainUrl = "";break;case IMAGE:mainUrl = "";break;}List<LevelOfDetail> mainLevelOfDetail = new ArrayList<LevelOfDetail>();Point mainOrigin = null;for (int i = minZoomLevel; i <= maxZoomLevel; i++) {LevelOfDetail item = new LevelOfDetail(i, iRes[i - 1], SCALES[i - 1]);mainLevelOfDetail.add(item);}mainEnvelope = ENVELOPE_MERCATOR;mainOrigin = ORIGIN_MERCATOR;mainTileInfo = new TileInfo(DPI,TileInfo.ImageFormat.PNG24,mainLevelOfDetail,mainOrigin,mainOrigin.getSpatialReference(),tileHeight,tileWidth);webTiledLayer = new WebTiledLayer(mainUrl,SubDomain,mainTileInfo,mainEnvelope);webTiledLayer.setName(mainName);webTiledLayer.loadAsync();} catch (Exception e) {e.getCause();}return webTiledLayer;}
}

调用方式

package com.arcgis.activity;import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;import com.arcgis.R;
import com.arcgis.until.GoogleMapLayer;
import com.arcgis.until.TianDiTuMethodsClass;
import com.esri.arcgisruntime.geometry.Point;
import com.esri.arcgisruntime.geometry.SpatialReference;
import com.esri.arcgisruntime.layers.WebTiledLayer;
import com.esri.arcgisruntime.mapping.ArcGISMap;
import com.esri.arcgisruntime.mapping.Basemap;
import com.esri.arcgisruntime.mapping.view.MapView;public class ArcgisGoogleMapActivity extends AppCompatActivity {private MapView mMapView;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_map);mMapView = (MapView) findViewById(R.id.map_view);// webtile layerfinal WebTiledLayer webTiledLayer =GoogleMapLayer.CreateGoogleLayer(GoogleMapLayer.MapType.VECTOR);webTiledLayer.loadAsync();ArcGISMap map = new ArcGISMap(new Basemap(webTiledLayer));mMapView.setMap(map);}protected void onResume() {super.onResume();mMapView.resume();}@Overrideprotected void onPause() {super.onPause();mMapView.pause();}
}

新手一定要注意权限

    <uses-permission android:name="android.permission.INTERNET" /><uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /><uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

arcgis for Android 100.1 在线加载天地图和谷歌地图相关推荐

  1. arcgis for Android 100.3.0 加载shp数据以及操作

    ArcGIS Runtime 100.2.0的正式发布带来个更多移动端的处理地图的能力,例如支持WMS图层.支持海图(ENC)图层,再如基于场景相机(Camera)的视域分析.同时还提供了新的统计查询 ...

  2. arcgis for android(五)加载天地图

    1.上一篇文章arcgis for android 入门与提高(四)去掉属性标记和水印arcgis for android 入门与提高(四)去掉属性标记和水印_郝大大的博客-CSDN博客,接下来介绍国 ...

  3. QGIS加载天地图、高德地图

    在ArcGIS中加载地图很麻烦,一来是国内的数据源太少,二是地图显示速度太慢. 不过在QGIS中加载地图,然后把shp文件加载,效果好很多.后来在 https://zhuanlan.zhihu.com ...

  4. 2021-04-26QGIS3.10加载天地图影像(地图瓦片)的一种方法

    QGIS3.10加载天地图影像(地图瓦片)的一种方法 目录 QGIS3.10加载天地图影像(地图瓦片)的一种方法 1.天地图地图瓦片的链接获取. 2.QGIS加载数据 3.关于url参数的一点提醒 1 ...

  5. ArcGIS for Android 100.3.0(14):移动地图包MMPK的使用

    MobileMapPackage 移动地图包是ArcGIS Pro里新推出的一种离线地图数据,配合ArcGIS Runtime 100使用. 移动地图包是一个以".mmpk"结尾的 ...

  6. arcgis api for javascipt 加载天地图、百度地图

    写在前面的话: 1.百度地图是自己定义的坐标系统,wkid=102100.百度地图数据是加密的产物.下文将附上百度坐标与WGS84,谷歌等坐标系统转换方法(地理-地理),此方法并未亲测,据说准 2.百 ...

  7. ArcGIS API for JavaScript4.x 之加载2D、3D地图

    版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/gisdoer/article/details/81545607 ArcGIS API for Jav ...

  8. 2023年户外助手两步路、奥维地图等自定义加载2023最新谷歌地图、高清地图等协议分析

    两步路协议分析: <?xml version='1.0' encoding='UTF-8' standalone='yes' ?><mapSource><name> ...

  9. openlayer加载天地图 并设置地图颜色为科技蓝

    1.天地图是很多地图项目考虑的地图,但是由于天地图的配色与很多ui设计不符合,这里我是通过添加地图时候的className,添加css滤镜进行更改,效果良好,如下图所示: 核心代码:className ...

最新文章

  1. 估计点云中的曲面法线
  2. python做动态折线图_Python数据可视化 pyecharts实现各种统计图表过程详解
  3. Adaboost方法分类新闻数据
  4. 不需要SAP请求号修改程序的方法
  5. 轮换html有虚宽出现,乒乓球理论考试复习资料
  6. [VBA] 设置行高和列宽,以及全选单元格
  7. 摄影测量--测边交会
  8. 思博伦安全专家预测2017年民用和军用全球导航应用面临的更大风险
  9. 4.3 AlexNet CNN、tensorflow实现——python实战
  10. 查询 加载时间过长添加提示信息
  11. 老罗Android开发视频教程 (android解析xml文件 )3集集合
  12. HTML5与传统HTML的区别
  13. Windows Server 2019安装Intel I219-V I211网卡驱动
  14. WLAN从入门到精通-1
  15. Java爬堆糖图片爬虫
  16. php新年计划,New Year’s Resolution |给20出头的你19条最赞的新年计划
  17. openresty php 环境,从零搭建php环境-openresty
  18. 药店不停业盘点操作流程,海典盘点机PDA操作使用说明
  19. Activity重建之殇
  20. 电源滤波为何通常是一大一小两个电容并联?

热门文章

  1. 学术党必备:Zotero一键导出BibTex 参考文献
  2. ghost的使用技巧
  3. Proteus 网络名的添加
  4. 生命,宇宙以及一切事物的答案是...42?
  5. C++求一年中第几天?
  6. Linux命令行万能解压命令
  7. Manjaro下安装坚果云后登录界面空白解决方法
  8. 30天自制操作系统 - 取代软盘,用U盘写入引导扇区
  9. 【转载】CMD命令大全
  10. 形式语言大作业_清华大学本科一年级设计作业展示|仅是手绘就秒杀我的照片级效果图...