说明一下,什么时候加载高德地图,什么时候加载天地图
使用原生定位或者使用arcgis提供的LocationDisplay的定位时,需要加载天地图,因为原生定位返回的坐标是wgs84的坐标,而高德地图是火星坐标系(gcj02)是经过偏移的,定位显示会有偏移
使用百度定位或者高德定位,定位返回坐标设置为gcj02时,直接加载高德地图,定位就不会有偏移
废话不多说,上才艺
准备
先自定义TianDiTuTiledLayerClass
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 TianDiTuTiledLayerClass {
//需要自己去申请,绑定包名和SHA1,我这个你们用不了
private static final String key = "11fc0ecfe024734754f0fb5952aa5c6f";
private static final List SubDomain =
Arrays.asList(new String[]{"t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7"});
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 SpatialReference SRID_MERCATOR = SpatialReference.create(102100);
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_MERCATOR =
new Point(-20037508.3427892, 20037508.3427892, SRID_MERCATOR);
private static final Envelope ENVELOPE_MERCATOR =
new Envelope(X_MIN_MERCATOR,
Y_MIN_MERCATOR,
X_MAX_MERCATOR,
Y_MAX_MERCATOR,
SRID_MERCATOR);
privat