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 custom camera views


Until now, we have manually changed the camera view by panning and zooming. Let's see how we can do it programmatically.

To do this, we need to use the StreetViewPanoramaCamera object. Create a StreetViewPanoramaCamera object by using the nested StreetViewPanoramaCamera.Builder class. We can set the tilt, zoom, and bearing of the street view. The methods are as follows:

Method

Parameter

Function

zoom()

Zoom level in float

By default, the zoom level is 0. The maximum zoom level depends on the panorama. If the zoom level is specified in a negative value, it is set to 0.

tilt()

Tilt angle in float

Sets the tilt angle of the camera from the horizon of the panorama. The angle ranges between -90 and 90.

bearing()

Bearing angle in float

Sets the bearing angle. It fixes the camera in degrees clockwise from north.

To set a camera view with a zoom level of 2, and the bearing and tilt angle as 45 degrees, I would use the code:

 StreetViewPanoramaCamera camera = new...