简体   繁体   English

如何在android Mapbox中获取屏幕中心坐标

[英]how to get center of screen Coordinates in android Mapbox

how can i get center of screen Coordinates in android mapbox我怎样才能在android mapbox中获得屏幕中心坐标

public void setMarker(double lat,double lng){
        sourceLat = lat;
        sourceLng = lng;
        map.setSourcePin(lat , lng);
        map.flyTo(lat, lng);
    }
double mapLat = mapboxMap.getCameraPosition().target.getLatitude()

double mapLong = mapboxMap.getCameraPosition().target.getLongitude()

Edit: The center of the map is the target .编辑:地图的中心是target The MapboxMap class has a getCameraPosition() method and the Target class within the CameraPosition class. MapboxMap类具有getCameraPosition()方法和CameraPosition类中的Target类。

LatLng mapLatLng = mapboxMap.getCameraPosition().target;
double mapLat = mapLatLng.getLatitude();
double mapLong = mapLatLng.getLongitude();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM