Hide

GMSProjection Class Reference

GMSProjection Class Reference

Defines a mapping between Earth coordinates (CLLocationCoordinate2D) and coordinates in the map's view (CGPoint). More...

Public Member Functions

(CGPoint) - pointForCoordinate:
 Maps an Earth coordinate to a point coordinate in the map's view.
(CLLocationCoordinate2D) - coordinateForPoint:
 Maps a point coordinate in the map's view to an Earth coordinate.
(CGFloat) - pointsForMeters:atCoordinate:
 Converts a distance in meters to content size.
(BOOL) - containsCoordinate:
 Returns whether a given coordinate (lat/lng) is contained within the projection.
(GMSVisibleRegion- visibleRegion
 Returns the region (four location coordinates) that is visible according to the projection.

Detailed Description

Defines a mapping between Earth coordinates (CLLocationCoordinate2D) and coordinates in the map's view (CGPoint).

A projection is constant and immutable, in that the mapping it embodies never changes. The mapping is not necessarily linear.

Passing invalid Earth coordinates (i.e., per CLLocationCoordinate2DIsValid) to this object may result in undefined behavior.

This class should not be instantiated directly, instead, obtained via projection on GMSMapView.


Member Function Documentation

- (CGPoint) pointForCoordinate: (CLLocationCoordinate2D)  coordinate

Maps an Earth coordinate to a point coordinate in the map's view.

- (CLLocationCoordinate2D) coordinateForPoint: (CGPoint)  point

Maps a point coordinate in the map's view to an Earth coordinate.

- (CGFloat) pointsForMeters: (CLLocationDistance)  meters
atCoordinate: (CLLocationCoordinate2D)  coordinate 

Converts a distance in meters to content size.

This is only accurate for small Earth distances, as it uses CGFloat for screen distances.

- (BOOL) containsCoordinate: (CLLocationCoordinate2D)  coordinate

Returns whether a given coordinate (lat/lng) is contained within the projection.

Returns the region (four location coordinates) that is visible according to the projection.

If padding was set on GMSMapView, this region takes the padding into account.

The visible region can be non-rectangular. The result is undefined if the projection includes points that do not map to anywhere on the map (e.g., camera sees outer space).

Send feedback about...

Google Maps SDK for iOS
Need help? Visit our support page.