Understanding the Amazon Maps API v2
With the Amazon Maps API, you can quickly and easily create mapping applications for Amazon devices. Your app can integrate high-quality 3D maps with fluid zooming and panning.
This guide provides a high-level overview of programming with the Amazon Maps API.
You can display an Amazon map in an
Activity using the
MapFragment class or the
SupportMapFragment class (for devices earlier than API 12).
To manipulate the map, retrieve an
AmazonMap object from the
AmazonMap class is the primary class for working with the map.
Once a map is displayed, users can pan, zoom, rotate, and tilt the map using touch gestures.
You can set several options for the map. For example, you can set the map type, disable the gestures for manipulating the map (rotating, scrolling, and tilting), and control whether UI elements such as the zoom buttons and the compass button are displayed.
AmazonMapOptions to set the initial map settings, either in the XML layout or in code.
Moving the Map Camera
The map camera determines the area of the world shown by the map.
- The camera target is the latitude and longitude position at the center of the map.
- The camera zoom level determines the scale of the area shown. As the number becomes larger, the camera moves closer to the earth to show less area but with more detail.
- The camera bearing determines the orientation of the map. Bearing is measured in degrees and works similar to compass bearings. For example, setting bearing to 0 orients the map with North at the top, while setting the bearing to 270 rotates the map to position due West at the top.
- The camera tilt is the angle of the camera in relation to the earth.
You can retrieve a
CameraPosition from the
AmazonMap to get information about the current camera position.
To move the camera to a new position, you create a
CameraUpdate object that specifies the new location, zoom, bearing, and/or tilt and pass it to the
Displaying the User's Location
You can automatically add the user's current location and a "locate" button by turning on the my location layer with
Drawing Objects on the Map
Mapping apps commonly draw objects on the map, such as markers indicating points of interest or destinations, lines representing routes, and other shapes.
You can add markers to the map by defining the marker location and other properties in a
MarkerOptions object and then calling
AmazonMap.addMarker(). Markers can use custom icons and colors.
Lines and Shapes
You can add lines and shapes to the map. Similar to markers, you set the initial settings for the shape with an
Options object, then call an
add method to draw the shape. You can add:
- Lines, defined by a series of points (
- Circles, defined with a center and a radius (
- Polygons, defined by a series of at least three points that are connected by lines (
For more details about common Maps API tasks, see:
- Displaying an Interactive Map with the Amazon Maps API v2
- Drawing Markers and Objects on the Map with the Amazon Maps API v2
For information on setting up your project to use the Amazon Maps API, see Configuring Your Project to use the Amazon Maps API v2.
For information about migrating your app from Google Maps, see Migrating an App from Google Maps v2.
For information about registering your app so you can display map tiles, as well as testing guidelines, see Registering and Testing Your Amazon Maps API v2 App.
For a full sample app illustrating the Amazon Maps API, see Using the Amazon Maps API v2 Sample App.
For a reference to the API, see the Amazon Maps API v2 Reference.
For additional help and information, see the Amazon Maps API Frequently Asked Questions