1.加载谷歌地图
工具类:
package com.chy.google;
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","m5", "m6", "m7","m8","m9","m10","m11",
"m12","m13","m14","m15","m16","m17","m18","m19"});
//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 };
public 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 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;
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;
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 = "http://{subDomain}.google.cn/vt/imgtp=png&hl=zh-CN&gl=CN&src=app&s=G&x={col}&y={row}&z={level}";
break;
case IMAGE:
mainUrl = "http://{subDomain}.google.cn/maps/vt/lyrs=s@40717&hl=zh-CN&gl=CN&src=app&s=G&x={col}&y={row}&z={level}";
//mainUrl = "http://{subDomain}.google.cn/maps/vt/lyrs=t@131,r@227000000&hl=zh-CN&gl=CN&src=app&s=G&x={col}&y={row}&z={level}";
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;
}
}
使用方法:
// 加载谷歌地图
final WebTiledLayer webTiledLayer =
GoogleMapLayer.CreateGoogleLayer(GoogleMapLayer.MapType.IMAGE);
webTiledLayer.loadAsync();
ArcGISMap map = new ArcGISMap(new Basemap(webTiledLayer));
mapView.setMap(map);
2.加载高德地图
工具类:
package com.chy.geode;
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 AMapTiledLayerClass {
private static final List<String> subDomain = Arrays.asList(new String[]{"00", "01", "02", "03", "04", "05", "06","07", "08", "09",
"10","11", "12", "13", "14", "15", "16", "17", "18", "19", "20"});
private static final int minZoomLevel = 0;
private static final int maxZoomLevel = 20;
private static final int DPI = 96;
private static final int tileWidth = 256;
private static final int tileHeight = 256;
private static final SpatialReference SRID = SpatialReference.create(102113);
private static final Point origin = new Point(-20037508.342787, 20037508.342787, SRID);
private static final Envelope envelope = new Envelope(-22041257.773878,
-32673939.6727517, 22041257.773878, 20851350.0432886, SRID);
private static final double[] SCALES = {
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, 564.248588
, 282.124294, 141.062147
};
private static final double[] RESOLUTIONS = {
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, 0.149291
, 0.074646, 0.037323
};
public static WebTiledLayer CreateAMapTiledLayer(LayerType layerType) {
WebTiledLayer webTiledLayer = null;
String mainUrl;
TileInfo mainTileInfo;
String type;
int typeCode;
switch (layerType) {
case AMAP_VECTOR:
type = "rd";
typeCode = 8;
break;
case AMAP_IMAGE:
type = "st";
typeCode = 6;
break;
default:
type = "rd";
typeCode = 8;
break;
}
mainUrl = "http://web"
+ type
+ "{subDomain}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scl=1&style=" +
typeCode +
"&x={col}&y={row}&z={level}";
List<LevelOfDetail> mainLevelOfDetail = new ArrayList<LevelOfDetail>();
for (int i = minZoomLevel; i <= maxZoomLevel; i++) {
LevelOfDetail item = new LevelOfDetail(i, RESOLUTIONS[i], SCALES[i]);
mainLevelOfDetail.add(item);
}
mainTileInfo = new TileInfo(
DPI,
TileInfo.ImageFormat.PNG24,
mainLevelOfDetail,
origin,
SRID,
tileHeight,
tileWidth
);
webTiledLayer = new WebTiledLayer(
mainUrl,
subDomain,
mainTileInfo,
envelope
);
webTiledLayer.loadAsync();
return webTiledLayer;
}
public enum LayerType {
AMAP_VECTOR,
AMAP_IMAGE
}
}
使用方法:
// 加载高德地图
WebTiledLayer aMap = AMapTiledLayerClass.CreateAMapTiledLayer(AMapTiledLayerClass.LayerType.AMAP_IMAGE);
aMap.loadAsync();
ArcGISMap map = new ArcGISMap(new Basemap(aMap));
mapView.setMap(map);
3.加载天地图
工具类:
package com.chy.tianditu;
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 {
//天地图官网申请key
public static final String key = "76928e7f5454b5b132a7948720be7216";
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}&tk=" + key;
private static final String URL_VECTOR_ANNOTATION_CHINESE_2000 = "http://{subDomain}.tianditu.com/DataServer?T=cva_c&x={col}&y={row}&l={level}&tk=" + key;
private static final String URL_VECTOR_ANNOTATION_ENGLISH_2000 = "http://{subDomain}.tianditu.com/DataServer?T=eva_c&x={col}&y={row}&l={level}&tk=" + key;
private static final String URL_IMAGE_2000 = "http://{subDomain}.tianditu.com/DataServer?T=img_c&x={col}&y={row}&l={level}&tk=" + key;
private static final String URL_IMAGE_ANNOTATION_CHINESE_2000 = "http://{subDomain}.tianditu.com/DataServer?T=cia_c&x={col}&y={row}&l={level}&tk=" + key;
private static final String URL_IMAGE_ANNOTATION_ENGLISH_2000 = "http://{subDomain}.tianditu.com/DataServer?T=eia_c&x={col}&y={row}&l={level}&tk=" + key;
private static final String URL_TERRAIN_2000 = "http://{subDomain}.tianditu.com/DataServer?T=ter_c&x={col}&y={row}&l={level}&tk=" + key;
private static final String URL_TERRAIN_ANNOTATION_CHINESE_2000 = "http://{subDomain}.tianditu.com/DataServer?T=cta_c&x={col}&y={row}&l={level}&tk=" + key;
private static final String URL_VECTOR_MERCATOR = "http://{subDomain}.tianditu.com/DataServer?T=vec_w&x={col}&y={row}&l={level}&tk=" + key;
private static final String URL_VECTOR_ANNOTATION_CHINESE_MERCATOR = "http://{subDomain}.tianditu.com/DataServer?T=cva_w&x={col}&y={row}&l={level}&tk=" + key;
private static final String URL_VECTOR_ANNOTATION_ENGLISH_MERCATOR = "http://{subDomain}.tianditu.com/DataServer?T=eva_w&x={col}&y={row}&l={level}&tk=" + key;
private static final String URL_IMAGE_MERCATOR = "http://{subDomain}.tianditu.com/DataServer?T=img_w&x={col}&y={row}&l={level}&tk=" + key;
private static final String URL_IMAGE_ANNOTATION_CHINESE_MERCATOR = "http://{subDomain}.tianditu.com/DataServer?T=cia_w&x={col}&y={row}&l={level}&tk=" + key;
private static final String URL_IMAGE_ANNOTATION_ENGLISH_MERCATOR = "http://{subDomain}.tianditu.com/DataServer?T=eia_w&x={col}&y={row}&l={level}&tk=" + key;
private static final String URL_TERRAIN_MERCATOR = "http://{subDomain}.tianditu.com/DataServer?T=ter_w&x={col}&y={row}&l={level}&tk=" + key;
private static final String URL_TERRAIN_ANNOTATION_CHINESE_MERCATOR = "http://{subDomain}.tianditu.com/DataServer?T=cta_w&x={col}&y={row}&l={level}&tk=" + key;
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
}
}
使用方法:
//注意:在100.2.0之后要设置RequestConfiguration
RequestConfiguration requestConfiguration = new RequestConfiguration();
requestConfiguration.getHeaders().put("referer", "http://www.arcgis.com");
// 加载天地图层-电子地图
WebTiledLayer vecordBaseTiledLayer = TianDiTuMethodsClass.CreateTianDiTuTiledLayer(TianDiTuMethodsClass.LayerType.TIANDITU_VECTOR_MERCATOR);
// 加载中文标注图层-电子地图
WebTiledLayer vecordWordTiledLayer = TianDiTuMethodsClass.CreateTianDiTuTiledLayer(TianDiTuMethodsClass.LayerType. TIANDITU_VECTOR_ANNOTATION_CHINESE_MERCATOR);
vecordBaseTiledLayer.setRequestConfiguration(requestConfiguration);
vecordWordTiledLayer.setRequestConfiguration(requestConfiguration);
vecordBaseTiledLayer.loadAsync();
vecordWordTiledLayer.loadAsync();
Basemap basemap = new Basemap();
basemap.getBaseLayers().add(vecordBaseTiledLayer);
basemap.getBaseLayers().add(vecordWordTiledLayer);
ArcGISMap arcGISMap = new ArcGISMap(basemap);
mapView.setMap(arcGISMap);