简体   繁体   中英

how to get center of screen Coordinates in android Mapbox

how can i get center of screen Coordinates in 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 . The MapboxMap class has a getCameraPosition() method and the Target class within the CameraPosition class.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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