New map styling is coming soon to Google Maps Platform. This update to map styling includes a new default color palette and improvements to map experiences and usability. All map styles will be automatically updated in March 2025. For more information on availability and how to opt in earlier, see
New map style for Google Maps Platform
.
GMSCameraPosition Class Reference
Stay organized with collections
Save and categorize content based on your preferences.
Overview
An immutable class that aggregates all camera position parameters.
Inherited by
GMSMutableCameraPosition
.
Public Member Functions
|
(instancetype)
| -
initWithTarget:zoom:bearing:viewingAngle:
|
| Designated initializer.
|
(instancetype)
| -
initWithTarget:zoom:
|
| Convenience initializer for
GMSCameraPosition
for a particular target and zoom level.
|
(instancetype)
| -
initWithLatitude:longitude:zoom:
|
| Convenience initializer for
GMSCameraPosition
for a particular latitidue, longitude and zoom level.
|
(instancetype)
| -
initWithLatitude:longitude:zoom:bearing:viewingAngle:
|
| Convenience initializer for
GMSCameraPosition
, with latitude/longitude and all other camera properties as per -initWithTarget:zoom:bearing:viewingAngle:.
|
Static Public Member Functions
|
(instancetype)
| +
cameraWithTarget:zoom:
|
| Convenience constructor for
GMSCameraPosition
for a particular target and zoom level.
|
(instancetype)
| +
cameraWithLatitude:longitude:zoom:
|
| Convenience constructor for
GMSCameraPosition
, as per cameraWithTarget:zoom:.
|
(instancetype)
| +
cameraWithTarget:zoom:bearing:viewingAngle:
|
| Convenience constructor for
GMSCameraPosition
, with all camera properties as per initWithTarget:zoom:bearing:viewingAngle:.
|
(instancetype)
| +
cameraWithLatitude:longitude:zoom:bearing:viewingAngle:
|
| Convenience constructor for
GMSCameraPosition
, with latitude/longitude and all other camera properties as per initWithTarget:zoom:bearing:viewingAngle:.
|
(float)
| +
zoomAtCoordinate:forMeters:perPoints:
|
| Get the zoom level at which
meters
distance, at given
coord
on Earth, correspond to the specified number of screen
points
.
|
Properties
|
CLLocationCoordinate2D
| target
|
| Location on the Earth towards which the camera points.
|
float
| zoom
|
| Zoom level.
|
CLLocationDirection
| bearing
|
| Bearing of the camera, in degrees clockwise from true north.
|
double
| viewingAngle
|
| The angle, in degrees, of the camera from the nadir (directly facing the Earth).
|
Member Function Documentation
- (instancetype) initWithTarget:
|
|
(CLLocationCoordinate2D)
|
target
|
zoom:
|
|
(float)
|
zoom
|
bearing:
|
|
(CLLocationDirection)
|
bearing
|
viewingAngle:
|
|
(double)
|
viewingAngle
|
|
|
| |
Designated initializer.
Configures this
GMSCameraPosition
with all available camera properties. Building a
GMSCameraPosition
via this initializer (or by the following convenience constructors) will implicitly clamp camera values.
- Parameters:
-
target
| Location on the earth towards which the camera points.
|
zoom
| The zoom level near the center of the screen.
|
bearing
| Bearing of the camera in degrees clockwise from true north.
|
viewingAngle
| The angle, in degrees, of the camera angle from the nadir (directly facing the Earth)
|
- (instancetype) initWithTarget:
|
|
(CLLocationCoordinate2D)
|
target
|
zoom:
|
|
(float)
|
zoom
|
|
|
| |
Convenience initializer for
GMSCameraPosition
for a particular target and zoom level.
This will set the bearing and viewingAngle properties of this camera to zero defaults (i.e., directly facing the Earth's surface, with the top of the screen pointing north).
- Parameters:
-
target
| Location on the earth towards which the camera points.
|
zoom
| The zoom level near the center of the screen.
|
- (instancetype) initWithLatitude:
|
|
(CLLocationDegrees)
|
latitude
|
longitude:
|
|
(CLLocationDegrees)
|
longitude
|
zoom:
|
|
(float)
|
zoom
|
|
|
| |
Convenience initializer for
GMSCameraPosition
for a particular latitidue, longitude and zoom level.
This will set the bearing and viewingAngle properties of this camera to zero defaults (i.e., directly facing the Earth's surface, with the top of the screen pointing north).
- Parameters:
-
latitude
| The latitude component of the location towards which the camera points.
|
longitude
| The latitude component of the location towards which the camera points.
|
zoom
| The zoom level near the center of the screen.
|
- (instancetype) initWithLatitude:
|
|
(CLLocationDegrees)
|
latitude
|
longitude:
|
|
(CLLocationDegrees)
|
longitude
|
zoom:
|
|
(float)
|
zoom
|
bearing:
|
|
(CLLocationDirection)
|
bearing
|
viewingAngle:
|
|
(double)
|
viewingAngle
|
|
|
| |
Convenience initializer for
GMSCameraPosition
, with latitude/longitude and all other camera properties as per -initWithTarget:zoom:bearing:viewingAngle:.
- Parameters:
-
latitude
| The latitude component of the location towards which the camera points.
|
longitude
| The latitude component of the location towards which the camera points.
|
zoom
| The zoom level near the center of the screen.
|
bearing
| Bearing of the camera in degrees clockwise from true north.
|
viewingAngle
| The angle, in degrees, of the camera angle from the nadir (directly facing the Earth)
|
+ (instancetype) cameraWithTarget:
|
|
(CLLocationCoordinate2D)
|
target
|
zoom:
|
|
(float)
|
zoom
|
|
|
| |
Convenience constructor for
GMSCameraPosition
for a particular target and zoom level.
This will set the bearing and viewingAngle properties of this camera to zero defaults (i.e., directly facing the Earth's surface, with the top of the screen pointing north).
+ (instancetype) cameraWithLatitude:
|
|
(CLLocationDegrees)
|
latitude
|
longitude:
|
|
(CLLocationDegrees)
|
longitude
|
zoom:
|
|
(float)
|
zoom
|
|
|
| |
+ (instancetype) cameraWithTarget:
|
|
(CLLocationCoordinate2D)
|
target
|
zoom:
|
|
(float)
|
zoom
|
bearing:
|
|
(CLLocationDirection)
|
bearing
|
viewingAngle:
|
|
(double)
|
viewingAngle
|
|
|
| |
Convenience constructor for
GMSCameraPosition
, with all camera properties as per initWithTarget:zoom:bearing:viewingAngle:.
+ (instancetype) cameraWithLatitude:
|
|
(CLLocationDegrees)
|
latitude
|
longitude:
|
|
(CLLocationDegrees)
|
longitude
|
zoom:
|
|
(float)
|
zoom
|
bearing:
|
|
(CLLocationDirection)
|
bearing
|
viewingAngle:
|
|
(double)
|
viewingAngle
|
|
|
| |
Convenience constructor for
GMSCameraPosition
, with latitude/longitude and all other camera properties as per initWithTarget:zoom:bearing:viewingAngle:.
+ (float) zoomAtCoordinate:
|
|
(CLLocationCoordinate2D)
|
coordinate
|
forMeters:
|
|
(CLLocationDistance)
|
meters
|
perPoints:
|
|
(CGFloat)
|
points
|
|
|
| |
Get the zoom level at which
meters
distance, at given
coord
on Earth, correspond to the specified number of screen
points
.
For extremely large or small distances the returned zoom level may be smaller or larger than the minimum or maximum zoom level allowed on the camera.
This helper method is useful for building camera positions that contain specific physical areas on Earth.
Property Documentation
- (CLLocationCoordinate2D)
target
[read, assign]
|
- (float)
zoom
[read, assign]
|
Zoom level.
Zoom uses an exponentional scale, where zoom 0 represents the entire world as a 256 x 256 square. Each successive zoom level increases magnification by a factor of 2. So at zoom level 1, the world is 512x512, and at zoom level 2, the entire world is 1024x1024.
Implemented in
GMSMutableCameraPosition
.
- (CLLocationDirection)
bearing
[read, assign]
|
The angle, in degrees, of the camera from the nadir (directly facing the Earth).
0 is straight down, 90 is parallel to the ground. Note that the maximum angle allowed is dependent on the zoom. You can think of it as a series of line segments as a function of zoom, rather than a step function. For zoom 16 and above, the maximum angle is 65 degrees. For zoom 10 and below, the maximum angle is 30 degrees.
Implemented in
GMSMutableCameraPosition
.
Except as otherwise noted, the content of this page is licensed under the
Creative Commons Attribution 4.0 License
, and code samples are licensed under the
Apache 2.0 License
. For details, see the
Google Developers Site Policies
. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-04-01 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]