Search in sources :

Example 1 with ILatLng

use of com.mapbox.mapboxsdk.geometry.ILatLng in project androidApp by InspectorIncognito.

the class MapboxUtil method LatLngBoundsFromLatLngs.

public static LatLngBounds LatLngBoundsFromLatLngs(final List<? extends ILatLng> latLngs) {
    double minLat = 90;
    double minLon = 180;
    double maxLat = -90;
    double maxLon = -180;
    for (final ILatLng gp : latLngs) {
        final double latitude = gp.getLatitude();
        final double longitude = gp.getLongitude();
        minLat = Math.min(minLat, latitude);
        minLon = Math.min(minLon, longitude);
        maxLat = Math.max(maxLat, latitude);
        maxLon = Math.max(maxLon, longitude);
    }
    return LatLngBounds.from(maxLat, maxLon, minLat, minLon);
}
Also used : ILatLng(com.mapbox.mapboxsdk.geometry.ILatLng)

Aggregations

ILatLng (com.mapbox.mapboxsdk.geometry.ILatLng)1