Book Image

Learning Android Google Maps

Book Image

Learning Android Google Maps

Overview of this book

This book helps you to overcome the most common problems faced by users and helps you create a successful map application without any hassle. The book starts with a brief description of how to set up an environment and obtain an API key to create your map application. This book will teach you about adding markers, overlays, and information windows to the map in detail. You will then dive deep into customizing various types of maps and working with location data and Google Street view. By the end of this book, you will be able to create succinct map applications in Android using Google maps efficiently.
Table of Contents (18 chapters)
Learning Android Google Maps
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Using overlays


Overlays are images that are displayed on top of the original Google map. There are two types of overlays:

  • Ground overlays

  • Tile overlays

Let's discuss both of these in detail.

Ground overlays

Ground overlays are attached to latitude and longitude coordinates. They move when we drag or zoom a map. Ground overlays are really helpful when we wish to display a single image over the surface of the map. The following image is an example of a ground overlay, where the Android logo is displayed over the map:

Adding a ground overlay

A ground overlay can be added using a GroundOverlayOptions object. By calling the image() method, you can set an image as an overlay. It takes BitmapDescriptor as a parameter. You can use methods from the BitmapDescriptorFactory class to select the image. Refer to the Using a custom image as a marker section. We can call the position() method to position the image at a particular location and adjust its width. We must pass the LatLng coordinates and width as a...