【问题标题】:Android Arcgis 100.3: How to get center Point of MapViewAndroid Arcgis 100.3:如何获取 MapView 的中心点
【发布时间】:2018-07-31 07:27:48
【问题描述】:

如何从 ArcGis 的 MapView 屏幕中心获取 Point,代表它的经纬度?

【问题讨论】:

    标签: android android-mapview arcgis


    【解决方案1】:
    float centreX=mapView.getX() + mapView.getWidth()  / 2;
    float centreY=mapView.getY() + mapView.getHeight() / 2;
    
    android.graphics.Point screenPoint = new android.graphics.Point(Math.round(centreX), Math.round(centreY));
    Point mapPoint = mv.screenToLocation(screenPoint);
    Point wgs84Point = (Point) GeometryEngine.project(mapPoint, SpatialReferences.getWgs84());
    
    double lat = wgs84Point.getY();
    double lng = wgs84Point.getX();
    

    【讨论】:

      【解决方案2】:

      默认情况下,很容易得到中心坐标,把线放在下面

       LatLng target = mMap.getCameraPosition().target;
      

      通过访问latlng类的经纬度成员获取经纬度

      target.latitude;
      target.longitude;
      

      【讨论】:

      • 很抱歉,LatLng 是我目前未使用的 Google 地图库的一部分(我使用的是 ArcGis 100.3),所以...
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多