【发布时间】:2016-02-22 04:19:45
【问题描述】:
我需要访问 Google Maps Android Heatmap Utility(注意;这不是标准的 google maps API)。见:https://developers.google.com/maps/documentation/android-api/utility/heatmap
目前为止
- 在 build.gradle (Modile: app) 文件中添加了依赖 compile 'com.google.maps.android:android-maps-utils:0.4+'。
-
在我的项目中添加了以下代码:
private void addHeatMap() { List<LatLng> list = null; // Get the data: latitude/longitude positions of police stations. try { list = readItems(R.raw.police_stations); } catch (JSONException e) { Toast.makeText(this, "Problem reading list of locations.", Toast.LENGTH_LONG).show(); } // Create a heat map tile provider, passing it the latlngs of the police stations. HeatmapTileProvider mProvider = new HeatmapTileProvider.Builder() .data(list) .build(); // Add a tile overlay to the map, using the heat map tile provider. mOverlay = mMap.addTileOverlay(new TileOverlayOptions().tileProvider(mProvider));}
以下是带有 Android Studio 的 OS X 设置指南: http://googlemaps.github.io/android-maps-utils/#start
【问题讨论】:
标签: android macos google-maps heatmap