Projection

  • Projection is a class used to translate between on-screen locations in screen pixels relative to the top left of the map and geographic coordinates (LatLng) on the Earth's surface.

  • ThefromScreenLocation method returns the geographic location (LatLng) corresponding to a given screen location (Point).

  • ThegetVisibleRegion method gets a projection of the viewing frustum for converting between screen coordinates and geographical coordinates.

  • ThetoScreenLocation method returns a screen location (Point) that corresponds to a given geographical coordinate (LatLng).

public final classProjection extendsObject

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).

Public Method Summary

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

Inherited Method Summary

From class java.lang.Object
Object
clone()
boolean
equals(Object arg0)
void
finalize()
finalClass<?>
getClass()
int
hashCode()
final void
notify()
final void
notifyAll()
String
toString()
final void
wait(long arg0, int arg1)
final void
wait(long arg0)
final void
wait()

Public Methods

publicLatLngfromScreenLocation(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
pointAPoint on the screen in screen pixels. Must not benull.
Returns
  • TheLatLng corresponding to thepoint on the screen, ornull 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).

publicVisibleRegiongetVisibleRegion()

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.

publicPointtoScreenLocation(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
locationALatLng on the map to convert to a screen location. Must not benull.
Returns
  • APoint representing the screen location in screen pixels.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024-10-31 UTC.