Projection

public interface Projection

A projection is used to translate between on screen location and geographic coordinates on the surface of the Earth (LatLng). Screen location is in screen pixels (not display pixels) with respect to the top left corner of the map (and not necessarily of the whole screen).

All methods should be accessed on the Android UI thread only.

Public Method Summary

abstract LatLng
fromScreenLocation(Point point)
Returns the geographic location that corresponds to a screen location.
abstract VisibleRegion
getVisibleRegion()
Gets a projection of the viewing frustum for converting between screen coordinates and geo-latitude/longitude coordinates.
abstract Point
toScreenLocation(LatLng location)
Returns a screen location that corresponds to a geographical coordinate (LatLng).

Public Methods

public abstract LatLng fromScreenLocation (Point point)

Returns the geographic location that corresponds to a screen location. The screen location is specified in screen pixels (not display pixels) relative to the top left of the map (not the top left of the whole screen).

Parameters
point A Point on the screen in screen pixels.
Returns
  • The LatLng corresponding to the point on the screen, or null if the ray through the given screen point does not intersect the ground plane (this might be the case if the map is heavily tilted).

public abstract VisibleRegion getVisibleRegion ()

Gets a projection of the viewing frustum for converting between screen coordinates and geo-latitude/longitude coordinates.

Returns
  • The projection of the viewing frustum in its current state with padding taken into account, or null if the projection includes points that do not map to anywhere on the map (e.g, camera sees outer space).

public abstract Point toScreenLocation (LatLng location)

Returns a screen location that corresponds to a geographical coordinate (LatLng). The screen location is in screen pixels (not display pixels) relative to the top left of the map (not of the whole screen).

Parameters
location A LatLng on the map to convert to a screen location.
Returns
  • A Point representing the screen location in screen pixels, or null if the location projects behind the camera plane.