GroundOverlayOptions | Android Developers

Quicknav Quicknav
Links

- Google Play Developer Console
- Android Developers Blog
- About Android

Android Sites

- Android.com
- Android Developers
- Android Open Source Project

Languages
close

- - Get Started
  - Style
  - Patterns
  - Building Blocks
  - Downloads
  - Videos
- - Training
  - API Guides
  - Reference
  - Tools
    - Get the SDK
  - Google Services
- - Google Play
  - Publishing
  - Promoting
  - App Quality
  - Spotlight
  - Open Distribution

## Results

Loading...
Summary: Constants | Inherited Constants | Fields | Ctors | Methods | Inherited Methods | [Expand All]
public final class

# GroundOverlayOptions

extends Object
implements Parcelable

java.lang.Object
↳ | com.google.android.gms.maps.model.GroundOverlayOptions

## Class Overview

Defines options for a ground overlay.

## Summary

Constants
float | NO_DIMENSION | Flag for when no dimension is specified for the height.
String | NULL |

[Expand] Inherited Constants
From interface android.os.Parcelable
int | CONTENTS_FILE_DESCRIPTOR |
int | PARCELABLE_WRITE_RETURN_VALUE |

Fields
public static final GroundOverlayOptionsCreator | CREATOR |

Public Constructors
| GroundOverlayOptions() Creates a new set of ground overlay options.

Public Methods
GroundOverlayOptions | anchor(float u, float v) Specifies the anchor to be at a particular point in the image.
GroundOverlayOptions | bearing(float bearing) Specifies the bearing of the ground overlay in degrees clockwise from north.
int | describeContents()
float | getAnchorU() Horizontal distance, normalized to [0, 1], of the anchor from the left edge.
float | getAnchorV() Vertical distance, normalized to [0, 1], of the anchor from the top edge.
float | getBearing() Gets the bearing set for this options object.
LatLngBounds | getBounds() Gets the bounds set for this options object.
float | getHeight() Gets the height set for this options object.
BitmapDescriptor | getImage() Gets the image set for this options object.
LatLng | getLocation() Gets the location set for this options object.
float | getTransparency() Gets the transparency set for this options object.
float | getWidth() Gets the width set for this options object.
float | getZIndex() Gets the zIndex set for this options object.
GroundOverlayOptions | image(BitmapDescriptor image) Specifies the image for this ground overlay.
boolean | isVisible() Gets the visibility setting for this options object.
GroundOverlayOptions | position(LatLng location, float width, float height) Specifies the position for this ground overlay using an anchor point (a `LatLng`), width and height (both in meters).
GroundOverlayOptions | position(LatLng location, float width) Specifies the position for this ground overlay using an anchor point (a `LatLng`) and the width (in meters).
GroundOverlayOptions | positionFromBounds(LatLngBounds bounds) Specifies the position for this ground overlay.
GroundOverlayOptions | transparency(float transparency) Specifies the transparency of the ground overlay.
GroundOverlayOptions | visible(boolean visible) Specifies the visibility for the ground overlay.
void | writeToParcel(Parcel out, int flags)
GroundOverlayOptions | zIndex(float zIndex) Specifies the ground overlay's zIndex, i.e., the order in which it will be drawn.

[Expand] Inherited Methods
From class java.lang.Object
Object | clone()
boolean | equals(Object arg0)
void | finalize()
final Class<?> | getClass()
int | hashCode()
final void | notify()
final void | notifyAll()
String | toString()
final void | wait()
final void | wait(long arg0, int arg1)
final void | wait(long arg0)
From interface android.os.Parcelable
abstract int | describeContents()
abstract void | writeToParcel(Parcel arg0, int arg1)

## Constants

#### public static final float NO_DIMENSION

Flag for when no dimension is specified for the height.

Constant Value: -1.0

#### public static final String NULL

Constant Value: "SAFE_PARCELABLE_NULL_STRING"

## Fields

#### public static final GroundOverlayOptionsCreator CREATOR

## Public Constructors

#### public GroundOverlayOptions ()

Creates a new set of ground overlay options.

## Public Methods

#### public GroundOverlayOptions anchor (float u, float v)

Specifies the anchor to be at a particular point in the image.

The anchor specifies the point in the image that aligns with the ground overlay's location.

The anchor point is specified in the continuous space [0.0, 1.0] x [0.0, 1.0], where (0, 0) is the top-left corner of the image, and (1, 1) is the bottom-right corner.

     *-----+-----+-----+-----*
     |     |     |     |     |
     |     |     |     |     |
     +-----+-----+-----+-----+
     |     |     |   X |     |   (U, V) = (0.7, 0.6)
     |     |     |     |     |
     *-----+-----+-----+-----*

##### Parameters

u | u-coordinate of the anchor, as a ratio of the image width (in the range [0, 1])
v | v-coordinate of the anchor, as a ratio of the image height (in the range [0, 1])

##### Returns

- this `GroundOverlayOptions` object with a new anchor set.

#### public GroundOverlayOptions bearing (float bearing)

Specifies the bearing of the ground overlay in degrees clockwise from north. The rotation is performed about the anchor point. If not specified, the default is 0 (i.e., up on the image points north).

If a ground overlay with position set using `positionFromBounds(LatLngBounds)` is rotated, its size will preserved and it will no longer be guaranteed to fit inside the bounds.

##### Parameters

bearing | the bearing in degrees clockwise from north. Values outside the range [0, 360) will be normalized.

##### Returns

- this `GroundOverlayOptions` object with a new bearing set.

#### public int describeContents ()

#### public float getAnchorU ()

Horizontal distance, normalized to [0, 1], of the anchor from the left edge.

##### Returns

- the u value of the anchor.

#### public float getAnchorV ()

Vertical distance, normalized to [0, 1], of the anchor from the top edge.

##### Returns

- the v value of the anchor.

#### public float getBearing ()

Gets the bearing set for this options object.

##### Returns

- the bearing of the ground overlay.

#### public LatLngBounds getBounds ()

Gets the bounds set for this options object.

##### Returns

- the bounds of the ground overlay. This will be `null` if the position was set using `position(LatLng, float)` or `position(LatLng, float, float)`

#### public float getHeight ()

Gets the height set for this options object.

##### Returns

- the height of the ground overlay.

#### public BitmapDescriptor getImage ()

Gets the image set for this options object.

##### Returns

- the image of the ground overlay.

#### public LatLng getLocation ()

Gets the location set for this options object.

##### Returns

- the location to place the anchor of the ground overlay. This will be `null` if the position was set using `positionFromBounds(LatLngBounds)`.

#### public float getTransparency ()

Gets the transparency set for this options object.

##### Returns

- the transparency of the ground overlay.

#### public float getWidth ()

Gets the width set for this options object.

##### Returns

- the width of the ground overlay.

#### public float getZIndex ()

Gets the zIndex set for this options object.

##### Returns

- the zIndex of the ground overlay.

#### public GroundOverlayOptions image (BitmapDescriptor image)

Specifies the image for this ground overlay.

To load an image as a texture (which is used to draw the image on a map), it must be converted into an image with sides that are powers of two. This is so that a mipmap can be created in order to render the texture at various zoom levels - see Mipmap (Wikipedia) for details. Hence, to conserve memory by avoiding this conversion, it is advised that the dimensions of the image are powers of two.

##### Parameters

image | the `BitmapDescriptor` to use for this ground overlay

##### Returns

- this `GroundOverlayOptions` object with a new image set.

#### public boolean isVisible ()

Gets the visibility setting for this options object.

##### Returns

- `true` if the ground overlay is to be visible; `false` if it is not.

#### public GroundOverlayOptions position (LatLng location, float width, float height)

Specifies the position for this ground overlay using an anchor point (a `LatLng`), width and height (both in meters). When rendered, the image will be scaled to fit the dimensions specified (i.e., its proportions will not necessarily be preserved).

##### Parameters

location | the location on the map `LatLng` to which the anchor point in the given image will remain fixed. The anchor will remain fixed to the position on the ground when transformations are applied (e.g., setDimensions, setBearing, etc.).
width | the width of the overlay (in meters)
height | the height of the overlay (in meters)

##### Returns

- this `GroundOverlayOptions` object with a new position set.

##### Throws

IllegalArgumentException | if anchor is null
IllegalArgumentException | if width or height are negative
IllegalStateException | if the position was already set using `positionFromBounds(LatLngBounds)`

#### public GroundOverlayOptions position (LatLng location, float width)

Specifies the position for this ground overlay using an anchor point (a `LatLng`) and the width (in meters). When rendered, the image will retain its proportions from the bitmap, i.e., the height will be calculated to preserve the original proportions of the image.

##### Parameters

location | the location on the map `LatLng` to which the anchor point in the given image will remain fixed. The anchor will remain fixed to the position on the ground when transformations are applied (e.g., setDimensions, setBearing, etc.).
width | the width of the overlay (in meters). The height will be determined automatically based on the image proportions.

##### Returns

- this `GroundOverlayOptions` object with a new position set.

##### Throws

IllegalArgumentException | if anchor is null
IllegalArgumentException | if width is negative
IllegalStateException | if the position was already set using `positionFromBounds(LatLngBounds)`

#### public GroundOverlayOptions positionFromBounds (LatLngBounds bounds)

Specifies the position for this ground overlay. When rendered, the image will be scaled to fit the bounds (i.e., its proportions will not necessarily be preserved).

##### Parameters

bounds | a `LatLngBounds` in which to place the ground overlay

##### Returns

- this `GroundOverlayOptions` object with a new position set.

##### Throws

IllegalStateException | if the position was already set using `position(LatLng, float)` or `position(LatLng, float, float)`

#### public GroundOverlayOptions transparency (float transparency)

Specifies the transparency of the ground overlay. The default transparency is `0` (opaque).

##### Parameters

transparency | a float in the range `[0..1]` where `0` means that the ground overlay is opaque and `1` means that the ground overlay is transparent

##### Returns

- this `GroundOverlayOptions` object with a new visibility setting.

##### Throws

IllegalArgumentException | if the transparency is outside the range [0..1].

#### public GroundOverlayOptions visible (boolean visible)

Specifies the visibility for the ground overlay. The default visibility is `true`.

##### Returns

- this `GroundOverlayOptions` object with a new visibility setting.

#### public void writeToParcel (Parcel out, int flags)

#### public GroundOverlayOptions zIndex (float zIndex)

Specifies the ground overlay's zIndex, i.e., the order in which it will be drawn. See the documentation at the top of this class for more information about zIndex.

##### Returns

- this `GroundOverlayOptions` object with a new zIndex set.