Android:Google Map Utility Library

GMaps Utils

Google Maps Android API Utility Library

discusses the utility library, with a focus on polyline decoding, spherical geometry, and bubble icons:

The current version of the library is 0.3.1.

The Utilities

Add heatmaps to your map


Heatmaps make it easy for viewers to 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, passing it the heatmap tile provider, and add the tile overlay to the map.

GMap上にデータ分布を視覚化するヒートマップを作成する. ヒートマップはマーカと異なり, データ分布を色や形で表現する. ヒートマップデータ(LatLng)のコレクションをインプットにHeatmapTileProvider作成. HtatmapTileProviderをインプットにTileOverlayを作成してGMapに追加する.

For details, see the documentation on the Google Maps Android Heatmap Utility.

Customise markers via bubble icons

bubble icons

Add a 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.

IconGeneratorではGMap上のマーカにスニペットを表示できる. このutilはマーカにちょっとした情報(テキスト等)を付け加えることができる. アドバンテージは複数のマーカに関する情報を同時に開いておくことができる点. マーカスタイル(コンテンツの向き, 背景画像/9patch)を変更することもできる.

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.

ClusterManagerは複数のマーカを異なるズームレベルで管理することをサポートする. 多くのマーカをGMap上に配置すると見通しが悪くなるがそれを回避できる. ハイズームで表示した場合は個別マーカを, ズームアウトすると複数のマーカが寄せ集まったクラスタとして表示する.

For details, see the documentation on the Google Maps Android Marker Clustering Utility.

Encode and decode polylines


The PolyUtil is useful for converting encoded polylines and polygons to latitude/longitude coordinates, and vice versa.

PolyUtilは多角形(Polylines or 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. You may receive this encoded string in a response from a Google API, such as the Google Directions API.

GMapでは, 定義された多角形をエンコードされた文字列で保存する際に経度と緯度を調整する. See the detailed explanation of polyline encoding. この文字列はGoogle Directions API等から応答される.

You can use PolyUtil in the Google Maps Android API 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 API web services.

Google Maps Android API Utility Libraryに含まれるPolyUtilを使って, シーケンシャルな経度/緯度(‘LatLngs’)にエンコードしたり, その反対にデコードすることができる. これはWebサービスとの相互通信にも使用できる.

Calculate distances, areas and headings via 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.

SphericalUtilには球面幾何学のユーティリティが用意されている. 経度と緯度に基づいて距離, 面積と見出しを計算することができる. 次は代表的なメソッド:

  • computeDistanceBetween() – 経度/緯度をベースにした2地点間の最短パスを計算する. 最短パスは”測地点”と呼ばれ, 球面上では大きな円弧セグメントになる.
  • computeHeading() – 真北を0°とし, 2地点間の角度を時計回りで計算する.
  • computeArea() – ポリゴン領域の面積を平方メートル単位で求める. 閉ループを定義するLatLngオブジェクトを渡す.
  • interpolate() – 球面線形補間を行い, 2地点の間にある座標を返す.

Refer to the reference documentation for a full list of methods in the utility.

Getting started

Android Studio/Gradle

dependencies {
    compile 'com.google.maps.android:android-maps-utils:0.3+'

Source code


Copyright 2013 Google Inc.

Licensed under the Apache License, Version 2.0 (the “License”);
you may not use this file except in compliance with the License.
You may obtain a copy of the License at


Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an “AS IS” BASIS,
See the License for the specific language governing permissions and
limitations under the License.


Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 3.0 License, and code samples are licensed under the Apache 2.0 License. For details, see our Site Policies.