infinum android talks #04 - google maps android api utility library

20
Google Maps Android API utility library Željko Plesac

Upload: denisinfinum

Post on 19-May-2015

912 views

Category:

Technology


4 download

DESCRIPTION

Android maps utils is an open-source library, which provides advanced features for our maps. We'll demonstrate the most important set of features on live examples, like heatmaps, marker clustering and spherical geometry algorithms.

TRANSCRIPT

Page 1: Infinum Android Talks #04 - Google Maps Android API utility library

Google Maps Android API utility library

Željko Plesac

Page 2: Infinum Android Talks #04 - Google Maps Android API utility library

Content

• Introduction

• Setup

• Usage

• Conclusion

Page 3: Infinum Android Talks #04 - Google Maps Android API utility library

Introduction

• open-source library which contains classes that are useful for a wide range of applications using the Google Maps Android API.

• developed by Google

• current version is 0.3 (still in heavy development)

Page 4: Infinum Android Talks #04 - Google Maps Android API utility library

Setup

• Maven

• Gradle

• Eclipse • clone repo from GitHub and add as library project

Page 5: Infinum Android Talks #04 - Google Maps Android API utility library

Usage

• Marker clustering

• Bubble icons

• Heatmaps

• Spherical geometry and algorithms

Page 6: Infinum Android Talks #04 - Google Maps Android API utility library

Marker clustering

The marker clustering utility helps you manage multiple

markers at different zoom levels

Page 7: Infinum Android Talks #04 - Google Maps Android API utility library

• Implement ClusterItem to represent a marker on the map

• Add a new ClusterManager to group the cluster items (markers) based on zoom level.

• Set the map's OnCameraChangeListener() to the ClusterManager

• Feed the markers into the ClusterManager

Marker clustering

Page 8: Infinum Android Talks #04 - Google Maps Android API utility library
Page 9: Infinum Android Talks #04 - Google Maps Android API utility library
Page 10: Infinum Android Talks #04 - Google Maps Android API utility library
Page 11: Infinum Android Talks #04 - Google Maps Android API utility library

Bubble icons

• Use custom markers a bit like info windows - in that way markers contains more information

Page 12: Infinum Android Talks #04 - Google Maps Android API utility library

Bubble icons

Page 13: Infinum Android Talks #04 - Google Maps Android API utility library

Bubble icons - options

1. Default option

Page 14: Infinum Android Talks #04 - Google Maps Android API utility library

Bubble icons - options

2. Rotate icon

Page 15: Infinum Android Talks #04 - Google Maps Android API utility library

Bubble icons - options

3. Rotate icon and content

Page 16: Infinum Android Talks #04 - Google Maps Android API utility library

Heatmaps

• Add one or more heatmaps to a Google map in your application. Heatmaps make it easy for viewers to understand the distribution and relative intensity of data points on a map

Page 17: Infinum Android Talks #04 - Google Maps Android API utility library

Heatmaps• Use HeatmapTileProvider.Builder(), passing it a

collection of LatLng objects, to add a new HeatmapTileProvider.

• Create a new TileOverlayOptions object with the relevant options, including the HeatmapTileProvider.

• Call GoogleMap.addTileOverlay() to add the overlay to the map.

Page 18: Infinum Android Talks #04 - Google Maps Android API utility library

Spherical geometry• computeDistanceBetween() – Returns the distance, in

meters, between two latitude/longitude coordinates.

• computeHeading() – Returns the bearing, in degrees, between two latitude/longitude coordinates.

• computeArea() – Returns the area, in square meters, of a closed path on the Earth.

• interpolate() – Returns the latitude/longitude coordinates of a point that lies a given fraction of the distance between two given points. You can use this to animate a marker between two points, for example.

Page 19: Infinum Android Talks #04 - Google Maps Android API utility library

Algorithms

• encode & decode polylines (i.e. obtained using Google Directions API) with PolyUtil

Page 20: Infinum Android Talks #04 - Google Maps Android API utility library

Conclusion

• Android Maps Utils is a great lightweight library to add that “extra” touch to Google maps interaction

• still in heavy development (missing few basic functionalities)

• new utilities are already promised (new algorithms)