LatLngBounds

public class LatLngBounds implements Parcelable


Represents a rectangle in geographical coordinates, including one that crosses the 180 degrees longitudinal meridian. This bounds are used to clamp the lat,lng the eye-point (aka look form camera) to be within the bounds. It does not mean, however, that things outside of this bounds won't be visible on the map. Bounds can restrict both longitude and latitude, or can restrict either latitude or longitude only. For latitude-only bounds use west and east longitudes of -180 and 180, respectively. For longitude-only bounds use north and south latitudes of 90 and -90, respectively.

Summary

Constants

static final Parcelable.Creator<LatLngBounds>

Public fields

double
double
double
double

Public constructors

LatLngBounds(
    double northEastLat,
    double northEastLng,
    double southWestLat,
    double southWestLng
)

Constructor for LatLngBounds with parameters for required fields.

Public methods

double

The latitude of the north-east corner of the bounds.

double

The longitude of the north-east corner of the bounds.

double

The latitude of the south-west corner of the bounds.

double

The longitude of the south-west corner of the bounds.

void
setNorthEastLat(double northEastLat)

Sets the latitude of the north-east corner of the bounds.

void
setNorthEastLng(double northEastLng)

Sets the longitude of the north-east corner of the bounds.

void
setSouthWestLat(double southWestLat)

Sets the latitude of the south-west corner of the bounds.

void
setSouthWestLng(double southWestLng)

Sets the longitude of the south-west corner of the bounds.

void
writeToParcel(Parcel dest, int flags)

Extension functions

final void

Validates a specified LatLngBounds object properties.

Inherited Constants

From android.os.Parcelable
static final int
static final int

Inherited methods

From android.os.Parcelable
abstract int

Constants

CREATOR

public static final Parcelable.Creator<LatLngBoundsCREATOR

Public fields

northEastLat

public double northEastLat

northEastLng

public double northEastLng

southWestLat

public double southWestLat

southWestLng

public double southWestLng

Public constructors

LatLngBounds

public LatLngBounds(
    double northEastLat,
    double northEastLng,
    double southWestLat,
    double southWestLng
)

Constructor for LatLngBounds with parameters for required fields.

Parameters
double northEastLat

The latitude of the north-east corner of the bounds.

double northEastLng

The longitude of the north-east corner of the bounds.

double southWestLat

The latitude of the south-west corner of the bounds.

double southWestLng

The longitude of the south-west corner of the bounds.

Public methods

getNorthEastLat

public double getNorthEastLat()

The latitude of the north-east corner of the bounds.

getNorthEastLng

public double getNorthEastLng()

The longitude of the north-east corner of the bounds.

getSouthWestLat

public double getSouthWestLat()

The latitude of the south-west corner of the bounds.

getSouthWestLng

public double getSouthWestLng()

The longitude of the south-west corner of the bounds.

setNorthEastLat

public void setNorthEastLat(double northEastLat)

Sets the latitude of the north-east corner of the bounds.

setNorthEastLng

public void setNorthEastLng(double northEastLng)

Sets the longitude of the north-east corner of the bounds.

setSouthWestLat

public void setSouthWestLat(double southWestLat)

Sets the latitude of the south-west corner of the bounds.

setSouthWestLng

public void setSouthWestLng(double southWestLng)

Sets the longitude of the south-west corner of the bounds.

writeToParcel

public void writeToParcel(Parcel dest, int flags)

Extension functions

ValidatorsKt.validate

public final void ValidatorsKt.validate(@NonNull LatLngBounds receiver)

Validates a specified LatLngBounds object properties.

Throws
java.lang.IllegalArgumentException

If any of the properties in the LatLngBounds is not valid.