Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Maps SDK for Android Utility Library

License

NotificationsYou must be signed in to change notification settings

googlemaps/android-maps-utils

Maven CentralReleaseStableTests/Build

ContributorsLicenseStackOverflowDiscord

Maps SDK for Android Utility Library

Description

This open-source library contains utilities that are useful for a widerange of applications using theGoogle Maps SDK for Android.

  • Marker animation - animates a marker from one position to another
  • Marker clustering — handles the display of a large number of points
  • Marker icons — display text on your Markers
  • Heatmaps — display a large number of points as a heat map
  • Import KML — displays KML data on the map
  • Import GeoJSON — displays and styles GeoJSON data on the map
  • Polyline encoding and decoding — compact encoding for paths,interoperability with Maps API web services
  • Spherical geometry — for example: computeDistance, computeHeading,computeArea
  • Street View metadata — checks if a Street View panorama exists at a given location

You can also find Kotlin extensions for this library inMaps Android KTX.

Requirements

Installation

dependencies {    // Utilities for Maps SDK for Android (requires Google Play Services)    // You do not need to add a separate dependency for the Maps SDK for Android    // since this library builds in the compatible version of the Maps SDK.    implementation 'com.google.maps.android:android-maps-utils:3.19.1'    // Optionally add the Kotlin Extensions (KTX) for full Kotlin language support    // See latest version at https://github.com/googlemaps/android-maps-ktx    // implementation 'com.google.maps.android:maps-utils-ktx:<latest-version>'}

Sample App

This repository includes asample app that illustrates the use of this library.

To run the demo app, ensure you've met the requirements above then:

  1. Clone the repository
  2. Add a filelocal.properties in the root project (this file shouldNOT be under version control to protect your API key)
  3. Add a single line tolocal.properties that looks likeMAPS_API_KEY=YOUR_API_KEY, whereYOUR_API_KEY is the API key you obtained earlier
  4. Build and run thedebug variant for the Maps SDK for Android version

Setting up the Map ID

Some of the features in the demo app, such as Advanced Markers, require a Map ID. You can learn more about map IDs in theofficial documentation. You can set the Map ID in one of the following ways:

  1. secrets.properties: Add a line to yoursecrets.properties file with your Map ID:

    MAP_ID=YOUR_MAP_ID
  2. strings.xml: Alternatively, you can set the Map ID in thedemo/src/main/res/values/strings.xml file:

    <string name="map_id">YOUR_MAP_ID</string>
  3. XML Layout Files: You can also hardcode the Map ID directly in the XML layout files where a map is defined, by setting themap:mapId attribute:

    <androidx.fragment.app.FragmentContainerView    map:mapId="YOUR_MAP_ID"     />

Documentation

See thedocumentation for a full list of classes and their methods.

Full guides for using the utilities are published inGoogle Maps Platform documentation.

Usage

Marker utilities

Marker utilities

Data visualization utilities

Data visualization utilities

Polyline and spherical geometry utilities

Additional utilities

Street View metadata utility

Street View metadata utility

The StreetViewUtil class provides functionality to check whether a location is supported in StreetView. You can avoid errors whenadding a Street View panorama to an Android app by calling this metadata utility and only adding a Street View panorama if the response isOK.

StreetViewUtils.fetchStreetViewData(LatLng(8.1425918, 11.5386121), BuildConfig.MAPS_API_KEY,Source.DEFAULT)

fetchStreetViewData will returnNOT_FOUND,OK,ZERO_RESULTS orREQUEST_DENIED, depending on the response.

By default, theSource is set toSource.DEFAULT, but you can also specifySource.OUTDOOR to request outdoor Street View panoramas.

Contributing

Contributions are welcome and encouraged! If you'd like to contribute, send us apull request and refer to ourcode of conduct andcontributing guide.

Terms of Service

This library uses Google Maps Platform services. Use of Google Maps Platform services through this library is subject to the Google Maps PlatformTerms of Service.

If your billing address is in the European Economic Area, effective on 8 July 2025, theGoogle Maps Platform EEA Terms of Service will apply to your use of the Services. Functionality varies by region.Learn more.

This library is not a Google Maps Platform Core Service. Therefore, the Google Maps Platform Terms of Service (e.g. Technical Support Services, Service Level Agreements, and Deprecation Policy) do not apply to the code in this library.

Support

This library is offered via an open sourcelicense. It is not governed by the Google Maps Platform Support [Technical Support Services Guidelines, the SLA, or theDeprecation Policy. However, any Google Maps Platform services used by the library remain subject to the Google Maps Platform Terms of Service.

This library adheres tosemantic versioning to indicate when backwards-incompatible changes are introduced. Accordingly, while the library is in version 0.x, backwards-incompatible changes may be introduced at any time.

If you find a bug, or have a feature request, pleasefile an issue on GitHub. If you would like to get answers to technical questions from other Google Maps Platform developers, ask through one of ourdeveloper community channels. If you'd like to contribute, please check thecontributing guide.

You can also discuss this library on ourDiscord server.


[8]ページ先頭

©2009-2025 Movatter.jp