Select platform: [Android](https://developers.google.com/maps/documentation/android-sdk/utility.md.txt "View this page for the Android platform docs.") [iOS](https://developers.google.com/maps/documentation/ios-sdk/utility.md.txt "View this page for the iOS platform docs.") [Video](https://www.youtube.com/watch?v=nb2X9IjjZpM)

Looking for advanced features to add to your maps? The
[Maps SDK for Android Utility Library](https://github.com/googlemaps/android-maps-utils) is an open-source library of classes that are useful
for a range of applications. The GitHub repository includes the utility
classes and a **demo** app that illustrates the use of each
class.

In this video, Chris Broadfoot discusses the utility library, with a focus on
polyline decoding, spherical geometry, and bubble icons.

## Quick setup

To install the Maps SDK for Android Utility Library, follow the
[setup guide](https://developers.google.com/maps/documentation/android-sdk/utility/setup.md.txt).

## The utilities

|---|---|
| ![A map with a GeoJSON layer](https://developers.google.com/static/maps/documentation/android-sdk/images/utility-geojson-noframe.png) | ### Import GeoJSON onto your map You can store features in [GeoJSON](http://geojson.org/) format and use this utility to render them as a layer on top of a map. Call `addLayer()` to add your GeoJSON data to the map. You can also add individual features by calling `addFeature()`, passing in a `GeoJsonFeature` object. For details, see the documentation on the [Google Maps Android GeoJSON Utility](https://developers.google.com/maps/documentation/android-sdk/utility/geojson.md.txt). |
| ![A map with a KML layer](https://developers.google.com/static/maps/documentation/android-sdk/images/utility-kml-noframe.png) | ### Import KML onto your map Using this utility, you can convert [KML](https://developers.google.com/kml/documentation/kmlreference.md.txt) objects into geographical shapes and render them as a layer on top of a map. Call `addLayerToMap()` to add your layer to the map. You can access properties in a KML object by calling `getProperties()` on any Placemark, GroundOverlay, Document or Folder. For details, see the documentation on the [Google Maps Android KML Utility](https://developers.google.com/maps/documentation/android-sdk/utility/kml.md.txt). |
| ![A map with a heatmap](https://developers.google.com/static/maps/documentation/android-sdk/images/utility-heatmap-noframe.png) | ### Add heatmaps to your map Heatmaps help viewers understand the distribution and relative intensity of data points on a map. Rather than placing a marker at each location, heatmaps use color and shape to represent the distribution of the data. Create a `HeatmapTileProvider`, passing it a collection of `LatLng` objects representing points of interest on the map. Then create a new [`TileOverlay`](https://developers.google.com/android/reference/com/google/android/gms/maps/model/TileOverlay.md.txt), passing it the heatmap tile provider, and add the tile overlay to the map. For details, see the documentation on the [Google Maps Android Heatmap Utility](https://developers.google.com/maps/documentation/android-sdk/utility/heatmap.md.txt). |
| ![A map with bubble icons](https://developers.google.com/static/maps/documentation/android-sdk/images/utility-bubblemarker.png) | ### Customize markers with bubble icons Add an `IconGenerator` to display snippets of information on your markers. This utility provides a way of making your marker icons look a bit like info windows, in that the marker itself can contain text and other content. The advantage is that you can keep more than one marker open at the same time, whereas only one info window can be open at once. You can also style the markers, change the orientation of the marker and/or content, and change the marker's background image/nine-patch. |
| ![A map with a marker](https://developers.google.com/static/maps/documentation/android-sdk/images/map-with-marker.png) | ### Animate markers You can animate a marker so it smoothly moves from its current position to a new location. The [`AnimationUtil`](https://googlemaps.github.io/android-maps-utils/javadoc/com/google/maps/android/ui/AnimationUtil.html) class provides this capability. For an example of how to use it, see the [`AnimationUtilDemoActivity`](https://github.com/googlemaps/android-maps-utils/blob/main/demo/src/main/java/com/google/maps/android/utils/demo/AnimationUtilDemoActivity.java) in the utility library's GitHub repository. |
| ![A map with clustered markers](https://developers.google.com/static/maps/documentation/android-sdk/images/utility-markercluster.png) | ### Manage marker clusters The `ClusterManager` helps you manage multiple markers at different zoom levels. This means you can put a large number of markers on a map without making the map hard to read. When a user views the map at a high zoom level, the individual markers show on the map. When the user zooms out to a lower zoom level, the markers gather together into clusters, to make viewing the map easier. For details, see the documentation on the [Google Maps Android Marker Clustering Utility](https://developers.google.com/maps/documentation/android-sdk/utility/marker-clustering.md.txt). |
| ![A map with multiple layers](https://developers.google.com/static/maps/documentation/android-sdk/images/utility-multilayer.png) | ### Add multiple layers to the same map You can show features from GeoJSON, KML, and clusters---as well as your own markers, polylines, and polygons---all on the same map. You can also make these layers interactive by adding a click listener to each layer. To do so, instantiate the `MarkerManager`, `GroundOverlayManager`, `PolygonManager`, and `PolylineManager` classes and pass them into the constructors of `GeoJsonLayer`, `KmlLayer`, and `ClusterManager` when you set them up. You can then use these `Manager` classes directly to add your own markers, polylines, and polygons to the map. For details, see the [documentation](https://developers.google.com/maps/documentation/android-sdk/utility/multilayer.md.txt) on the Google Maps Android Multi Layer Demo. |
| ![A map with an encoded polyline](https://developers.google.com/static/maps/documentation/android-sdk/images/utility-polycoding.png) | ### Encode and decode polylines The `PolyUtil` class converts encoded polylines and polygons to latitude/longitude coordinates, and converts coordinates to encoded polylines and polygons. In Google Maps, the latitude and longitude coordinates that define a polyline or polygon are stored as an encoded string. See the detailed explanation of [polyline encoding](https://developers.google.com/maps/documentation/utilities/polylinealgorithm.md.txt). You may receive this encoded string in a response from a Google API, such as the Directions API (Legacy). You can use `PolyUtil` in the Maps SDK for Android Utility Library to encode a sequence of latitude/longitude coordinates ('LatLngs') into an encoded path string, and to decode an encoded path string into a sequence of LatLngs. This will ensure interoperability with the Google Maps APIs web services. |
| ![Calculated distance between two points on a map](https://developers.google.com/static/maps/documentation/android-sdk/images/utility-spherical.png) | ### Calculate distances, areas, and headings with spherical geometry Using the spherical geometry utilities in `SphericalUtil`, you can compute distances, areas, and headings based on latitudes and longitudes. Here are some of the methods available in the utility: - `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. Refer to the [reference documentation](http://googlemaps.github.io/android-maps-utils/javadoc/) for a full list of methods in the utility. |
| ![Check whether a location is supported in Street View](https://developers.google.com/static/maps/documentation/android-sdk/images/streetview-utils.png) | ### Check whether a location is supported in Street View The `StreetViewUtil` class provides functionality to check whether a location is supported in Street View. You can avoid errors when adding a Street View panorama to an Android app by calling this metadata utility and only adding a Street View panorama if the response is `OK`. For details, see the documentation on the [Street View metadata utility](https://github.com/googlemaps/android-maps-utils) on GitHub. |