Projection Stay organized with collections Save and categorize content based on your preferences.
Page Summary
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.
The
fromScreenLocationmethod returns the geographic location (LatLng) corresponding to a given screen location (Point).The
getVisibleRegionmethod gets a projection of the viewing frustum for converting between screen coordinates and geographical coordinates.The
toScreenLocationmethod returns a screen location (Point) that corresponds to a given geographical coordinate (LatLng).
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
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
| point | APoint on the screen in screen pixels. Must not benull. |
|---|
Returns
- The
LatLngcorresponding to thepointon the screen, ornullif 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
| location | ALatLng on the map to convert to a screen location. Must not benull. |
|---|
Returns
- A
Pointrepresenting 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.