public final class

Projection

extends Object
java.lang.Object
   ↳ com.amazon.geo.mapsv2.Projection

Class Overview

An object used to translate between screen pixels (not display pixels) and geographic locations on the map (latitude / longitude).

To obtain a Projection for your map, call AmazonMap.getProjection().

Summary

Public Methods
LatLng fromScreenLocation(Point point)
Converts the specified point on the screen (Point) to a geographic location on the map and returns a LatLng.
VisibleRegion getVisibleRegion()
Gets a VisibleRegion representing the geographic area currently visible on the map.
Point toScreenLocation(LatLng location)
Converts the specified geographic location (LatLng) to the corresponding point in screen pixels and returns it in a Point.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public LatLng fromScreenLocation (Point point)

Converts the specified point on the screen (Point) to a geographic location on the map and returns a LatLng. Provide the screen location in pixels.

This method returns a LatLng containing (0, 0) if the map is not loaded.

Parameters
point The point on the screen to convert, in pixels.
Returns
  • A LatLng representing the latitude / longitude that corresponds to the specified point on the screen.

public VisibleRegion getVisibleRegion ()

Gets a VisibleRegion representing the geographic area currently visible on the map. The VisibleRegion consists of a LatLng for each of the four corners of the map and a LatLngBounds object that approximates the region surrounding the four corners.

This method returns a point at (0, 0) if the map is not loaded.

Returns
  • A VisibleRegion representing the visible area on the map.

public Point toScreenLocation (LatLng location)

Converts the specified geographic location (LatLng) to the corresponding point in screen pixels and returns it in a Point.

Note that the returned Point is relative to the top left corner of the screen. It can reference a point not currently visible on the map if you pass the method a LatLng that is outside the visible area of the map.

This method returns a Point containing (0, 0) if the map is not loaded

Parameters
location The LatLng representing the geographic location on the map to convert.
Returns
  • A Point representing the screen location in pixels from the top left of the screen.