Zoom map between two points, Using Mapzen Android SDK

149 views Asked by At

Using Mapzen Android sdk, I have drawn a route between two points using latitude and longitude on map with mapData.addPolyline(markers, props); method.

Now i want to zoom map between these two points.

Zooming to single point can be done by below method :

public void goToLandmark(Landmark landmark) {

    if (map == null) {
        return;
    }

    int duration = 2000; // Milliseconds

    // We use the position, zoom, tilt, and rotation of the Landmark to move the camera over time.
    // Different types of "easing" are available to make the transition smoother or sharper.
    map.setPositionEased(landmark.position, duration, MapController.EaseType.CUBIC);
    map.setZoomEased(landmark.zoom, duration, MapController.EaseType.LINEAR);
    map.setTiltEased(landmark.tilt, duration, MapController.EaseType.CUBIC);
    map.setRotationEased(landmark.rotation, duration, MapController.EaseType.CUBIC);
}

Please guide me, Thank you in advance.

0

There are 0 answers