# Class CameraPosition

java.lang.Object
com.codename1.maps.CameraPosition

public final class CameraPosition extends Object

An immutable description of the map camera: where it looks (`getTarget()`), how far it is zoomed in (`getZoom()`), the compass bearing in degrees (`getBearing()`) and the tilt away from nadir (`getTilt()`).

Zoom uses the standard slippy-map scale where each whole increment doubles the scale (zoom 0 shows the whole world in a single 256px tile). Fractional zoom is supported by the vector engine; native providers may round it. Bearing and tilt are honored by native providers that support them and ignored by the pure-vector `MapView`.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CameraPosition(LatLng target, double zoom)`
  Creates a camera position that looks straight down (no bearing/tilt).
  `CameraPosition(LatLng target, double zoom, double bearing, double tilt)`
  Creates a fully specified camera position.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `double`
  `getBearing()`
  The compass bearing in degrees (0 = north up).
  `LatLng`
  `getTarget()`
  The geographic point at the center of the viewport.
  `double`
  `getTilt()`
  The viewing tilt in degrees (0 = straight down).
  `double`
  `getZoom()`
  The slippy-map zoom level.
  `String`
  `toString()`
  Returns a string representation of the object.
  `CameraPosition`
  `withTarget(LatLng newTarget)`
  Returns a copy of this position with a different target.
  `CameraPosition`
  `withZoom(double newZoom)`
  Returns a copy of this position with a different zoom level.

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### CameraPosition

    public CameraPosition(LatLng target, double zoom)
    Creates a camera position that looks straight down (no bearing/tilt).

  - ### CameraPosition

    public CameraPosition(LatLng target, double zoom, double bearing, double tilt)

    Creates a fully specified camera position.

    ###### Parameters

    - `target`: the geographic point at the center of the viewport

    - `zoom`: the slippy-map zoom level

    - `bearing`: the compass bearing in degrees (0 = north up)

    - `tilt`: the viewing angle away from straight-down, in degrees

- ## Method Details

  - ### getTarget

    public LatLng getTarget()
    The geographic point at the center of the viewport.

  - ### getZoom

    public double getZoom()
    The slippy-map zoom level.

  - ### getBearing

    public double getBearing()
    The compass bearing in degrees (0 = north up).

  - ### getTilt

    public double getTilt()
    The viewing tilt in degrees (0 = straight down).

  - ### withTarget

    public CameraPosition withTarget(LatLng newTarget)
    Returns a copy of this position with a different target.

  - ### withZoom

    public CameraPosition withZoom(double newZoom)
    Returns a copy of this position with a different zoom level.

  - ### toString

    public String toString()
    Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method. The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of: getClass().getName() + '@' + Integer.toHexString(hashCode())
    Overrides:
      `toString` in class `Object`